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 #52
  • Loading branch information
zbarbuto committed Jan 17, 2025
1 parent 8aa024f commit bbfc692
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ An advanced drawer widget, that can be fully customized with size, text, color,
|`animateChildDecoration`|Indicates that [childDecoration] might be animated or not.|*bool*|true|
|`rtlOpening`|Opening from Right-to-left.|*bool*|false|
|`disabledGestures`|Disable gestures.|*bool*|false|
|`initialDrawerScale`|How large the drawer segment should scale from.|*double*|0.75|

## Preview
| Preview Tap | Preview Gesture |
Expand Down
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 bbfc692

Please sign in to comment.