Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

reyhaan
Copy link

@reyhaan reyhaan commented Jul 20, 2024

No description provided.

Copy link

@nivisi nivisi left a 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;
Copy link

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

Comment on lines 70 to +72
/// If no curve is provided it falls back to `decelerateEasing`.
final Curve? animationCurve;
final Curve? secondAnimationCurve;
Copy link

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;
Copy link

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

Comment on lines +376 to 378
final animationValue = (_dismissUnderway && !isDragging ? secondAnimationCurve : animationCurve).transform(
widget.animationController.value,
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final animationValue = (_dismissUnderway && !isDragging ? secondAnimationCurve : animationCurve).transform(
widget.animationController.value,
);
final effectiveCurve = _dismissUnderway && !isDragging
? secondAnimationCurve
: animationCurve;
final animationValue = effectiveCurve.transform(
widget.animationController.value,
);

@nivisi
Copy link

nivisi commented Aug 13, 2024

Hi sir @jamesblasco mind taking a look at this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants