From bbfc692792b3bdbdf97c571e4d6e3fa21ee6a753 Mon Sep 17 00:00:00 2001 From: Zak Barbuto Date: Fri, 17 Jan 2025 14:18:27 +1030 Subject: [PATCH] Support custom initial drawer scale 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 --- README.md | 1 + lib/src/widget.dart | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 71701e9..af6a0a2 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/lib/src/widget.dart b/lib/src/widget.dart index fe24e3a..85c9392 100644 --- a/lib/src/widget.dart +++ b/lib/src/widget.dart @@ -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, @@ -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; @@ -228,7 +233,7 @@ class _AdvancedDrawerState extends State ); _drawerScaleAnimation = Tween( - begin: 0.75, + begin: widget.initialDrawerScale, end: 1.0, ).animate(parentAnimation);