Showing
6 changed files
with
72 additions
and
24 deletions
1 | +## 1.0.0 - An optimized modal + Breaking change | ||
2 | +- An optimized builder function. | ||
3 | +- The `builder` param has changed from: | ||
4 | +```dart | ||
5 | +showMaterialModalBottomSheet( | ||
6 | + context: context, | ||
7 | + builder: (context, scrollController) { | ||
8 | + return SingleChildScrollView( | ||
9 | + controller: scrollController, | ||
10 | + child: Container() | ||
11 | + ) | ||
12 | + }, | ||
13 | +) | ||
14 | +``` | ||
15 | +to | ||
16 | + | ||
17 | +```dart | ||
18 | +showMaterialModalBottomSheet( | ||
19 | + context: context, | ||
20 | + builder: (context) { | ||
21 | + return SingleChildScrollView( | ||
22 | + controller: ModalScrollController.of(context), | ||
23 | + child: Container() | ||
24 | + ) | ||
25 | + }, | ||
26 | +) | ||
27 | +``` | ||
28 | + | ||
29 | +Now you can access the modal's scrollController from any inside widget like `ModalScrollController.of(context)`. | ||
30 | + | ||
1 | ## [1.0.1-dev] - Fix instance member 'opaque' can't accessed in an initalizer. | 31 | ## [1.0.1-dev] - Fix instance member 'opaque' can't accessed in an initalizer. |
2 | - https://github.com/jamesblasco/modal_bottom_sheet/issues/98 | 32 | - https://github.com/jamesblasco/modal_bottom_sheet/issues/98 |
3 | 33 |
@@ -2,6 +2,10 @@ | @@ -2,6 +2,10 @@ | ||
2 | 2 | ||
3 | # Flutter Modal Bottom Sheet | 3 | # Flutter Modal Bottom Sheet |
4 | 4 | ||
5 | +**BREAKING CHANGE IN 1.0.0** | ||
6 | + | ||
7 | +In the `builder` param remove `scrollController` and use `ModalScrollController.of(context)` instead to access the modal's scrollController. | ||
8 | + | ||
5 | [](https://github.com/Solido/awesome-flutter) | 9 | [](https://github.com/Solido/awesome-flutter) |
6 | [](https://pub.dev/packages/modal_bottom_sheet) | 10 | [](https://pub.dev/packages/modal_bottom_sheet) |
7 | 11 | ||
@@ -36,7 +40,7 @@ https://pub.dev/packages/modal_bottom_sheet#-installing-tab-) | @@ -36,7 +40,7 @@ https://pub.dev/packages/modal_bottom_sheet#-installing-tab-) | ||
36 | ```dart | 40 | ```dart |
37 | showMaterialModalBottomSheet( | 41 | showMaterialModalBottomSheet( |
38 | context: context, | 42 | context: context, |
39 | - builder: (context, scrollController) => Container(), | 43 | + builder: (context) => Container(), |
40 | ) | 44 | ) |
41 | ``` | 45 | ``` |
42 | 46 | ||
@@ -58,6 +62,17 @@ showMaterialModalBottomSheet( | @@ -58,6 +62,17 @@ showMaterialModalBottomSheet( | ||
58 | #### Material params | 62 | #### Material params |
59 | The optional `backgroundColor`, `elevation`, `shape`, and `clipBehavior` parameters can be passed in to customize the appearance and behavior of material bottom sheets. | 63 | The optional `backgroundColor`, `elevation`, `shape`, and `clipBehavior` parameters can be passed in to customize the appearance and behavior of material bottom sheets. |
60 | 64 | ||
65 | +#### Using it with a scroll view inside | ||
66 | +Assign the `ModalScrollController.of(context)` to your primary modal to sync the scroll with the modal's drag | ||
67 | +```dart | ||
68 | +showMaterialModalBottomSheet( | ||
69 | + context: context, | ||
70 | + builder: (context) => SingleChildScrollView( | ||
71 | + controller: ModalScrollController.of(context), | ||
72 | + child: Container(), | ||
73 | + ), | ||
74 | +); | ||
75 | +``` | ||
61 | 76 | ||
62 | ## Cupertino Modal BottomSheet | 77 | ## Cupertino Modal BottomSheet |
63 | 78 | ||
@@ -67,7 +82,7 @@ iOS 13 came with an amazing new modal navigation and now it is available to use | @@ -67,7 +82,7 @@ iOS 13 came with an amazing new modal navigation and now it is available to use | ||
67 | ```dart | 82 | ```dart |
68 | showCupertinoModalBottomSheet( | 83 | showCupertinoModalBottomSheet( |
69 | context: context, | 84 | context: context, |
70 | - builder: (context, scrollController) => Container(), | 85 | + builder: (context) => Container(), |
71 | ) | 86 | ) |
72 | ``` | 87 | ``` |
73 | See generic paramameter in the Material section above | 88 | See generic paramameter in the Material section above |
@@ -99,7 +99,7 @@ packages: | @@ -99,7 +99,7 @@ packages: | ||
99 | path: ".." | 99 | path: ".." |
100 | relative: true | 100 | relative: true |
101 | source: path | 101 | source: path |
102 | - version: "1.1.0-dev" | 102 | + version: "1.0.0" |
103 | path: | 103 | path: |
104 | dependency: transitive | 104 | dependency: transitive |
105 | description: | 105 | description: |
@@ -227,7 +227,8 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -227,7 +227,8 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
227 | 227 | ||
228 | if (_dismissUnderway || !isDragging) return; | 228 | if (_dismissUnderway || !isDragging) return; |
229 | isDragging = false; | 229 | isDragging = false; |
230 | - _bounceDragController.reverse(); | 230 | + // ignore: unawaited_futures |
231 | + _bounceDragController.reverse(); | ||
231 | 232 | ||
232 | var canClose = true; | 233 | var canClose = true; |
233 | if (widget.shouldClose != null && hasReachedWillPopThreshold) { | 234 | if (widget.shouldClose != null && hasReachedWillPopThreshold) { |
@@ -240,6 +241,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -240,6 +241,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
240 | _close(); | 241 | _close(); |
241 | } else if (hasReachedCloseThreshold) { | 242 | } else if (hasReachedCloseThreshold) { |
242 | if (widget.animationController.value > 0.0) { | 243 | if (widget.animationController.value > 0.0) { |
244 | + // ignore: unawaited_futures | ||
243 | widget.animationController.fling(velocity: -1.0); | 245 | widget.animationController.fling(velocity: -1.0); |
244 | } | 246 | } |
245 | _close(); | 247 | _close(); |
@@ -293,6 +295,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -293,6 +295,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
293 | // Otherwise the calculate the velocity with a VelocityTracker | 295 | // Otherwise the calculate the velocity with a VelocityTracker |
294 | if (_velocityTracker == null) { | 296 | if (_velocityTracker == null) { |
295 | //final pointerKind = defaultPointerDeviceKind(context); | 297 | //final pointerKind = defaultPointerDeviceKind(context); |
298 | + // ignore: deprecated_member_use | ||
296 | _velocityTracker = VelocityTracker(); | 299 | _velocityTracker = VelocityTracker(); |
297 | _startTime = DateTime.now(); | 300 | _startTime = DateTime.now(); |
298 | } | 301 | } |
@@ -7,49 +7,49 @@ packages: | @@ -7,49 +7,49 @@ packages: | ||
7 | name: async | 7 | name: async |
8 | url: "https://pub.dartlang.org" | 8 | url: "https://pub.dartlang.org" |
9 | source: hosted | 9 | source: hosted |
10 | - version: "2.5.0-nullsafety" | 10 | + version: "2.5.0-nullsafety.2" |
11 | boolean_selector: | 11 | boolean_selector: |
12 | dependency: transitive | 12 | dependency: transitive |
13 | description: | 13 | description: |
14 | name: boolean_selector | 14 | name: boolean_selector |
15 | url: "https://pub.dartlang.org" | 15 | url: "https://pub.dartlang.org" |
16 | source: hosted | 16 | source: hosted |
17 | - version: "2.1.0-nullsafety" | 17 | + version: "2.1.0-nullsafety.2" |
18 | characters: | 18 | characters: |
19 | dependency: transitive | 19 | dependency: transitive |
20 | description: | 20 | description: |
21 | name: characters | 21 | name: characters |
22 | url: "https://pub.dartlang.org" | 22 | url: "https://pub.dartlang.org" |
23 | source: hosted | 23 | source: hosted |
24 | - version: "1.1.0-nullsafety.2" | 24 | + version: "1.1.0-nullsafety.4" |
25 | charcode: | 25 | charcode: |
26 | dependency: transitive | 26 | dependency: transitive |
27 | description: | 27 | description: |
28 | name: charcode | 28 | name: charcode |
29 | url: "https://pub.dartlang.org" | 29 | url: "https://pub.dartlang.org" |
30 | source: hosted | 30 | source: hosted |
31 | - version: "1.2.0-nullsafety" | 31 | + version: "1.2.0-nullsafety.2" |
32 | clock: | 32 | clock: |
33 | dependency: transitive | 33 | dependency: transitive |
34 | description: | 34 | description: |
35 | name: clock | 35 | name: clock |
36 | url: "https://pub.dartlang.org" | 36 | url: "https://pub.dartlang.org" |
37 | source: hosted | 37 | source: hosted |
38 | - version: "1.1.0-nullsafety" | 38 | + version: "1.1.0-nullsafety.2" |
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.15.0-nullsafety.2" | 45 | + version: "1.15.0-nullsafety.4" |
46 | fake_async: | 46 | fake_async: |
47 | dependency: transitive | 47 | dependency: transitive |
48 | description: | 48 | description: |
49 | name: fake_async | 49 | name: fake_async |
50 | url: "https://pub.dartlang.org" | 50 | url: "https://pub.dartlang.org" |
51 | source: hosted | 51 | source: hosted |
52 | - version: "1.1.0-nullsafety" | 52 | + version: "1.2.0-nullsafety.2" |
53 | flutter: | 53 | flutter: |
54 | dependency: "direct main" | 54 | dependency: "direct main" |
55 | description: flutter | 55 | description: flutter |
@@ -66,21 +66,21 @@ packages: | @@ -66,21 +66,21 @@ packages: | ||
66 | name: matcher | 66 | name: matcher |
67 | url: "https://pub.dartlang.org" | 67 | url: "https://pub.dartlang.org" |
68 | source: hosted | 68 | source: hosted |
69 | - version: "0.12.10-nullsafety" | 69 | + version: "0.12.10-nullsafety.2" |
70 | meta: | 70 | meta: |
71 | dependency: transitive | 71 | dependency: transitive |
72 | description: | 72 | description: |
73 | name: meta | 73 | name: meta |
74 | url: "https://pub.dartlang.org" | 74 | url: "https://pub.dartlang.org" |
75 | source: hosted | 75 | source: hosted |
76 | - version: "1.3.0-nullsafety.2" | 76 | + version: "1.3.0-nullsafety.5" |
77 | path: | 77 | path: |
78 | dependency: transitive | 78 | dependency: transitive |
79 | description: | 79 | description: |
80 | name: path | 80 | name: path |
81 | url: "https://pub.dartlang.org" | 81 | url: "https://pub.dartlang.org" |
82 | source: hosted | 82 | source: hosted |
83 | - version: "1.8.0-nullsafety" | 83 | + version: "1.8.0-nullsafety.2" |
84 | pedantic: | 84 | pedantic: |
85 | dependency: "direct dev" | 85 | dependency: "direct dev" |
86 | description: | 86 | description: |
@@ -99,56 +99,56 @@ packages: | @@ -99,56 +99,56 @@ packages: | ||
99 | name: source_span | 99 | name: source_span |
100 | url: "https://pub.dartlang.org" | 100 | url: "https://pub.dartlang.org" |
101 | source: hosted | 101 | source: hosted |
102 | - version: "1.8.0-nullsafety" | 102 | + version: "1.8.0-nullsafety.3" |
103 | stack_trace: | 103 | stack_trace: |
104 | dependency: transitive | 104 | dependency: transitive |
105 | description: | 105 | description: |
106 | name: stack_trace | 106 | name: stack_trace |
107 | url: "https://pub.dartlang.org" | 107 | url: "https://pub.dartlang.org" |
108 | source: hosted | 108 | source: hosted |
109 | - version: "1.10.0-nullsafety" | 109 | + version: "1.10.0-nullsafety.5" |
110 | stream_channel: | 110 | stream_channel: |
111 | dependency: transitive | 111 | dependency: transitive |
112 | description: | 112 | description: |
113 | name: stream_channel | 113 | name: stream_channel |
114 | url: "https://pub.dartlang.org" | 114 | url: "https://pub.dartlang.org" |
115 | source: hosted | 115 | source: hosted |
116 | - version: "2.1.0-nullsafety" | 116 | + version: "2.1.0-nullsafety.2" |
117 | string_scanner: | 117 | string_scanner: |
118 | dependency: transitive | 118 | dependency: transitive |
119 | description: | 119 | description: |
120 | name: string_scanner | 120 | name: string_scanner |
121 | url: "https://pub.dartlang.org" | 121 | url: "https://pub.dartlang.org" |
122 | source: hosted | 122 | source: hosted |
123 | - version: "1.1.0-nullsafety" | 123 | + version: "1.1.0-nullsafety.2" |
124 | term_glyph: | 124 | term_glyph: |
125 | dependency: transitive | 125 | dependency: transitive |
126 | description: | 126 | description: |
127 | name: term_glyph | 127 | name: term_glyph |
128 | url: "https://pub.dartlang.org" | 128 | url: "https://pub.dartlang.org" |
129 | source: hosted | 129 | source: hosted |
130 | - version: "1.2.0-nullsafety" | 130 | + version: "1.2.0-nullsafety.2" |
131 | test_api: | 131 | test_api: |
132 | dependency: transitive | 132 | dependency: transitive |
133 | description: | 133 | description: |
134 | name: test_api | 134 | name: test_api |
135 | url: "https://pub.dartlang.org" | 135 | url: "https://pub.dartlang.org" |
136 | source: hosted | 136 | source: hosted |
137 | - version: "0.2.19-nullsafety" | 137 | + version: "0.2.19-nullsafety.4" |
138 | typed_data: | 138 | typed_data: |
139 | dependency: transitive | 139 | dependency: transitive |
140 | description: | 140 | description: |
141 | name: typed_data | 141 | name: typed_data |
142 | url: "https://pub.dartlang.org" | 142 | url: "https://pub.dartlang.org" |
143 | source: hosted | 143 | source: hosted |
144 | - version: "1.3.0-nullsafety.2" | 144 | + version: "1.3.0-nullsafety.4" |
145 | vector_math: | 145 | vector_math: |
146 | dependency: transitive | 146 | dependency: transitive |
147 | description: | 147 | description: |
148 | name: vector_math | 148 | name: vector_math |
149 | url: "https://pub.dartlang.org" | 149 | url: "https://pub.dartlang.org" |
150 | source: hosted | 150 | source: hosted |
151 | - version: "2.1.0-nullsafety.2" | 151 | + version: "2.1.0-nullsafety.4" |
152 | sdks: | 152 | sdks: |
153 | - dart: ">=2.10.0-0.0.dev <2.10.0" | 153 | + dart: ">=2.11.0-0.0 <2.12.0" |
154 | flutter: ">=1.12.0 <2.0.0" | 154 | flutter: ">=1.12.0 <2.0.0" |
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: 1.1.0-dev | 3 | +version: 1.0.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