Jonny Borges
Committed by GitHub

Merge pull request #2150 from bejaeger/master

Add option to parse animation curve to bottomsheet route
@@ -21,6 +21,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -21,6 +21,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
21 RouteSettings? settings, 21 RouteSettings? settings,
22 this.enterBottomSheetDuration = const Duration(milliseconds: 250), 22 this.enterBottomSheetDuration = const Duration(milliseconds: 250),
23 this.exitBottomSheetDuration = const Duration(milliseconds: 200), 23 this.exitBottomSheetDuration = const Duration(milliseconds: 200),
  24 + this.curve,
24 }) : super(settings: settings) { 25 }) : super(settings: settings) {
25 RouterReportManager.instance.reportCurrentRoute(this); 26 RouterReportManager.instance.reportCurrentRoute(this);
26 } 27 }
@@ -38,6 +39,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -38,6 +39,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
38 // final String name; 39 // final String name;
39 final Duration enterBottomSheetDuration; 40 final Duration enterBottomSheetDuration;
40 final Duration exitBottomSheetDuration; 41 final Duration exitBottomSheetDuration;
  42 + final Curve? curve;
41 // remove safearea from top 43 // remove safearea from top
42 final bool removeTop; 44 final bool removeTop;
43 45
@@ -62,6 +64,15 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> { @@ -62,6 +64,15 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
62 } 64 }
63 65
64 @override 66 @override
  67 + Animation<double> createAnimation() {
  68 + if (curve != null) {
  69 + return CurvedAnimation(
  70 + curve: curve!, parent: _animationController!.view);
  71 + }
  72 + return _animationController!.view;
  73 + }
  74 +
  75 + @override
65 AnimationController createAnimationController() { 76 AnimationController createAnimationController() {
66 assert(_animationController == null); 77 assert(_animationController == null);
67 _animationController = 78 _animationController =
@@ -27,6 +27,7 @@ extension ExtensionBottomSheet on GetInterface { @@ -27,6 +27,7 @@ extension ExtensionBottomSheet on GetInterface {
27 RouteSettings? settings, 27 RouteSettings? settings,
28 Duration? enterBottomSheetDuration, 28 Duration? enterBottomSheetDuration,
29 Duration? exitBottomSheetDuration, 29 Duration? exitBottomSheetDuration,
  30 + Curve? curve,
30 }) { 31 }) {
31 return Navigator.of(overlayContext!, rootNavigator: useRootNavigator) 32 return Navigator.of(overlayContext!, rootNavigator: useRootNavigator)
32 .push(GetModalBottomSheetRoute<T>( 33 .push(GetModalBottomSheetRoute<T>(
@@ -52,6 +53,7 @@ extension ExtensionBottomSheet on GetInterface { @@ -52,6 +53,7 @@ extension ExtensionBottomSheet on GetInterface {
52 enterBottomSheetDuration ?? const Duration(milliseconds: 250), 53 enterBottomSheetDuration ?? const Duration(milliseconds: 250),
53 exitBottomSheetDuration: 54 exitBottomSheetDuration:
54 exitBottomSheetDuration ?? const Duration(milliseconds: 200), 55 exitBottomSheetDuration ?? const Duration(milliseconds: 200),
  56 + curve: curve,
55 )); 57 ));
56 } 58 }
57 } 59 }