Jaime Blasco

Allow to use custom curves for animating the dialog

@@ -179,6 +179,7 @@ class _MyHomePageState extends State<MyHomePage> { @@ -179,6 +179,7 @@ class _MyHomePageState extends State<MyHomePage> {
179 expand: true, 179 expand: true,
180 context: context, 180 context: context,
181 backgroundColor: Colors.transparent, 181 backgroundColor: Colors.transparent,
  182 + animationCurve: Curves.easeInExpo,
182 builder: (context, scrollController) => 183 builder: (context, scrollController) =>
183 ModalInsideModal( 184 ModalInsideModal(
184 scrollController: scrollController), 185 scrollController: scrollController),
@@ -282,7 +282,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> @@ -282,7 +282,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
282 Widget build(BuildContext context) { 282 Widget build(BuildContext context) {
283 final bounceAnimation = CurvedAnimation( 283 final bounceAnimation = CurvedAnimation(
284 parent: _bounceDragController, 284 parent: _bounceDragController,
285 - curve: widget.animationCurve ?? Curves.easeOutSine, 285 + curve: Curves.easeOutSine,
286 ); 286 );
287 287
288 var child = widget.builder(context, _scrollController); 288 var child = widget.builder(context, _scrollController);
@@ -296,17 +296,17 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> @@ -296,17 +296,17 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
296 } 296 }
297 297
298 // Todo: Add curved Animation when push and pop without gesture 298 // Todo: Add curved Animation when push and pop without gesture
299 - /* final Animation<double> containerAnimation = CurvedAnimation( 299 + final Animation<double> containerAnimation = CurvedAnimation(
300 parent: widget.animationController, 300 parent: widget.animationController,
301 - curve: Curves.easeOut,  
302 - );*/ 301 + curve: widget.animationCurve ?? Curves.linear,
  302 + );
303 303
304 return AnimatedBuilder( 304 return AnimatedBuilder(
305 animation: widget.animationController, 305 animation: widget.animationController,
306 builder: (context, _) => ClipRect( 306 builder: (context, _) => ClipRect(
307 child: CustomSingleChildLayout( 307 child: CustomSingleChildLayout(
308 delegate: _ModalBottomSheetLayout( 308 delegate: _ModalBottomSheetLayout(
309 - widget.animationController.value, widget.expanded), 309 + containerAnimation.value, widget.expanded),
310 child: !widget.enableDrag 310 child: !widget.enableDrag
311 ? child 311 ? child
312 : KeyedSubtree( 312 : KeyedSubtree(