Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom initial drawer scale #58

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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