Skip to content

Commit

Permalink
Support custom initial drawer scale
Browse files Browse the repository at this point in the history
Allows customizing how much the drawer segment scales.
More importantly, enables disabling this scale effect completely if desired
to have more simple push drawer.

Relates to alex-melnyk#52
  • Loading branch information
zbarbuto committed Jan 17, 2025
1 parent 8aa024f commit 0906ef0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/src/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class AdvancedDrawer extends StatefulWidget {
this.backdrop,
this.openRatio = 0.75,
this.openScale = 0.85,
this.initialDrawerScale = 0.75,
this.animationDuration = const Duration(milliseconds: 250),
this.animationCurve,
this.childDecoration,
Expand Down Expand Up @@ -41,6 +42,10 @@ class AdvancedDrawer extends StatefulWidget {
/// Opening ratio.
final double openScale;

/// How large the drawer segment should scale from.
/// Set to 1 to disable drawer segment scale effect.
final double initialDrawerScale;

/// Animation duration.
final Duration animationDuration;

Expand Down Expand Up @@ -228,7 +233,7 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>
);

_drawerScaleAnimation = Tween<double>(
begin: 0.75,
begin: widget.initialDrawerScale,
end: 1.0,
).animate(parentAnimation);

Expand Down

0 comments on commit 0906ef0

Please sign in to comment.