@@ -12,6 +12,7 @@ class AdvancedDrawer extends StatefulWidget {
1212 this .openRatio = 0.75 ,
1313 this .openScale = 0.85 ,
1414 this .initialDrawerScale = 0.75 ,
15+ this .drawerSlideRatio = 0 ,
1516 this .animationDuration = const Duration (milliseconds: 250 ),
1617 this .animationCurve,
1718 this .childDecoration,
@@ -46,6 +47,11 @@ class AdvancedDrawer extends StatefulWidget {
4647 /// Set to 1 to disable drawer segment scale effect.
4748 final double initialDrawerScale;
4849
50+ /// How far the drawer segment should slide with the content
51+ /// 0 = no slide distance
52+ /// 1 = slide from completely off screen
53+ final double drawerSlideRatio;
54+
4955 /// Animation duration.
5056 final Duration animationDuration;
5157
@@ -82,6 +88,7 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
8288 late Animation <double > _drawerScaleAnimation;
8389 late Animation <Offset > _childSlideAnimation;
8490 late Animation <double > _childScaleAnimation;
91+ late Animation <Offset > _drawerSlideAnimation;
8592 late Animation <Decoration > _childDecorationAnimation;
8693
8794 late double _offsetValue;
@@ -125,15 +132,18 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
125132 alignment: widget.rtlOpening
126133 ? Alignment .centerRight
127134 : Alignment .centerLeft,
128- child: FractionallySizedBox (
129- widthFactor: widget.openRatio,
130- child: ScaleTransition (
131- scale: _drawerScaleAnimation,
132- alignment: widget.rtlOpening
133- ? Alignment .centerLeft
134- : Alignment .centerRight,
135- child: RepaintBoundary (
136- child: widget.drawer,
135+ child: SlideTransition (
136+ position: _drawerSlideAnimation,
137+ child: FractionallySizedBox (
138+ widthFactor: widget.openRatio,
139+ child: ScaleTransition (
140+ scale: _drawerScaleAnimation,
141+ alignment: widget.rtlOpening
142+ ? Alignment .centerLeft
143+ : Alignment .centerRight,
144+ child: RepaintBoundary (
145+ child: widget.drawer,
146+ ),
137147 ),
138148 ),
139149 ),
@@ -238,6 +248,11 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
238248 end: 1.0 ,
239249 ).animate (parentAnimation);
240250
251+ _drawerSlideAnimation = Tween <Offset >(
252+ begin: Offset (- widget.drawerSlideRatio, 0 ),
253+ end: Offset .zero,
254+ ).animate (parentAnimation);
255+
241256 _childSlideAnimation = Tween <Offset >(
242257 begin: Offset .zero,
243258 end: Offset (widget.openRatio, 0 ),
0 commit comments