Skip to content

Commit

Permalink
Merge pull request #30 from alex-melnyk/scaleFactor
Browse files Browse the repository at this point in the history
Open scale factor added.
  • Loading branch information
alex-melnyk authored Mar 8, 2022
2 parents 1cdb59b + 7c4f663 commit 3a2c1f9
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.3.1

* The openScale parameter added to manage child scale.

## 1.3.0

* Animation controller could be passed via props.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ An advanced drawer widget, that can be fully customized with size, text, color,
|`controller`|Widget controller|*AdvancedDrawerController*| |
|`backdropColor`|Backdrop color|*Color*| |
|`openRatio`|Opening ratio|*double*|0.75|
|`openScale`|Opening child scale factor|*double*|0.85|
|`animationDuration`|Animation duration|*Duration*|300ms|
|`animationCurve`|Animation curve|*Curve*|Curves.easeInOut|
|`childDecoration`|Child container decoration|*BoxDecoration*|Shadow, BorderRadius|
Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:flutter_lints/flutter.yaml
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class _HomeScreenState extends State<HomeScreen> {
animationDuration: const Duration(milliseconds: 300),
animateChildDecoration: true,
rtlOpening: false,
// openScale: 1.0,
disabledGestures: false,
childDecoration: const BoxDecoration(
// NOTICE: Uncomment if you want to add shadow behind the page.
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.2.4"
version: "1.3.1"
meta:
dependency: transitive
description:
Expand Down
14 changes: 9 additions & 5 deletions lib/src/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class AdvancedDrawer extends StatefulWidget {
this.controller,
this.backdropColor,
this.openRatio = 0.75,
this.openScale = 0.85,
this.animationDuration = const Duration(milliseconds: 250),
this.animationCurve,
this.childDecoration,
Expand All @@ -33,6 +34,9 @@ class AdvancedDrawer extends StatefulWidget {
/// Opening ratio.
final double openRatio;

/// Opening ratio.
final double openScale;

/// Animation duration.
final Duration animationDuration;

Expand Down Expand Up @@ -87,12 +91,12 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>

_animationController.duration = widget.animationDuration;

final parentAnimation = widget.animationCurve != null
? CurvedAnimation(
final parentAnimation = widget.animationCurve == null
? _animationController
: CurvedAnimation(
curve: widget.animationCurve!,
parent: _animationController,
)
: _animationController;
);

_drawerScaleAnimation = Tween<double>(
begin: 0.75,
Expand All @@ -106,7 +110,7 @@ class _AdvancedDrawerState extends State<AdvancedDrawer>

_childScaleAnimation = Tween<double>(
begin: 1.0,
end: 0.85,
end: widget.openScale,
).animate(parentAnimation);

_childDecorationAnimation = DecorationTween(
Expand Down
14 changes: 14 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
meta:
dependency: transitive
description:
Expand Down
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_advanced_drawer
description: An advanced drawer widget, that can be fully customized with size, text, color, radius of corners.
version: 1.3.0
version: 1.3.1
homepage: https://github.com/alex-melnyk/flutter_advanced_drawer
repository: https://github.com/alex-melnyk/flutter_advanced_drawer
issue_tracker: https://github.com/alex-melnyk/flutter_advanced_drawer/issues
Expand All @@ -13,4 +13,7 @@ dependencies:
flutter:
sdk: flutter

dev_dependencies:
flutter_lints: 1.0.4

flutter:

0 comments on commit 3a2c1f9

Please sign in to comment.