Merge branch 'master' of github.com:jamesblasco/modal_bottom_sheet
Showing
9 changed files
with
96 additions
and
44 deletions
@@ -49,6 +49,7 @@ Also it supports `WillPopScope` to prevent closing the dialog | @@ -49,6 +49,7 @@ Also it supports `WillPopScope` to prevent closing the dialog | ||
49 | |bool enableDrag = true| The `enableDrag` parameter specifies whether the bottom sheet can be dragged up and down and dismissed by swiping downwards. | | 49 | |bool enableDrag = true| The `enableDrag` parameter specifies whether the bottom sheet can be dragged up and down and dismissed by swiping downwards. | |
50 | |AnimationController secondAnimation| The `secondAnimation` parameter allows you to provide an animation controller that will be used to animate push/pop of the modal route. Using this param is advised against and will be probably removed in future versions | | 50 | |AnimationController secondAnimation| The `secondAnimation` parameter allows you to provide an animation controller that will be used to animate push/pop of the modal route. Using this param is advised against and will be probably removed in future versions | |
51 | |bool bounce = false| The `bounce` parameter specifies if the bottom sheet can go beyond the top boundary while dragging | | 51 | |bool bounce = false| The `bounce` parameter specifies if the bottom sheet can go beyond the top boundary while dragging | |
52 | +|Duration duration = const Duration(milliseconds: 400)| The `duration` of modal opening | | ||
52 | 53 | ||
53 | 54 | ||
54 | #### Material params | 55 | #### Material params |
@@ -81,6 +81,7 @@ Future<T> showAvatarModalBottomSheet<T>({ | @@ -81,6 +81,7 @@ Future<T> showAvatarModalBottomSheet<T>({ | ||
81 | bool useRootNavigator = false, | 81 | bool useRootNavigator = false, |
82 | bool isDismissible = true, | 82 | bool isDismissible = true, |
83 | bool enableDrag = true, | 83 | bool enableDrag = true, |
84 | + Duration duration, | ||
84 | }) async { | 85 | }) async { |
85 | assert(context != null); | 86 | assert(context != null); |
86 | assert(builder != null); | 87 | assert(builder != null); |
@@ -104,6 +105,7 @@ Future<T> showAvatarModalBottomSheet<T>({ | @@ -104,6 +105,7 @@ Future<T> showAvatarModalBottomSheet<T>({ | ||
104 | isDismissible: isDismissible, | 105 | isDismissible: isDismissible, |
105 | modalBarrierColor: barrierColor, | 106 | modalBarrierColor: barrierColor, |
106 | enableDrag: enableDrag, | 107 | enableDrag: enableDrag, |
108 | + duration: duration, | ||
107 | )); | 109 | )); |
108 | return result; | 110 | return result; |
109 | } | 111 | } |
@@ -7,42 +7,42 @@ packages: | @@ -7,42 +7,42 @@ packages: | ||
7 | name: archive | 7 | name: archive |
8 | url: "https://pub.dartlang.org" | 8 | url: "https://pub.dartlang.org" |
9 | source: hosted | 9 | source: hosted |
10 | - version: "2.0.11" | 10 | + version: "2.0.13" |
11 | args: | 11 | args: |
12 | dependency: transitive | 12 | dependency: transitive |
13 | description: | 13 | description: |
14 | name: args | 14 | name: args |
15 | url: "https://pub.dartlang.org" | 15 | url: "https://pub.dartlang.org" |
16 | source: hosted | 16 | source: hosted |
17 | - version: "1.5.2" | 17 | + version: "1.6.0" |
18 | async: | 18 | async: |
19 | dependency: transitive | 19 | dependency: transitive |
20 | description: | 20 | description: |
21 | name: async | 21 | name: async |
22 | url: "https://pub.dartlang.org" | 22 | url: "https://pub.dartlang.org" |
23 | source: hosted | 23 | source: hosted |
24 | - version: "2.4.0" | 24 | + version: "2.4.1" |
25 | boolean_selector: | 25 | boolean_selector: |
26 | dependency: transitive | 26 | dependency: transitive |
27 | description: | 27 | description: |
28 | name: boolean_selector | 28 | name: boolean_selector |
29 | url: "https://pub.dartlang.org" | 29 | url: "https://pub.dartlang.org" |
30 | source: hosted | 30 | source: hosted |
31 | - version: "1.0.5" | 31 | + version: "2.0.0" |
32 | charcode: | 32 | charcode: |
33 | dependency: transitive | 33 | dependency: transitive |
34 | description: | 34 | description: |
35 | name: charcode | 35 | name: charcode |
36 | url: "https://pub.dartlang.org" | 36 | url: "https://pub.dartlang.org" |
37 | source: hosted | 37 | source: hosted |
38 | - version: "1.1.2" | 38 | + version: "1.1.3" |
39 | collection: | 39 | collection: |
40 | dependency: transitive | 40 | dependency: transitive |
41 | description: | 41 | description: |
42 | name: collection | 42 | name: collection |
43 | url: "https://pub.dartlang.org" | 43 | url: "https://pub.dartlang.org" |
44 | source: hosted | 44 | source: hosted |
45 | - version: "1.14.11" | 45 | + version: "1.14.12" |
46 | convert: | 46 | convert: |
47 | dependency: transitive | 47 | dependency: transitive |
48 | description: | 48 | description: |
@@ -56,7 +56,7 @@ packages: | @@ -56,7 +56,7 @@ packages: | ||
56 | name: crypto | 56 | name: crypto |
57 | url: "https://pub.dartlang.org" | 57 | url: "https://pub.dartlang.org" |
58 | source: hosted | 58 | source: hosted |
59 | - version: "2.1.3" | 59 | + version: "2.1.4" |
60 | cupertino_icons: | 60 | cupertino_icons: |
61 | dependency: "direct main" | 61 | dependency: "direct main" |
62 | description: | 62 | description: |
@@ -85,7 +85,7 @@ packages: | @@ -85,7 +85,7 @@ packages: | ||
85 | name: image | 85 | name: image |
86 | url: "https://pub.dartlang.org" | 86 | url: "https://pub.dartlang.org" |
87 | source: hosted | 87 | source: hosted |
88 | - version: "2.1.4" | 88 | + version: "2.1.12" |
89 | matcher: | 89 | matcher: |
90 | dependency: transitive | 90 | dependency: transitive |
91 | description: | 91 | description: |
@@ -106,7 +106,7 @@ packages: | @@ -106,7 +106,7 @@ packages: | ||
106 | path: ".." | 106 | path: ".." |
107 | relative: true | 107 | relative: true |
108 | source: path | 108 | source: path |
109 | - version: "0.1.4" | 109 | + version: "0.1.5" |
110 | path: | 110 | path: |
111 | dependency: transitive | 111 | dependency: transitive |
112 | description: | 112 | description: |
@@ -114,13 +114,6 @@ packages: | @@ -114,13 +114,6 @@ packages: | ||
114 | url: "https://pub.dartlang.org" | 114 | url: "https://pub.dartlang.org" |
115 | source: hosted | 115 | source: hosted |
116 | version: "1.6.4" | 116 | version: "1.6.4" |
117 | - pedantic: | ||
118 | - dependency: transitive | ||
119 | - description: | ||
120 | - name: pedantic | ||
121 | - url: "https://pub.dartlang.org" | ||
122 | - source: hosted | ||
123 | - version: "1.8.0+1" | ||
124 | petitparser: | 117 | petitparser: |
125 | dependency: transitive | 118 | dependency: transitive |
126 | description: | 119 | description: |
@@ -141,7 +134,7 @@ packages: | @@ -141,7 +134,7 @@ packages: | ||
141 | name: quiver | 134 | name: quiver |
142 | url: "https://pub.dartlang.org" | 135 | url: "https://pub.dartlang.org" |
143 | source: hosted | 136 | source: hosted |
144 | - version: "2.0.5" | 137 | + version: "2.1.3" |
145 | sky_engine: | 138 | sky_engine: |
146 | dependency: transitive | 139 | dependency: transitive |
147 | description: flutter | 140 | description: flutter |
@@ -153,7 +146,7 @@ packages: | @@ -153,7 +146,7 @@ packages: | ||
153 | name: source_span | 146 | name: source_span |
154 | url: "https://pub.dartlang.org" | 147 | url: "https://pub.dartlang.org" |
155 | source: hosted | 148 | source: hosted |
156 | - version: "1.5.5" | 149 | + version: "1.7.0" |
157 | stack_trace: | 150 | stack_trace: |
158 | dependency: transitive | 151 | dependency: transitive |
159 | description: | 152 | description: |
@@ -188,7 +181,7 @@ packages: | @@ -188,7 +181,7 @@ packages: | ||
188 | name: test_api | 181 | name: test_api |
189 | url: "https://pub.dartlang.org" | 182 | url: "https://pub.dartlang.org" |
190 | source: hosted | 183 | source: hosted |
191 | - version: "0.2.11" | 184 | + version: "0.2.15" |
192 | typed_data: | 185 | typed_data: |
193 | dependency: transitive | 186 | dependency: transitive |
194 | description: | 187 | description: |
@@ -237,7 +230,7 @@ packages: | @@ -237,7 +230,7 @@ packages: | ||
237 | name: xml | 230 | name: xml |
238 | url: "https://pub.dartlang.org" | 231 | url: "https://pub.dartlang.org" |
239 | source: hosted | 232 | source: hosted |
240 | - version: "3.5.0" | 233 | + version: "3.6.1" |
241 | sdks: | 234 | sdks: |
242 | dart: ">=2.7.0 <3.0.0" | 235 | dart: ">=2.7.0 <3.0.0" |
243 | flutter: ">=1.12.8 <2.0.0" | 236 | flutter: ">=1.12.8 <2.0.0" |
@@ -38,6 +38,7 @@ class ModalBottomSheet extends StatefulWidget { | @@ -38,6 +38,7 @@ class ModalBottomSheet extends StatefulWidget { | ||
38 | const ModalBottomSheet({ | 38 | const ModalBottomSheet({ |
39 | Key key, | 39 | Key key, |
40 | this.animationController, | 40 | this.animationController, |
41 | + this.animationCurve, | ||
41 | this.enableDrag = true, | 42 | this.enableDrag = true, |
42 | this.containerBuilder, | 43 | this.containerBuilder, |
43 | this.bounce = true, | 44 | this.bounce = true, |
@@ -58,6 +59,11 @@ class ModalBottomSheet extends StatefulWidget { | @@ -58,6 +59,11 @@ class ModalBottomSheet extends StatefulWidget { | ||
58 | /// is not just a passive observer. | 59 | /// is not just a passive observer. |
59 | final AnimationController animationController; | 60 | final AnimationController animationController; |
60 | 61 | ||
62 | + /// The curve used by the animation showing and dismissing the bottom sheet. | ||
63 | + /// | ||
64 | + /// If no curve is provided it falls back to `Curves.easeOutSine`. | ||
65 | + final Curve animationCurve; | ||
66 | + | ||
61 | /// Allows the bottom sheet to go beyond the top bound of the content, | 67 | /// Allows the bottom sheet to go beyond the top bound of the content, |
62 | /// but then bounce the content back to the edge of | 68 | /// but then bounce the content back to the edge of |
63 | /// the top bound. | 69 | /// the top bound. |
@@ -102,9 +108,12 @@ class ModalBottomSheet extends StatefulWidget { | @@ -102,9 +108,12 @@ class ModalBottomSheet extends StatefulWidget { | ||
102 | /// This API available as a convenience for a Material compliant bottom sheet | 108 | /// This API available as a convenience for a Material compliant bottom sheet |
103 | /// animation. If alternative animation durations are required, a different | 109 | /// animation. If alternative animation durations are required, a different |
104 | /// animation controller could be provided. | 110 | /// animation controller could be provided. |
105 | - static AnimationController createAnimationController(TickerProvider vsync) { | 111 | + static AnimationController createAnimationController( |
112 | + TickerProvider vsync, { | ||
113 | + Duration duration, | ||
114 | + }) { | ||
106 | return AnimationController( | 115 | return AnimationController( |
107 | - duration: _bottomSheetDuration, | 116 | + duration: duration ?? _bottomSheetDuration, |
108 | debugLabel: 'BottomSheet', | 117 | debugLabel: 'BottomSheet', |
109 | vsync: vsync, | 118 | vsync: vsync, |
110 | ); | 119 | ); |
@@ -276,7 +285,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -276,7 +285,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
276 | Widget build(BuildContext context) { | 285 | Widget build(BuildContext context) { |
277 | final bounceAnimation = CurvedAnimation( | 286 | final bounceAnimation = CurvedAnimation( |
278 | parent: _bounceDragController, | 287 | parent: _bounceDragController, |
279 | - curve: Curves.easeOutSine, | 288 | + curve: widget.animationCurve ?? Curves.easeOutSine, |
280 | ); | 289 | ); |
281 | 290 | ||
282 | var child = widget.builder(context, _scrollController); | 291 | var child = widget.builder(context, _scrollController); |
@@ -17,6 +17,7 @@ class _ModalBottomSheet<T> extends StatefulWidget { | @@ -17,6 +17,7 @@ class _ModalBottomSheet<T> extends StatefulWidget { | ||
17 | this.scrollController, | 17 | this.scrollController, |
18 | this.expanded = false, | 18 | this.expanded = false, |
19 | this.enableDrag = true, | 19 | this.enableDrag = true, |
20 | + this.animationCurve, | ||
20 | }) : assert(expanded != null), | 21 | }) : assert(expanded != null), |
21 | assert(enableDrag != null), | 22 | assert(enableDrag != null), |
22 | super(key: key); | 23 | super(key: key); |
@@ -26,6 +27,7 @@ class _ModalBottomSheet<T> extends StatefulWidget { | @@ -26,6 +27,7 @@ class _ModalBottomSheet<T> extends StatefulWidget { | ||
26 | final bool bounce; | 27 | final bool bounce; |
27 | final bool enableDrag; | 28 | final bool enableDrag; |
28 | final AnimationController secondAnimationController; | 29 | final AnimationController secondAnimationController; |
30 | + final Curve animationCurve; | ||
29 | final ScrollController scrollController; | 31 | final ScrollController scrollController; |
30 | 32 | ||
31 | @override | 33 | @override |
@@ -97,6 +99,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | @@ -97,6 +99,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | ||
97 | builder: widget.route.builder, | 99 | builder: widget.route.builder, |
98 | enableDrag: widget.enableDrag, | 100 | enableDrag: widget.enableDrag, |
99 | bounce: widget.bounce, | 101 | bounce: widget.bounce, |
102 | + animationCurve: widget.animationCurve, | ||
100 | ), | 103 | ), |
101 | ); | 104 | ); |
102 | }, | 105 | }, |
@@ -116,6 +119,8 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -116,6 +119,8 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
116 | this.enableDrag = true, | 119 | this.enableDrag = true, |
117 | @required this.expanded, | 120 | @required this.expanded, |
118 | this.bounce = false, | 121 | this.bounce = false, |
122 | + this.animationCurve, | ||
123 | + this.duration, | ||
119 | RouteSettings settings, | 124 | RouteSettings settings, |
120 | }) : assert(expanded != null), | 125 | }) : assert(expanded != null), |
121 | assert(isDismissible != null), | 126 | assert(isDismissible != null), |
@@ -131,10 +136,13 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -131,10 +136,13 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
131 | final bool enableDrag; | 136 | final bool enableDrag; |
132 | final ScrollController scrollController; | 137 | final ScrollController scrollController; |
133 | 138 | ||
139 | + final Duration duration; | ||
140 | + | ||
134 | final AnimationController secondAnimationController; | 141 | final AnimationController secondAnimationController; |
142 | + final Curve animationCurve; | ||
135 | 143 | ||
136 | @override | 144 | @override |
137 | - Duration get transitionDuration => _bottomSheetDuration; | 145 | + Duration get transitionDuration => duration ?? _bottomSheetDuration; |
138 | 146 | ||
139 | @override | 147 | @override |
140 | bool get barrierDismissible => isDismissible; | 148 | bool get barrierDismissible => isDismissible; |
@@ -150,8 +158,10 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -150,8 +158,10 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
150 | @override | 158 | @override |
151 | AnimationController createAnimationController() { | 159 | AnimationController createAnimationController() { |
152 | assert(_animationController == null); | 160 | assert(_animationController == null); |
153 | - _animationController = | ||
154 | - ModalBottomSheet.createAnimationController(navigator.overlay); | 161 | + _animationController = ModalBottomSheet.createAnimationController( |
162 | + navigator.overlay, | ||
163 | + duration: duration, | ||
164 | + ); | ||
155 | return _animationController; | 165 | return _animationController; |
156 | } | 166 | } |
157 | 167 | ||
@@ -172,6 +182,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -172,6 +182,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
172 | scrollController: scrollController, | 182 | scrollController: scrollController, |
173 | bounce: bounce, | 183 | bounce: bounce, |
174 | enableDrag: enableDrag, | 184 | enableDrag: enableDrag, |
185 | + animationCurve: animationCurve, | ||
175 | ), | 186 | ), |
176 | ); | 187 | ); |
177 | return bottomSheet; | 188 | return bottomSheet; |
@@ -195,8 +206,8 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -195,8 +206,8 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
195 | } | 206 | } |
196 | 207 | ||
197 | /// Shows a modal material design bottom sheet. | 208 | /// Shows a modal material design bottom sheet. |
198 | -Future<T> showCustomModalBottomSheet<T>( | ||
199 | - {@required BuildContext context, | 209 | +Future<T> showCustomModalBottomSheet<T>({ |
210 | + @required BuildContext context, | ||
200 | @required ScrollWidgetBuilder builder, | 211 | @required ScrollWidgetBuilder builder, |
201 | @required WidgetWithChildBuilder containerWidget, | 212 | @required WidgetWithChildBuilder containerWidget, |
202 | Color backgroundColor, | 213 | Color backgroundColor, |
@@ -207,10 +218,13 @@ Future<T> showCustomModalBottomSheet<T>( | @@ -207,10 +218,13 @@ Future<T> showCustomModalBottomSheet<T>( | ||
207 | bool bounce = false, | 218 | bool bounce = false, |
208 | bool expand = false, | 219 | bool expand = false, |
209 | AnimationController secondAnimation, | 220 | AnimationController secondAnimation, |
221 | + Curve animationCurve, | ||
210 | bool useRootNavigator = false, | 222 | bool useRootNavigator = false, |
211 | bool isDismissible = true, | 223 | bool isDismissible = true, |
212 | bool enableDrag = true, | 224 | bool enableDrag = true, |
213 | - ScrollController scrollController}) async { | 225 | + ScrollController scrollController, |
226 | + Duration duration, | ||
227 | +}) async { | ||
214 | assert(context != null); | 228 | assert(context != null); |
215 | assert(builder != null); | 229 | assert(builder != null); |
216 | assert(containerWidget != null); | 230 | assert(containerWidget != null); |
@@ -231,6 +245,8 @@ Future<T> showCustomModalBottomSheet<T>( | @@ -231,6 +245,8 @@ Future<T> showCustomModalBottomSheet<T>( | ||
231 | isDismissible: isDismissible, | 245 | isDismissible: isDismissible, |
232 | modalBarrierColor: barrierColor, | 246 | modalBarrierColor: barrierColor, |
233 | enableDrag: enableDrag, | 247 | enableDrag: enableDrag, |
248 | + animationCurve: animationCurve, | ||
249 | + duration: duration, | ||
234 | )); | 250 | )); |
235 | return result; | 251 | return result; |
236 | } | 252 | } |
1 | +import 'dart:async'; | ||
2 | + | ||
1 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
2 | import 'package:flutter/services.dart'; | 4 | import 'package:flutter/services.dart'; |
3 | -import 'dart:async'; | ||
4 | 5 | ||
5 | import '../../modal_bottom_sheet.dart'; | 6 | import '../../modal_bottom_sheet.dart'; |
6 | import '../bottom_sheet_route.dart'; | 7 | import '../bottom_sheet_route.dart'; |
@@ -9,6 +10,7 @@ class BarBottomSheet extends StatelessWidget { | @@ -9,6 +10,7 @@ class BarBottomSheet extends StatelessWidget { | ||
9 | final Widget child; | 10 | final Widget child; |
10 | 11 | ||
11 | const BarBottomSheet({Key key, this.child}) : super(key: key); | 12 | const BarBottomSheet({Key key, this.child}) : super(key: key); |
13 | + | ||
12 | @override | 14 | @override |
13 | Widget build(BuildContext context) { | 15 | Widget build(BuildContext context) { |
14 | return AnnotatedRegion<SystemUiOverlayStyle>( | 16 | return AnnotatedRegion<SystemUiOverlayStyle>( |
@@ -66,9 +68,11 @@ Future<T> showBarModalBottomSheet<T>({ | @@ -66,9 +68,11 @@ Future<T> showBarModalBottomSheet<T>({ | ||
66 | bool bounce = true, | 68 | bool bounce = true, |
67 | bool expand = false, | 69 | bool expand = false, |
68 | AnimationController secondAnimation, | 70 | AnimationController secondAnimation, |
71 | + Curve animationCurve, | ||
69 | bool useRootNavigator = false, | 72 | bool useRootNavigator = false, |
70 | bool isDismissible = true, | 73 | bool isDismissible = true, |
71 | bool enableDrag = true, | 74 | bool enableDrag = true, |
75 | + Duration duration, | ||
72 | }) async { | 76 | }) async { |
73 | assert(context != null); | 77 | assert(context != null); |
74 | assert(builder != null); | 78 | assert(builder != null); |
@@ -91,6 +95,8 @@ Future<T> showBarModalBottomSheet<T>({ | @@ -91,6 +95,8 @@ Future<T> showBarModalBottomSheet<T>({ | ||
91 | isDismissible: isDismissible, | 95 | isDismissible: isDismissible, |
92 | modalBarrierColor: barrierColor, | 96 | modalBarrierColor: barrierColor, |
93 | enableDrag: enableDrag, | 97 | enableDrag: enableDrag, |
98 | + animationCurve: animationCurve, | ||
99 | + duration: duration, | ||
94 | )); | 100 | )); |
95 | return result; | 101 | return result; |
96 | } | 102 | } |
@@ -75,11 +75,14 @@ Future<T> showCupertinoModalBottomSheet<T>({ | @@ -75,11 +75,14 @@ Future<T> showCupertinoModalBottomSheet<T>({ | ||
75 | Color barrierColor, | 75 | Color barrierColor, |
76 | bool expand = false, | 76 | bool expand = false, |
77 | AnimationController secondAnimation, | 77 | AnimationController secondAnimation, |
78 | + Curve animationCurve, | ||
79 | + Curve previousRouteAnimationCurve, | ||
78 | bool useRootNavigator = false, | 80 | bool useRootNavigator = false, |
79 | bool bounce = true, | 81 | bool bounce = true, |
80 | bool isDismissible, | 82 | bool isDismissible, |
81 | bool enableDrag = true, | 83 | bool enableDrag = true, |
82 | Radius topRadius = _default_top_radius, | 84 | Radius topRadius = _default_top_radius, |
85 | + Duration duration, | ||
83 | }) async { | 86 | }) async { |
84 | assert(context != null); | 87 | assert(context != null); |
85 | assert(builder != null); | 88 | assert(builder != null); |
@@ -113,12 +116,16 @@ Future<T> showCupertinoModalBottomSheet<T>({ | @@ -113,12 +116,16 @@ Future<T> showCupertinoModalBottomSheet<T>({ | ||
113 | modalBarrierColor: barrierColor ?? Colors.black12, | 116 | modalBarrierColor: barrierColor ?? Colors.black12, |
114 | enableDrag: enableDrag, | 117 | enableDrag: enableDrag, |
115 | topRadius: topRadius, | 118 | topRadius: topRadius, |
119 | + animationCurve: animationCurve, | ||
120 | + previousRouteAnimationCurve: previousRouteAnimationCurve, | ||
121 | + duration: duration, | ||
116 | )); | 122 | )); |
117 | return result; | 123 | return result; |
118 | } | 124 | } |
119 | 125 | ||
120 | class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | 126 | class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { |
121 | final Radius topRadius; | 127 | final Radius topRadius; |
128 | + final Curve previousRouteAnimationCurve; | ||
122 | 129 | ||
123 | CupertinoModalBottomSheetRoute({ | 130 | CupertinoModalBottomSheetRoute({ |
124 | ScrollWidgetBuilder builder, | 131 | ScrollWidgetBuilder builder, |
@@ -128,13 +135,16 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -128,13 +135,16 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
128 | ShapeBorder shape, | 135 | ShapeBorder shape, |
129 | Clip clipBehavior, | 136 | Clip clipBehavior, |
130 | AnimationController secondAnimationController, | 137 | AnimationController secondAnimationController, |
138 | + Curve animationCurve, | ||
131 | Color modalBarrierColor, | 139 | Color modalBarrierColor, |
132 | bool bounce = true, | 140 | bool bounce = true, |
133 | bool isDismissible = true, | 141 | bool isDismissible = true, |
134 | bool enableDrag = true, | 142 | bool enableDrag = true, |
135 | @required bool expanded, | 143 | @required bool expanded, |
144 | + Duration duration, | ||
136 | RouteSettings settings, | 145 | RouteSettings settings, |
137 | this.topRadius = _default_top_radius, | 146 | this.topRadius = _default_top_radius, |
147 | + this.previousRouteAnimationCurve, | ||
138 | }) : assert(expanded != null), | 148 | }) : assert(expanded != null), |
139 | assert(isDismissible != null), | 149 | assert(isDismissible != null), |
140 | assert(enableDrag != null), | 150 | assert(enableDrag != null), |
@@ -149,6 +159,8 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -149,6 +159,8 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
149 | enableDrag: enableDrag, | 159 | enableDrag: enableDrag, |
150 | expanded: expanded, | 160 | expanded: expanded, |
151 | settings: settings, | 161 | settings: settings, |
162 | + animationCurve: animationCurve, | ||
163 | + duration: duration, | ||
152 | ); | 164 | ); |
153 | 165 | ||
154 | @override | 166 | @override |
@@ -183,6 +195,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -183,6 +195,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
183 | return _CupertinoModalTransition( | 195 | return _CupertinoModalTransition( |
184 | secondaryAnimation: secondaryAnimation, | 196 | secondaryAnimation: secondaryAnimation, |
185 | body: child, | 197 | body: child, |
198 | + animationCurve: previousRouteAnimationCurve, | ||
186 | topRadius: topRadius, | 199 | topRadius: topRadius, |
187 | ); | 200 | ); |
188 | } | 201 | } |
@@ -191,6 +204,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -191,6 +204,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
191 | class _CupertinoModalTransition extends StatelessWidget { | 204 | class _CupertinoModalTransition extends StatelessWidget { |
192 | final Animation<double> secondaryAnimation; | 205 | final Animation<double> secondaryAnimation; |
193 | final Radius topRadius; | 206 | final Radius topRadius; |
207 | + final Curve animationCurve; | ||
194 | 208 | ||
195 | final Widget body; | 209 | final Widget body; |
196 | 210 | ||
@@ -199,6 +213,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -199,6 +213,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
199 | @required this.secondaryAnimation, | 213 | @required this.secondaryAnimation, |
200 | @required this.body, | 214 | @required this.body, |
201 | @required this.topRadius, | 215 | @required this.topRadius, |
216 | + this.animationCurve, | ||
202 | }) : super(key: key); | 217 | }) : super(key: key); |
203 | 218 | ||
204 | @override | 219 | @override |
@@ -212,7 +227,7 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -212,7 +227,7 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
212 | 227 | ||
213 | final curvedAnimation = CurvedAnimation( | 228 | final curvedAnimation = CurvedAnimation( |
214 | parent: secondaryAnimation, | 229 | parent: secondaryAnimation, |
215 | - curve: Curves.easeOut, | 230 | + curve: animationCurve ?? Curves.easeOut, |
216 | ); | 231 | ); |
217 | 232 | ||
218 | return AnnotatedRegion<SystemUiOverlayStyle>( | 233 | return AnnotatedRegion<SystemUiOverlayStyle>( |
@@ -280,6 +295,8 @@ class CupertinoScaffold extends StatefulWidget { | @@ -280,6 +295,8 @@ class CupertinoScaffold extends StatefulWidget { | ||
280 | static Future<T> showCupertinoModalBottomSheet<T>({ | 295 | static Future<T> showCupertinoModalBottomSheet<T>({ |
281 | @required BuildContext context, | 296 | @required BuildContext context, |
282 | @required ScrollWidgetBuilder builder, | 297 | @required ScrollWidgetBuilder builder, |
298 | + Curve animationCurve, | ||
299 | + Curve previousRouteAnimationCurve, | ||
283 | Color backgroundColor, | 300 | Color backgroundColor, |
284 | Color barrierColor, | 301 | Color barrierColor, |
285 | bool expand = false, | 302 | bool expand = false, |
@@ -288,6 +305,7 @@ class CupertinoScaffold extends StatefulWidget { | @@ -288,6 +305,7 @@ class CupertinoScaffold extends StatefulWidget { | ||
288 | bool isDismissible, | 305 | bool isDismissible, |
289 | bool enableDrag = true, | 306 | bool enableDrag = true, |
290 | Radius topRadius = _default_top_radius, | 307 | Radius topRadius = _default_top_radius, |
308 | + Duration duration, | ||
291 | }) async { | 309 | }) async { |
292 | assert(context != null); | 310 | assert(context != null); |
293 | assert(builder != null); | 311 | assert(builder != null); |
@@ -317,6 +335,9 @@ class CupertinoScaffold extends StatefulWidget { | @@ -317,6 +335,9 @@ class CupertinoScaffold extends StatefulWidget { | ||
317 | modalBarrierColor: barrierColor ?? Colors.black12, | 335 | modalBarrierColor: barrierColor ?? Colors.black12, |
318 | enableDrag: enableDrag, | 336 | enableDrag: enableDrag, |
319 | topRadius: topRadius, | 337 | topRadius: topRadius, |
338 | + animationCurve: animationCurve, | ||
339 | + previousRouteAnimationCurve: previousRouteAnimationCurve, | ||
340 | + duration: duration, | ||
320 | )); | 341 | )); |
321 | return result; | 342 | return result; |
322 | } | 343 | } |
@@ -14,9 +14,11 @@ Future<T> showMaterialModalBottomSheet<T>({ | @@ -14,9 +14,11 @@ Future<T> showMaterialModalBottomSheet<T>({ | ||
14 | bool bounce = false, | 14 | bool bounce = false, |
15 | bool expand = false, | 15 | bool expand = false, |
16 | AnimationController secondAnimation, | 16 | AnimationController secondAnimation, |
17 | + Curve animationCurve, | ||
17 | bool useRootNavigator = false, | 18 | bool useRootNavigator = false, |
18 | bool isDismissible = true, | 19 | bool isDismissible = true, |
19 | bool enableDrag = true, | 20 | bool enableDrag = true, |
21 | + Duration duration, | ||
20 | }) async { | 22 | }) async { |
21 | assert(context != null); | 23 | assert(context != null); |
22 | assert(builder != null); | 24 | assert(builder != null); |
@@ -44,6 +46,8 @@ Future<T> showMaterialModalBottomSheet<T>({ | @@ -44,6 +46,8 @@ Future<T> showMaterialModalBottomSheet<T>({ | ||
44 | isDismissible: isDismissible, | 46 | isDismissible: isDismissible, |
45 | modalBarrierColor: barrierColor, | 47 | modalBarrierColor: barrierColor, |
46 | enableDrag: enableDrag, | 48 | enableDrag: enableDrag, |
49 | + animationCurve: animationCurve, | ||
50 | + duration: duration, | ||
47 | )); | 51 | )); |
48 | return result; | 52 | return result; |
49 | } | 53 | } |
@@ -7,42 +7,42 @@ packages: | @@ -7,42 +7,42 @@ packages: | ||
7 | name: archive | 7 | name: archive |
8 | url: "https://pub.dartlang.org" | 8 | url: "https://pub.dartlang.org" |
9 | source: hosted | 9 | source: hosted |
10 | - version: "2.0.11" | 10 | + version: "2.0.13" |
11 | args: | 11 | args: |
12 | dependency: transitive | 12 | dependency: transitive |
13 | description: | 13 | description: |
14 | name: args | 14 | name: args |
15 | url: "https://pub.dartlang.org" | 15 | url: "https://pub.dartlang.org" |
16 | source: hosted | 16 | source: hosted |
17 | - version: "1.5.2" | 17 | + version: "1.6.0" |
18 | async: | 18 | async: |
19 | dependency: transitive | 19 | dependency: transitive |
20 | description: | 20 | description: |
21 | name: async | 21 | name: async |
22 | url: "https://pub.dartlang.org" | 22 | url: "https://pub.dartlang.org" |
23 | source: hosted | 23 | source: hosted |
24 | - version: "2.4.0" | 24 | + version: "2.4.1" |
25 | boolean_selector: | 25 | boolean_selector: |
26 | dependency: transitive | 26 | dependency: transitive |
27 | description: | 27 | description: |
28 | name: boolean_selector | 28 | name: boolean_selector |
29 | url: "https://pub.dartlang.org" | 29 | url: "https://pub.dartlang.org" |
30 | source: hosted | 30 | source: hosted |
31 | - version: "1.0.5" | 31 | + version: "2.0.0" |
32 | charcode: | 32 | charcode: |
33 | dependency: transitive | 33 | dependency: transitive |
34 | description: | 34 | description: |
35 | name: charcode | 35 | name: charcode |
36 | url: "https://pub.dartlang.org" | 36 | url: "https://pub.dartlang.org" |
37 | source: hosted | 37 | source: hosted |
38 | - version: "1.1.2" | 38 | + version: "1.1.3" |
39 | collection: | 39 | collection: |
40 | dependency: transitive | 40 | dependency: transitive |
41 | description: | 41 | description: |
42 | name: collection | 42 | name: collection |
43 | url: "https://pub.dartlang.org" | 43 | url: "https://pub.dartlang.org" |
44 | source: hosted | 44 | source: hosted |
45 | - version: "1.14.11" | 45 | + version: "1.14.12" |
46 | convert: | 46 | convert: |
47 | dependency: transitive | 47 | dependency: transitive |
48 | description: | 48 | description: |
@@ -56,7 +56,7 @@ packages: | @@ -56,7 +56,7 @@ packages: | ||
56 | name: crypto | 56 | name: crypto |
57 | url: "https://pub.dartlang.org" | 57 | url: "https://pub.dartlang.org" |
58 | source: hosted | 58 | source: hosted |
59 | - version: "2.1.3" | 59 | + version: "2.1.4" |
60 | flutter: | 60 | flutter: |
61 | dependency: "direct main" | 61 | dependency: "direct main" |
62 | description: flutter | 62 | description: flutter |
@@ -73,7 +73,7 @@ packages: | @@ -73,7 +73,7 @@ packages: | ||
73 | name: image | 73 | name: image |
74 | url: "https://pub.dartlang.org" | 74 | url: "https://pub.dartlang.org" |
75 | source: hosted | 75 | source: hosted |
76 | - version: "2.1.4" | 76 | + version: "2.1.12" |
77 | matcher: | 77 | matcher: |
78 | dependency: transitive | 78 | dependency: transitive |
79 | description: | 79 | description: |
@@ -115,7 +115,7 @@ packages: | @@ -115,7 +115,7 @@ packages: | ||
115 | name: quiver | 115 | name: quiver |
116 | url: "https://pub.dartlang.org" | 116 | url: "https://pub.dartlang.org" |
117 | source: hosted | 117 | source: hosted |
118 | - version: "2.0.5" | 118 | + version: "2.1.3" |
119 | sky_engine: | 119 | sky_engine: |
120 | dependency: transitive | 120 | dependency: transitive |
121 | description: flutter | 121 | description: flutter |
@@ -127,7 +127,7 @@ packages: | @@ -127,7 +127,7 @@ packages: | ||
127 | name: source_span | 127 | name: source_span |
128 | url: "https://pub.dartlang.org" | 128 | url: "https://pub.dartlang.org" |
129 | source: hosted | 129 | source: hosted |
130 | - version: "1.5.5" | 130 | + version: "1.7.0" |
131 | stack_trace: | 131 | stack_trace: |
132 | dependency: transitive | 132 | dependency: transitive |
133 | description: | 133 | description: |
@@ -162,7 +162,7 @@ packages: | @@ -162,7 +162,7 @@ packages: | ||
162 | name: test_api | 162 | name: test_api |
163 | url: "https://pub.dartlang.org" | 163 | url: "https://pub.dartlang.org" |
164 | source: hosted | 164 | source: hosted |
165 | - version: "0.2.11" | 165 | + version: "0.2.15" |
166 | typed_data: | 166 | typed_data: |
167 | dependency: transitive | 167 | dependency: transitive |
168 | description: | 168 | description: |
@@ -183,7 +183,7 @@ packages: | @@ -183,7 +183,7 @@ packages: | ||
183 | name: xml | 183 | name: xml |
184 | url: "https://pub.dartlang.org" | 184 | url: "https://pub.dartlang.org" |
185 | source: hosted | 185 | source: hosted |
186 | - version: "3.5.0" | 186 | + version: "3.6.1" |
187 | sdks: | 187 | sdks: |
188 | - dart: ">=2.4.0 <3.0.0" | 188 | + dart: ">=2.6.0 <3.0.0" |
189 | flutter: ">=1.12.0 <2.0.0" | 189 | flutter: ">=1.12.0 <2.0.0" |
-
Please register or login to post a comment