Showing
9 changed files
with
50 additions
and
79 deletions
@@ -12,4 +12,10 @@ | @@ -12,4 +12,10 @@ | ||
12 | ## [0.1.6] - New custom params | 12 | ## [0.1.6] - New custom params |
13 | - Use `duration` to define the opening duration of the modal | 13 | - Use `duration` to define the opening duration of the modal |
14 | - Change the top radius of the cupertino bottom sheet | 14 | - Change the top radius of the cupertino bottom sheet |
15 | -Thanks to @bierbaumtim @troyanskiy @rodineijf for the contributions | ||
15 | +Thanks to @bierbaumtim @troyanskiy @rodineijf for the contributions | ||
16 | + | ||
17 | + | ||
18 | +## [0.2.0] - New Cool Features | ||
19 | +- Added support for scroll-to-top by tapping the status bar on iOS devices. | ||
20 | +- Use `curveAnimation` to define a custom curve animation for the modal transition | ||
21 | +- Bug fixes releated to horizontal scroll, clamping physics and othes. |
@@ -8,7 +8,6 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | @@ -8,7 +8,6 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | ||
8 | class CupertinoSharePage extends StatelessWidget { | 8 | class CupertinoSharePage extends StatelessWidget { |
9 | @override | 9 | @override |
10 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
11 | - | ||
12 | return Scaffold( | 11 | return Scaffold( |
13 | appBar: appBar(context), | 12 | appBar: appBar(context), |
14 | body: CupertinoPageScaffold( | 13 | body: CupertinoPageScaffold( |
@@ -35,7 +35,8 @@ class ModalInsideModal extends StatelessWidget { | @@ -35,7 +35,8 @@ class ModalInsideModal extends StatelessWidget { | ||
35 | backgroundColor: Colors.transparent, | 35 | backgroundColor: Colors.transparent, |
36 | builder: (context, scrollController) => | 36 | builder: (context, scrollController) => |
37 | ModalInsideModal( | 37 | ModalInsideModal( |
38 | - scrollController: scrollController, reverse: reverse), | 38 | + scrollController: scrollController, |
39 | + reverse: reverse), | ||
39 | )), | 40 | )), |
40 | )).toList(), | 41 | )).toList(), |
41 | ), | 42 | ), |
1 | # Generated by pub | 1 | # Generated by pub |
2 | # See https://dart.dev/tools/pub/glossary#lockfile | 2 | # See https://dart.dev/tools/pub/glossary#lockfile |
3 | packages: | 3 | packages: |
4 | - archive: | ||
5 | - dependency: transitive | ||
6 | - description: | ||
7 | - name: archive | ||
8 | - url: "https://pub.dartlang.org" | ||
9 | - source: hosted | ||
10 | - version: "2.0.13" | ||
11 | - args: | ||
12 | - dependency: transitive | ||
13 | - description: | ||
14 | - name: args | ||
15 | - url: "https://pub.dartlang.org" | ||
16 | - source: hosted | ||
17 | - version: "1.6.0" | ||
18 | async: | 4 | async: |
19 | dependency: transitive | 5 | dependency: transitive |
20 | description: | 6 | description: |
@@ -29,34 +15,34 @@ packages: | @@ -29,34 +15,34 @@ packages: | ||
29 | url: "https://pub.dartlang.org" | 15 | url: "https://pub.dartlang.org" |
30 | source: hosted | 16 | source: hosted |
31 | version: "2.0.0" | 17 | version: "2.0.0" |
32 | - charcode: | 18 | + characters: |
33 | dependency: transitive | 19 | dependency: transitive |
34 | description: | 20 | description: |
35 | - name: charcode | 21 | + name: characters |
36 | url: "https://pub.dartlang.org" | 22 | url: "https://pub.dartlang.org" |
37 | source: hosted | 23 | source: hosted |
38 | - version: "1.1.3" | ||
39 | - collection: | 24 | + version: "1.0.0" |
25 | + charcode: | ||
40 | dependency: transitive | 26 | dependency: transitive |
41 | description: | 27 | description: |
42 | - name: collection | 28 | + name: charcode |
43 | url: "https://pub.dartlang.org" | 29 | url: "https://pub.dartlang.org" |
44 | source: hosted | 30 | source: hosted |
45 | - version: "1.14.12" | ||
46 | - convert: | 31 | + version: "1.1.3" |
32 | + clock: | ||
47 | dependency: transitive | 33 | dependency: transitive |
48 | description: | 34 | description: |
49 | - name: convert | 35 | + name: clock |
50 | url: "https://pub.dartlang.org" | 36 | url: "https://pub.dartlang.org" |
51 | source: hosted | 37 | source: hosted |
52 | - version: "2.1.1" | ||
53 | - crypto: | 38 | + version: "1.0.1" |
39 | + collection: | ||
54 | dependency: transitive | 40 | dependency: transitive |
55 | description: | 41 | description: |
56 | - name: crypto | 42 | + name: collection |
57 | url: "https://pub.dartlang.org" | 43 | url: "https://pub.dartlang.org" |
58 | source: hosted | 44 | source: hosted |
59 | - version: "2.1.4" | 45 | + version: "1.14.13" |
60 | cupertino_icons: | 46 | cupertino_icons: |
61 | dependency: "direct main" | 47 | dependency: "direct main" |
62 | description: | 48 | description: |
@@ -64,6 +50,13 @@ packages: | @@ -64,6 +50,13 @@ packages: | ||
64 | url: "https://pub.dartlang.org" | 50 | url: "https://pub.dartlang.org" |
65 | source: hosted | 51 | source: hosted |
66 | version: "0.1.3" | 52 | version: "0.1.3" |
53 | + fake_async: | ||
54 | + dependency: transitive | ||
55 | + description: | ||
56 | + name: fake_async | ||
57 | + url: "https://pub.dartlang.org" | ||
58 | + source: hosted | ||
59 | + version: "1.1.0" | ||
67 | flutter: | 60 | flutter: |
68 | dependency: "direct main" | 61 | dependency: "direct main" |
69 | description: flutter | 62 | description: flutter |
@@ -79,20 +72,13 @@ packages: | @@ -79,20 +72,13 @@ packages: | ||
79 | description: flutter | 72 | description: flutter |
80 | source: sdk | 73 | source: sdk |
81 | version: "0.0.0" | 74 | version: "0.0.0" |
82 | - image: | ||
83 | - dependency: transitive | ||
84 | - description: | ||
85 | - name: image | ||
86 | - url: "https://pub.dartlang.org" | ||
87 | - source: hosted | ||
88 | - version: "2.1.12" | ||
89 | matcher: | 75 | matcher: |
90 | dependency: transitive | 76 | dependency: transitive |
91 | description: | 77 | description: |
92 | name: matcher | 78 | name: matcher |
93 | url: "https://pub.dartlang.org" | 79 | url: "https://pub.dartlang.org" |
94 | source: hosted | 80 | source: hosted |
95 | - version: "0.12.6" | 81 | + version: "0.12.8" |
96 | meta: | 82 | meta: |
97 | dependency: transitive | 83 | dependency: transitive |
98 | description: | 84 | description: |
@@ -106,21 +92,14 @@ packages: | @@ -106,21 +92,14 @@ packages: | ||
106 | path: ".." | 92 | path: ".." |
107 | relative: true | 93 | relative: true |
108 | source: path | 94 | source: path |
109 | - version: "0.1.6" | 95 | + version: "0.2.0" |
110 | path: | 96 | path: |
111 | dependency: transitive | 97 | dependency: transitive |
112 | description: | 98 | description: |
113 | name: path | 99 | name: path |
114 | url: "https://pub.dartlang.org" | 100 | url: "https://pub.dartlang.org" |
115 | source: hosted | 101 | source: hosted |
116 | - version: "1.6.4" | ||
117 | - petitparser: | ||
118 | - dependency: transitive | ||
119 | - description: | ||
120 | - name: petitparser | ||
121 | - url: "https://pub.dartlang.org" | ||
122 | - source: hosted | ||
123 | - version: "2.4.0" | 102 | + version: "1.7.0" |
124 | plugin_platform_interface: | 103 | plugin_platform_interface: |
125 | dependency: transitive | 104 | dependency: transitive |
126 | description: | 105 | description: |
@@ -128,13 +107,6 @@ packages: | @@ -128,13 +107,6 @@ packages: | ||
128 | url: "https://pub.dartlang.org" | 107 | url: "https://pub.dartlang.org" |
129 | source: hosted | 108 | source: hosted |
130 | version: "1.0.2" | 109 | version: "1.0.2" |
131 | - quiver: | ||
132 | - dependency: transitive | ||
133 | - description: | ||
134 | - name: quiver | ||
135 | - url: "https://pub.dartlang.org" | ||
136 | - source: hosted | ||
137 | - version: "2.1.3" | ||
138 | sky_engine: | 110 | sky_engine: |
139 | dependency: transitive | 111 | dependency: transitive |
140 | description: flutter | 112 | description: flutter |
@@ -181,7 +153,7 @@ packages: | @@ -181,7 +153,7 @@ packages: | ||
181 | name: test_api | 153 | name: test_api |
182 | url: "https://pub.dartlang.org" | 154 | url: "https://pub.dartlang.org" |
183 | source: hosted | 155 | source: hosted |
184 | - version: "0.2.15" | 156 | + version: "0.2.17" |
185 | typed_data: | 157 | typed_data: |
186 | dependency: transitive | 158 | dependency: transitive |
187 | description: | 159 | description: |
@@ -224,13 +196,6 @@ packages: | @@ -224,13 +196,6 @@ packages: | ||
224 | url: "https://pub.dartlang.org" | 196 | url: "https://pub.dartlang.org" |
225 | source: hosted | 197 | source: hosted |
226 | version: "2.0.8" | 198 | version: "2.0.8" |
227 | - xml: | ||
228 | - dependency: transitive | ||
229 | - description: | ||
230 | - name: xml | ||
231 | - url: "https://pub.dartlang.org" | ||
232 | - source: hosted | ||
233 | - version: "3.6.1" | ||
234 | sdks: | 199 | sdks: |
235 | - dart: ">=2.7.0 <3.0.0" | 200 | + dart: ">=2.9.0-14.0.dev <3.0.0" |
236 | flutter: ">=1.12.8 <2.0.0" | 201 | flutter: ">=1.12.8 <2.0.0" |
@@ -13,7 +13,6 @@ import 'package:flutter/widgets.dart'; | @@ -13,7 +13,6 @@ import 'package:flutter/widgets.dart'; | ||
13 | import 'package:modal_bottom_sheet/src/utils/primary_scroll_status_bar.dart'; | 13 | import 'package:modal_bottom_sheet/src/utils/primary_scroll_status_bar.dart'; |
14 | 14 | ||
15 | import 'package:modal_bottom_sheet/src/utils/bottom_sheet_suspended_curve.dart'; | 15 | import 'package:modal_bottom_sheet/src/utils/bottom_sheet_suspended_curve.dart'; |
16 | -import 'package:modal_bottom_sheet/src/utils/primary_scroll_status_bar.dart'; | ||
17 | 16 | ||
18 | 17 | ||
19 | const Curve _decelerateEasing = Cubic(0.0, 0.0, 0.2, 1.0); | 18 | const Curve _decelerateEasing = Cubic(0.0, 0.0, 0.2, 1.0); |
@@ -39,6 +39,9 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | @@ -39,6 +39,9 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | ||
39 | final platform = Theme.of(context)?.platform ?? defaultTargetPlatform; | 39 | final platform = Theme.of(context)?.platform ?? defaultTargetPlatform; |
40 | switch (platform) { | 40 | switch (platform) { |
41 | case TargetPlatform.iOS: | 41 | case TargetPlatform.iOS: |
42 | + case TargetPlatform.linux: | ||
43 | + case TargetPlatform.macOS: | ||
44 | + case TargetPlatform.windows: | ||
42 | return ''; | 45 | return ''; |
43 | case TargetPlatform.android: | 46 | case TargetPlatform.android: |
44 | case TargetPlatform.fuchsia: | 47 | case TargetPlatform.fuchsia: |
@@ -187,18 +187,17 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -187,18 +187,17 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
187 | (paddingTop + _behind_widget_visible_height) * 0.9; | 187 | (paddingTop + _behind_widget_visible_height) * 0.9; |
188 | final offsetY = secondaryAnimation.value * (paddingTop - distanceWithScale); | 188 | final offsetY = secondaryAnimation.value * (paddingTop - distanceWithScale); |
189 | final scale = 1 - secondaryAnimation.value / 10; | 189 | final scale = 1 - secondaryAnimation.value / 10; |
190 | - return AnimatedBuilder( | ||
191 | - builder: (context, child) => Transform.translate( | ||
192 | - offset: Offset(0, offsetY), | ||
193 | - child: Transform.scale( | ||
194 | - scale: scale, | ||
195 | - child: child, | ||
196 | - alignment: Alignment.topCenter, | ||
197 | - ), | 190 | + return AnimatedBuilder( |
191 | + builder: (context, child) => Transform.translate( | ||
192 | + offset: Offset(0, offsetY), | ||
193 | + child: Transform.scale( | ||
194 | + scale: scale, | ||
195 | + child: child, | ||
196 | + alignment: Alignment.topCenter, | ||
198 | ), | 197 | ), |
199 | - child: child, | ||
200 | - animation: secondaryAnimation, | ||
201 | - | 198 | + ), |
199 | + child: child, | ||
200 | + animation: secondaryAnimation, | ||
202 | ); | 201 | ); |
203 | } | 202 | } |
204 | 203 | ||
@@ -279,7 +278,6 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -279,7 +278,6 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
279 | } | 278 | } |
280 | } | 279 | } |
281 | 280 | ||
282 | - | ||
283 | class _CupertinoScaffold extends InheritedWidget { | 281 | class _CupertinoScaffold extends InheritedWidget { |
284 | final AnimationController animation; | 282 | final AnimationController animation; |
285 | 283 | ||
@@ -339,7 +337,7 @@ class CupertinoScaffold extends StatefulWidget { | @@ -339,7 +337,7 @@ class CupertinoScaffold extends StatefulWidget { | ||
339 | assert(enableDrag != null); | 337 | assert(enableDrag != null); |
340 | assert(debugCheckHasMediaQuery(context)); | 338 | assert(debugCheckHasMediaQuery(context)); |
341 | final isCupertinoApp = Theme.of(context, shadowThemeOnly: true) == null; | 339 | final isCupertinoApp = Theme.of(context, shadowThemeOnly: true) == null; |
342 | - String barrierLabel = ''; | 340 | + var barrierLabel = ''; |
343 | if (!isCupertinoApp) { | 341 | if (!isCupertinoApp) { |
344 | assert(debugCheckHasMaterialLocalizations(context)); | 342 | assert(debugCheckHasMaterialLocalizations(context)); |
345 | barrierLabel = MaterialLocalizations.of(context).modalBarrierDismissLabel; | 343 | barrierLabel = MaterialLocalizations.of(context).modalBarrierDismissLabel; |
@@ -54,8 +54,8 @@ class BottomSheetSuspendedCurve extends ParametricCurve<double> { | @@ -54,8 +54,8 @@ class BottomSheetSuspendedCurve extends ParametricCurve<double> { | ||
54 | return t; | 54 | return t; |
55 | } | 55 | } |
56 | 56 | ||
57 | - final double curveProgress = (t - startingPoint) / (1 - startingPoint); | ||
58 | - final double transformed = curve.transform(curveProgress); | 57 | + final curveProgress = (t - startingPoint) / (1 - startingPoint); |
58 | + final transformed = curve.transform(curveProgress); | ||
59 | return lerpDouble(startingPoint, 1, transformed); | 59 | return lerpDouble(startingPoint, 1, transformed); |
60 | } | 60 | } |
61 | 61 |
1 | name: modal_bottom_sheet | 1 | name: modal_bottom_sheet |
2 | description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino iOS 13 or create your own style' | 2 | description: 'Create awesome and powerful modal bottom sheets. Material, Cupertino iOS 13 or create your own style' |
3 | -version: 0.1.6 | 3 | +version: 0.2.0 |
4 | homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' | 4 | homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment