jamesblasco / modal_bottom_sheet

Flutter | Create advanced modal bottom sheets. Material, Cupertino or your own style
https://pub.dev/packages/modal_bottom_sheet
MIT License
1.86k stars 466 forks source link

How to override modal sheet closing animation? #415

Open reyhaan opened 1 month ago

reyhaan commented 1 month ago

I have given it a custom animation curve that is very close to what iOS has natively, but the problem is, by default, when I close the modal sheet, it just runs the animation from 1.0 to 0.0 with same animation curve and its not ideal, I want it close the modal sheet with same animation curve as if it was run from 0.0 to 1.0.

this curve is basically fast -> slow and when it runs in reverse, it behaves like slow -> fast because of the reverse thingy, I would like to have it behave fast -> slow when closing.

showMaterialModalBottomSheet<Object>(
    useRootNavigator: true,
    expand: expand,
    context: context,
    builder: (context) => widget,
    animationCurve: const Cubic(0.1, 1, 0.2, 1),
 );
reyhaan commented 1 month ago

I managed to add another param to override closing animation for bottom sheet, here a draft PR: https://github.com/jamesblasco/modal_bottom_sheet/pull/417