-
Notifications
You must be signed in to change notification settings - Fork 483
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
Add second animation curve option for modal bottom sheet #417
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if it's the best solution, but it looks promising.
@@ -68,6 +69,7 @@ class ModalBottomSheet extends StatefulWidget { | |||
/// | |||
/// If no curve is provided it falls back to `decelerateEasing`. | |||
final Curve? animationCurve; | |||
final Curve? secondAnimationCurve; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend naming it reverseAnimationCurve
/// If no curve is provided it falls back to `decelerateEasing`. | ||
final Curve? animationCurve; | ||
final Curve? secondAnimationCurve; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also provide documentation what it is used for.
@@ -337,10 +340,12 @@ class ModalBottomSheetState extends State<ModalBottomSheet> | |||
} | |||
|
|||
Curve get _defaultCurve => widget.animationCurve ?? _decelerateEasing; | |||
Curve get _defaultSecondCurve => widget.secondAnimationCurve ?? _decelerateEasing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo should return _defaultCurve.flipped
as a fallback
final animationValue = (_dismissUnderway && !isDragging ? secondAnimationCurve : animationCurve).transform( | ||
widget.animationController.value, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final animationValue = (_dismissUnderway && !isDragging ? secondAnimationCurve : animationCurve).transform( | |
widget.animationController.value, | |
); | |
final effectiveCurve = _dismissUnderway && !isDragging | |
? secondAnimationCurve | |
: animationCurve; | |
final animationValue = effectiveCurve.transform( | |
widget.animationController.value, | |
); |
Hi sir @jamesblasco mind taking a look at this PR? |
No description provided.