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> {
RouteSettings? settings,
this.enterBottomSheetDuration = const Duration(milliseconds: 250),
this.exitBottomSheetDuration = const Duration(milliseconds: 200),
this.curve,
}) : super(settings: settings) {
RouterReportManager.instance.reportCurrentRoute(this);
}
... ... @@ -38,6 +39,7 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
// final String name;
final Duration enterBottomSheetDuration;
final Duration exitBottomSheetDuration;
final Curve? curve;
// remove safearea from top
final bool removeTop;
... ... @@ -62,6 +64,15 @@ class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
}
@override
Animation<double> createAnimation() {
if (curve != null) {
return CurvedAnimation(
curve: curve!, parent: _animationController!.view);
}
return _animationController!.view;
}
@override
AnimationController createAnimationController() {
assert(_animationController == null);
_animationController =
... ...
... ... @@ -27,6 +27,7 @@ extension ExtensionBottomSheet on GetInterface {
RouteSettings? settings,
Duration? enterBottomSheetDuration,
Duration? exitBottomSheetDuration,
Curve? curve,
}) {
return Navigator.of(overlayContext!, rootNavigator: useRootNavigator)
.push(GetModalBottomSheetRoute<T>(
... ... @@ -52,6 +53,7 @@ extension ExtensionBottomSheet on GetInterface {
enterBottomSheetDuration ?? const Duration(milliseconds: 250),
exitBottomSheetDuration:
exitBottomSheetDuration ?? const Duration(milliseconds: 200),
curve: curve,
));
}
}
... ...