Showing
21 changed files
with
333 additions
and
384 deletions
1 | -<img src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/preview.png"> | 1 | +<img src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/preview.png?raw=true"> |
2 | 2 | ||
3 | # Flutter Modal Bottom Sheet | 3 | # Flutter Modal Bottom Sheet |
4 | 4 | ||
5 | -Create awesome and powerful modal bottom sheets | 5 | +Create awesome and powerful modal bottom sheets |
6 | + | ||
7 | +| Cupertino Modal | Multiple Modals | Material Modal | Bar Modal | Create your own | | ||
8 | +|---|---|---|---|---| | ||
9 | +|<img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/cupertino_shared_view.gif?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/modal_inside_modal.gif?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/material_fit.png?raw=true">|<img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/bar_modal.png?raw=true">| <img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/avatar_modal.png?raw=true">| | ||
6 | 10 | ||
7 | -<img align="left" height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/cupertino_shared_view.gif"> | ||
8 | -<img align="left" height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/modal_inside_modal.gif"> | ||
9 | -<img align="left" height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/material_fit.png"> | ||
10 | -<img align="left"height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/bar_modal.png"> | ||
11 | -<img height="300" src="https://github.com/jamesblasco/modal_bottom_sheet/blob/master/screenshots/avatar_modal.png"> | ||
12 | 11 | ||
13 | 12 | ||
14 | ## Material Modal BottomSheet | 13 | ## Material Modal BottomSheet |
@@ -31,40 +31,45 @@ class MyApp extends StatelessWidget { | @@ -31,40 +31,45 @@ class MyApp extends StatelessWidget { | ||
31 | return MaterialPageRoute( | 31 | return MaterialPageRoute( |
32 | builder: (context) => Scaffold( | 32 | builder: (context) => Scaffold( |
33 | body: CupertinoScaffold( | 33 | body: CupertinoScaffold( |
34 | - body: Builder( | ||
35 | - builder: (context) => CupertinoPageScaffold( | ||
36 | - backgroundColor: Colors.white, | ||
37 | - navigationBar: CupertinoNavigationBar( | ||
38 | - middle: Text('Normal Navigation Presentation'), | ||
39 | - trailing: GestureDetector( | ||
40 | - child: Icon(Icons.arrow_upward), | ||
41 | - onTap: () => CupertinoScaffold.showCupertinoModalBottomSheet( | ||
42 | - expand: true, | ||
43 | - context: context, | ||
44 | - backgroundColor: Colors.transparent, | ||
45 | - builder: (context, scrollController) => Stack( | ||
46 | - children: <Widget>[ | ||
47 | - ModalWithScroll( | ||
48 | - scrollController: scrollController), | ||
49 | - Positioned( | ||
50 | - height: 40, | ||
51 | - left: 40, | ||
52 | - right: 40, | ||
53 | - bottom: 20, | ||
54 | - child: MaterialButton( | ||
55 | - onPressed: () => Navigator.of(context) | ||
56 | - .popUntil((route) => | ||
57 | - route.settings.name == '/'), | ||
58 | - child: Text('Pop back home'), | ||
59 | - ), | ||
60 | - ) | ||
61 | - ], | ||
62 | - ), | ||
63 | - )), | 34 | + body: Builder( |
35 | + builder: (context) => CupertinoPageScaffold( | ||
36 | + backgroundColor: Colors.white, | ||
37 | + navigationBar: CupertinoNavigationBar( | ||
38 | + middle: Text('Normal Navigation Presentation'), | ||
39 | + trailing: GestureDetector( | ||
40 | + child: Icon(Icons.arrow_upward), | ||
41 | + onTap: () => CupertinoScaffold | ||
42 | + .showCupertinoModalBottomSheet( | ||
43 | + expand: true, | ||
44 | + context: context, | ||
45 | + backgroundColor: Colors.transparent, | ||
46 | + builder: (context, scrollController) => | ||
47 | + Stack( | ||
48 | + children: <Widget>[ | ||
49 | + ModalWithScroll( | ||
50 | + scrollController: scrollController), | ||
51 | + Positioned( | ||
52 | + height: 40, | ||
53 | + left: 40, | ||
54 | + right: 40, | ||
55 | + bottom: 20, | ||
56 | + child: MaterialButton( | ||
57 | + onPressed: () => Navigator.of( | ||
58 | + context) | ||
59 | + .popUntil((route) => | ||
60 | + route.settings.name == '/'), | ||
61 | + child: Text('Pop back home'), | ||
62 | + ), | ||
63 | + ) | ||
64 | + ], | ||
65 | + ), | ||
66 | + )), | ||
67 | + ), | ||
68 | + child: Center(child: Container()), | ||
69 | + ), | ||
64 | ), | 70 | ), |
65 | - child: Center(child: Container()), | ||
66 | ), | 71 | ), |
67 | - ),),), | 72 | + ), |
68 | settings: settings); | 73 | settings: settings); |
69 | }, | 74 | }, |
70 | debugShowCheckedModeBanner: false, | 75 | debugShowCheckedModeBanner: false, |
@@ -87,114 +92,108 @@ class _MyHomePageState extends State<MyHomePage> { | @@ -87,114 +92,108 @@ class _MyHomePageState extends State<MyHomePage> { | ||
87 | print(MediaQuery.of(context).size.height); | 92 | print(MediaQuery.of(context).size.height); |
88 | return Material( | 93 | return Material( |
89 | child: CupertinoPageScaffold( | 94 | child: CupertinoPageScaffold( |
90 | - backgroundColor: Colors.white, | ||
91 | - navigationBar: CupertinoNavigationBar( | ||
92 | - middle: Text('iOS13 Modal Presentation'), | ||
93 | - trailing: GestureDetector( | ||
94 | - child: Icon(Icons.arrow_forward), | ||
95 | - onTap: () => Navigator.of(context).pushNamed('ss'), | ||
96 | - ), | ||
97 | - ), | ||
98 | - child: SizedBox.expand( | ||
99 | - child: SingleChildScrollView( | ||
100 | - child: SafeArea( | ||
101 | - bottom: false, | ||
102 | - child: Column( | ||
103 | - mainAxisSize: MainAxisSize.min, | ||
104 | - children: <Widget>[ | ||
105 | - ListTile( | ||
106 | - title: Text('Cupertino Photo Share Example'), | ||
107 | - onTap: () => Navigator.of(context).push( | ||
108 | - MaterialWithModalsPageRoute( | ||
109 | - builder: (context) => CupertinoSharePage()))), | ||
110 | - ListTile( | ||
111 | - title: Text('Material fit'), | ||
112 | - onTap: () => showMaterialModalBottomSheet( | ||
113 | - expand: false, | ||
114 | - context: context, | ||
115 | - backgroundColor: Colors.transparent, | ||
116 | - builder: (context, scrollController) => | ||
117 | - ModalFit( | ||
118 | - scrollController: scrollController), | ||
119 | - )), | ||
120 | - ListTile( | ||
121 | - title: Text('Bar Modal'), | ||
122 | - onTap: () => showBarModalBottomSheet( | ||
123 | - expand: true, | ||
124 | - context: context, | ||
125 | - backgroundColor: Colors.transparent, | ||
126 | - builder: (context, scrollController) => | ||
127 | - ModalInsideModal( | ||
128 | - scrollController: scrollController), | ||
129 | - )), | ||
130 | - ListTile( | ||
131 | - title: Text('Avatar Modal'), | ||
132 | - onTap: () => showAvatarModalBottomSheet( | ||
133 | - expand: true, | ||
134 | - context: context, | ||
135 | - backgroundColor: Colors.transparent, | ||
136 | - builder: (context, scrollController) => | ||
137 | - ModalInsideModal( | ||
138 | - scrollController: scrollController), | ||
139 | - )), | ||
140 | - ListTile( | ||
141 | - title: Text('Cupertino Modal fit'), | ||
142 | - onTap: () => showCupertinoModalBottomSheet( | ||
143 | - expand: false, | ||
144 | - context: context, | ||
145 | - backgroundColor: Colors.transparent, | ||
146 | - builder: (context, scrollController) => | ||
147 | - ModalFit( | ||
148 | - scrollController: scrollController), | ||
149 | - )), | ||
150 | - ListTile( | ||
151 | - title: Text('Cupertino Small Modal forzed to expand'), | ||
152 | - onTap: () => showCupertinoModalBottomSheet( | ||
153 | - expand: true, | ||
154 | - context: context, | ||
155 | - backgroundColor: Colors.transparent, | ||
156 | - builder: (context, scrollController) => | ||
157 | - ModalFit( | ||
158 | - scrollController: scrollController), | ||
159 | - )), | ||
160 | - ListTile( | ||
161 | - title: Text('Cupertino Modal inside modal'), | ||
162 | - onTap: () => | ||
163 | - showCupertinoModalBottomSheet( | ||
164 | - expand: true, | ||
165 | - context: context, | ||
166 | - backgroundColor: Colors.transparent, | ||
167 | - builder: (context, scrollController) => | ||
168 | - ModalInsideModal( | ||
169 | - scrollController: scrollController), | ||
170 | - )), | ||
171 | - ListTile( | ||
172 | - title: | ||
173 | - Text('Cupertino Navigator + Scroll + WillScope'), | ||
174 | - onTap: () => showCupertinoModalBottomSheet( | ||
175 | - expand: true, | ||
176 | - context: context, | ||
177 | - backgroundColor: Colors.transparent, | ||
178 | - builder: (context, scrollController) => | ||
179 | - ComplexModal( | ||
180 | - scrollController: scrollController), | ||
181 | - )), | ||
182 | - ListTile( | ||
183 | - title: Text('Cupertino Modal with WillScope'), | ||
184 | - onTap: () => showCupertinoModalBottomSheet( | ||
185 | - expand: true, | ||
186 | - context: context, | ||
187 | - backgroundColor: Colors.transparent, | ||
188 | - builder: (context, scrollController) => | ||
189 | - ModalWillScope( | ||
190 | - scrollController: scrollController), | ||
191 | - )), | ||
192 | - ], | ||
193 | - ), | ||
194 | - ), | 95 | + backgroundColor: Colors.white, |
96 | + navigationBar: CupertinoNavigationBar( | ||
97 | + middle: Text('iOS13 Modal Presentation'), | ||
98 | + trailing: GestureDetector( | ||
99 | + child: Icon(Icons.arrow_forward), | ||
100 | + onTap: () => Navigator.of(context).pushNamed('ss'), | ||
101 | + ), | ||
102 | + ), | ||
103 | + child: SizedBox.expand( | ||
104 | + child: SingleChildScrollView( | ||
105 | + child: SafeArea( | ||
106 | + bottom: false, | ||
107 | + child: Column( | ||
108 | + mainAxisSize: MainAxisSize.min, | ||
109 | + children: <Widget>[ | ||
110 | + ListTile( | ||
111 | + title: Text('Cupertino Photo Share Example'), | ||
112 | + onTap: () => Navigator.of(context).push( | ||
113 | + MaterialWithModalsPageRoute( | ||
114 | + builder: (context) => CupertinoSharePage()))), | ||
115 | + ListTile( | ||
116 | + title: Text('Material fit'), | ||
117 | + onTap: () => showMaterialModalBottomSheet( | ||
118 | + expand: false, | ||
119 | + context: context, | ||
120 | + backgroundColor: Colors.transparent, | ||
121 | + builder: (context, scrollController) => | ||
122 | + ModalFit(scrollController: scrollController), | ||
123 | + )), | ||
124 | + ListTile( | ||
125 | + title: Text('Bar Modal'), | ||
126 | + onTap: () => showBarModalBottomSheet( | ||
127 | + expand: true, | ||
128 | + context: context, | ||
129 | + backgroundColor: Colors.transparent, | ||
130 | + builder: (context, scrollController) => | ||
131 | + ModalInsideModal( | ||
132 | + scrollController: scrollController), | ||
133 | + )), | ||
134 | + ListTile( | ||
135 | + title: Text('Avatar Modal'), | ||
136 | + onTap: () => showAvatarModalBottomSheet( | ||
137 | + expand: true, | ||
138 | + context: context, | ||
139 | + backgroundColor: Colors.transparent, | ||
140 | + builder: (context, scrollController) => | ||
141 | + ModalInsideModal( | ||
142 | + scrollController: scrollController), | ||
143 | + )), | ||
144 | + ListTile( | ||
145 | + title: Text('Cupertino Modal fit'), | ||
146 | + onTap: () => showCupertinoModalBottomSheet( | ||
147 | + expand: false, | ||
148 | + context: context, | ||
149 | + backgroundColor: Colors.transparent, | ||
150 | + builder: (context, scrollController) => | ||
151 | + ModalFit(scrollController: scrollController), | ||
152 | + )), | ||
153 | + ListTile( | ||
154 | + title: Text('Cupertino Small Modal forzed to expand'), | ||
155 | + onTap: () => showCupertinoModalBottomSheet( | ||
156 | + expand: true, | ||
157 | + context: context, | ||
158 | + backgroundColor: Colors.transparent, | ||
159 | + builder: (context, scrollController) => | ||
160 | + ModalFit(scrollController: scrollController), | ||
161 | + )), | ||
162 | + ListTile( | ||
163 | + title: Text('Cupertino Modal inside modal'), | ||
164 | + onTap: () => showCupertinoModalBottomSheet( | ||
165 | + expand: true, | ||
166 | + context: context, | ||
167 | + backgroundColor: Colors.transparent, | ||
168 | + builder: (context, scrollController) => | ||
169 | + ModalInsideModal( | ||
170 | + scrollController: scrollController), | ||
171 | + )), | ||
172 | + ListTile( | ||
173 | + title: Text('Cupertino Navigator + Scroll + WillScope'), | ||
174 | + onTap: () => showCupertinoModalBottomSheet( | ||
175 | + expand: true, | ||
176 | + context: context, | ||
177 | + backgroundColor: Colors.transparent, | ||
178 | + builder: (context, scrollController) => | ||
179 | + ComplexModal( | ||
180 | + scrollController: scrollController), | ||
181 | + )), | ||
182 | + ListTile( | ||
183 | + title: Text('Cupertino Modal with WillScope'), | ||
184 | + onTap: () => showCupertinoModalBottomSheet( | ||
185 | + expand: true, | ||
186 | + context: context, | ||
187 | + backgroundColor: Colors.transparent, | ||
188 | + builder: (context, scrollController) => | ||
189 | + ModalWillScope( | ||
190 | + scrollController: scrollController), | ||
191 | + )), | ||
192 | + ], | ||
195 | ), | 193 | ), |
196 | ), | 194 | ), |
197 | - | 195 | + ), |
196 | + ), | ||
198 | ), | 197 | ), |
199 | ); | 198 | ); |
200 | } | 199 | } |
@@ -26,9 +26,10 @@ class AvatarBottomSheet extends StatelessWidget { | @@ -26,9 +26,10 @@ class AvatarBottomSheet extends StatelessWidget { | ||
26 | child: AnimatedBuilder( | 26 | child: AnimatedBuilder( |
27 | animation: animation, | 27 | animation: animation, |
28 | builder: (context, child) => Transform.translate( | 28 | builder: (context, child) => Transform.translate( |
29 | - offset: Offset(0, (1 - animation.value) * 100), | 29 | + offset: Offset(0, (1 - animation.value) * 100), |
30 | child: Opacity( | 30 | child: Opacity( |
31 | - child: child, opacity: max(0, animation.value * 2 - 1))), | 31 | + child: child, |
32 | + opacity: max(0, animation.value * 2 - 1))), | ||
32 | child: Row( | 33 | child: Row( |
33 | children: <Widget>[ | 34 | children: <Widget>[ |
34 | SizedBox(width: 20), | 35 | SizedBox(width: 20), |
@@ -10,7 +10,7 @@ class ModalFit extends StatelessWidget { | @@ -10,7 +10,7 @@ class ModalFit extends StatelessWidget { | ||
10 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
11 | return Material( | 11 | return Material( |
12 | child: SafeArea( | 12 | child: SafeArea( |
13 | - top: false, | 13 | + top: false, |
14 | child: Column( | 14 | child: Column( |
15 | mainAxisSize: MainAxisSize.min, | 15 | mainAxisSize: MainAxisSize.min, |
16 | children: <Widget>[ | 16 | children: <Widget>[ |
1 | - | ||
2 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
3 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
4 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 3 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
@@ -12,7 +11,8 @@ class ModalInsideModal extends StatelessWidget { | @@ -12,7 +11,8 @@ class ModalInsideModal extends StatelessWidget { | ||
12 | 11 | ||
13 | @override | 12 | @override |
14 | Widget build(BuildContext context) { | 13 | Widget build(BuildContext context) { |
15 | - return Material(child:CupertinoPageScaffold( | 14 | + return Material( |
15 | + child: CupertinoPageScaffold( | ||
16 | navigationBar: CupertinoNavigationBar( | 16 | navigationBar: CupertinoNavigationBar( |
17 | leading: Container(), middle: Text('Modal Page')), | 17 | leading: Container(), middle: Text('Modal Page')), |
18 | child: SafeArea( | 18 | child: SafeArea( |
@@ -22,25 +22,23 @@ class ModalInsideModal extends StatelessWidget { | @@ -22,25 +22,23 @@ class ModalInsideModal extends StatelessWidget { | ||
22 | controller: scrollController, | 22 | controller: scrollController, |
23 | physics: BouncingScrollPhysics(), | 23 | physics: BouncingScrollPhysics(), |
24 | children: ListTile.divideTiles( | 24 | children: ListTile.divideTiles( |
25 | - context: context, | ||
26 | - tiles: List.generate( | 25 | + context: context, |
26 | + tiles: List.generate( | ||
27 | 100, | 27 | 100, |
28 | - (index) => ListTile( | ||
29 | - title: Text('Item'), | ||
30 | - onTap: () => showCupertinoModalBottomSheet( | ||
31 | - expand: true, | ||
32 | - isDismissible: false, | ||
33 | - context: context, | ||
34 | - backgroundColor: Colors.transparent, | ||
35 | - builder: (context, scrollController) => | ||
36 | - ModalInsideModal(scrollController: scrollController), | ||
37 | - )), | ||
38 | - | ||
39 | - ) | ||
40 | - ).toList(), | 28 | + (index) => ListTile( |
29 | + title: Text('Item'), | ||
30 | + onTap: () => showCupertinoModalBottomSheet( | ||
31 | + expand: true, | ||
32 | + isDismissible: false, | ||
33 | + context: context, | ||
34 | + backgroundColor: Colors.transparent, | ||
35 | + builder: (context, scrollController) => | ||
36 | + ModalInsideModal( | ||
37 | + scrollController: scrollController), | ||
38 | + )), | ||
39 | + )).toList(), | ||
41 | ), | 40 | ), |
42 | ), | 41 | ), |
43 | )); | 42 | )); |
44 | } | 43 | } |
45 | } | 44 | } |
46 | - |
1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
3 | + | ||
3 | class SimpleModal extends StatelessWidget { | 4 | class SimpleModal extends StatelessWidget { |
4 | final ScrollController scrollController; | 5 | final ScrollController scrollController; |
5 | 6 | ||
@@ -7,7 +8,8 @@ class SimpleModal extends StatelessWidget { | @@ -7,7 +8,8 @@ class SimpleModal extends StatelessWidget { | ||
7 | 8 | ||
8 | @override | 9 | @override |
9 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
10 | - return Material(child:CupertinoPageScaffold( | 11 | + return Material( |
12 | + child: CupertinoPageScaffold( | ||
11 | navigationBar: CupertinoNavigationBar( | 13 | navigationBar: CupertinoNavigationBar( |
12 | leading: Container(), middle: Text('Modal Page')), | 14 | leading: Container(), middle: Text('Modal Page')), |
13 | child: Center(), | 15 | child: Center(), |
@@ -8,7 +8,8 @@ class ModalWillScope extends StatelessWidget { | @@ -8,7 +8,8 @@ class ModalWillScope extends StatelessWidget { | ||
8 | 8 | ||
9 | @override | 9 | @override |
10 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
11 | - return Material(child: WillPopScope( | 11 | + return Material( |
12 | + child: WillPopScope( | ||
12 | onWillPop: () async { | 13 | onWillPop: () async { |
13 | bool shouldClose = true; | 14 | bool shouldClose = true; |
14 | await showCupertinoDialog( | 15 | await showCupertinoDialog( |
1 | - | ||
2 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
3 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
4 | 3 | ||
@@ -9,48 +8,42 @@ class ModalWithNavigator extends StatelessWidget { | @@ -9,48 +8,42 @@ class ModalWithNavigator extends StatelessWidget { | ||
9 | 8 | ||
10 | @override | 9 | @override |
11 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
12 | - return Material( child: Navigator( | ||
13 | - onGenerateRoute: (_) => MaterialPageRoute( | ||
14 | - builder: (context) => Builder( | ||
15 | - builder: (context) => CupertinoPageScaffold( | ||
16 | - navigationBar: CupertinoNavigationBar( | ||
17 | - leading: Container(), middle: Text('Modal Page')), | ||
18 | - child: SafeArea( | ||
19 | - bottom: false, | ||
20 | - child: ListView( | ||
21 | - shrinkWrap: true, | ||
22 | - controller: scrollController, | ||
23 | - children: ListTile.divideTiles( | ||
24 | - context: context, | ||
25 | - tiles: List.generate( | ||
26 | - 100, | ||
27 | - (index) => ListTile( | ||
28 | - title: Text('Item'), | ||
29 | - onTap: () { | ||
30 | - Navigator.of(context).push( | ||
31 | - MaterialPageRoute( | ||
32 | - builder: (context) => | ||
33 | - CupertinoPageScaffold( | ||
34 | - navigationBar: | ||
35 | - CupertinoNavigationBar( | ||
36 | - middle: Text( | ||
37 | - 'New Page'), | ||
38 | - ), | ||
39 | - child: Stack( | ||
40 | - fit: | ||
41 | - StackFit.expand, | ||
42 | - children: < | ||
43 | - Widget>[], | ||
44 | - )))); | ||
45 | - }, | ||
46 | - )), | ||
47 | - ).toList(), | ||
48 | - ), | ||
49 | - ), | ||
50 | - ), | ||
51 | - ), | ||
52 | - ),) | ||
53 | - ); | 11 | + return Material( |
12 | + child: Navigator( | ||
13 | + onGenerateRoute: (_) => MaterialPageRoute( | ||
14 | + builder: (context) => Builder( | ||
15 | + builder: (context) => CupertinoPageScaffold( | ||
16 | + navigationBar: CupertinoNavigationBar( | ||
17 | + leading: Container(), middle: Text('Modal Page')), | ||
18 | + child: SafeArea( | ||
19 | + bottom: false, | ||
20 | + child: ListView( | ||
21 | + shrinkWrap: true, | ||
22 | + controller: scrollController, | ||
23 | + children: ListTile.divideTiles( | ||
24 | + context: context, | ||
25 | + tiles: List.generate( | ||
26 | + 100, | ||
27 | + (index) => ListTile( | ||
28 | + title: Text('Item'), | ||
29 | + onTap: () { | ||
30 | + Navigator.of(context).push(MaterialPageRoute( | ||
31 | + builder: (context) => CupertinoPageScaffold( | ||
32 | + navigationBar: CupertinoNavigationBar( | ||
33 | + middle: Text('New Page'), | ||
34 | + ), | ||
35 | + child: Stack( | ||
36 | + fit: StackFit.expand, | ||
37 | + children: <Widget>[], | ||
38 | + )))); | ||
39 | + }, | ||
40 | + )), | ||
41 | + ).toList(), | ||
42 | + ), | ||
43 | + ), | ||
44 | + ), | ||
45 | + ), | ||
46 | + ), | ||
47 | + )); | ||
54 | } | 48 | } |
55 | } | 49 | } |
56 | - |
@@ -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.13" | 10 | + version: "2.0.11" |
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.6.0" | 17 | + version: "1.5.2" |
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.1" | 24 | + version: "2.4.0" |
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: "2.0.0" | 31 | + version: "1.0.5" |
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.3" | 38 | + version: "1.1.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.14.12" | 45 | + version: "1.14.11" |
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.4" | 59 | + version: "2.1.3" |
60 | cupertino_icons: | 60 | cupertino_icons: |
61 | dependency: "direct main" | 61 | dependency: "direct main" |
62 | description: | 62 | description: |
@@ -80,7 +80,7 @@ packages: | @@ -80,7 +80,7 @@ packages: | ||
80 | name: image | 80 | name: image |
81 | url: "https://pub.dartlang.org" | 81 | url: "https://pub.dartlang.org" |
82 | source: hosted | 82 | source: hosted |
83 | - version: "2.1.12" | 83 | + version: "2.1.4" |
84 | matcher: | 84 | matcher: |
85 | dependency: transitive | 85 | dependency: transitive |
86 | description: | 86 | description: |
@@ -101,7 +101,7 @@ packages: | @@ -101,7 +101,7 @@ packages: | ||
101 | path: ".." | 101 | path: ".." |
102 | relative: true | 102 | relative: true |
103 | source: path | 103 | source: path |
104 | - version: "0.0.1" | 104 | + version: "0.1.0" |
105 | path: | 105 | path: |
106 | dependency: transitive | 106 | dependency: transitive |
107 | description: | 107 | description: |
@@ -109,6 +109,13 @@ packages: | @@ -109,6 +109,13 @@ packages: | ||
109 | url: "https://pub.dartlang.org" | 109 | url: "https://pub.dartlang.org" |
110 | source: hosted | 110 | source: hosted |
111 | version: "1.6.4" | 111 | version: "1.6.4" |
112 | + pedantic: | ||
113 | + dependency: transitive | ||
114 | + description: | ||
115 | + name: pedantic | ||
116 | + url: "https://pub.dartlang.org" | ||
117 | + source: hosted | ||
118 | + version: "1.8.0+1" | ||
112 | petitparser: | 119 | petitparser: |
113 | dependency: transitive | 120 | dependency: transitive |
114 | description: | 121 | description: |
@@ -122,7 +129,7 @@ packages: | @@ -122,7 +129,7 @@ packages: | ||
122 | name: quiver | 129 | name: quiver |
123 | url: "https://pub.dartlang.org" | 130 | url: "https://pub.dartlang.org" |
124 | source: hosted | 131 | source: hosted |
125 | - version: "2.1.3" | 132 | + version: "2.0.5" |
126 | sky_engine: | 133 | sky_engine: |
127 | dependency: transitive | 134 | dependency: transitive |
128 | description: flutter | 135 | description: flutter |
@@ -134,7 +141,7 @@ packages: | @@ -134,7 +141,7 @@ packages: | ||
134 | name: source_span | 141 | name: source_span |
135 | url: "https://pub.dartlang.org" | 142 | url: "https://pub.dartlang.org" |
136 | source: hosted | 143 | source: hosted |
137 | - version: "1.7.0" | 144 | + version: "1.5.5" |
138 | stack_trace: | 145 | stack_trace: |
139 | dependency: transitive | 146 | dependency: transitive |
140 | description: | 147 | description: |
@@ -169,7 +176,7 @@ packages: | @@ -169,7 +176,7 @@ packages: | ||
169 | name: test_api | 176 | name: test_api |
170 | url: "https://pub.dartlang.org" | 177 | url: "https://pub.dartlang.org" |
171 | source: hosted | 178 | source: hosted |
172 | - version: "0.2.15" | 179 | + version: "0.2.11" |
173 | typed_data: | 180 | typed_data: |
174 | dependency: transitive | 181 | dependency: transitive |
175 | description: | 182 | description: |
@@ -190,6 +197,6 @@ packages: | @@ -190,6 +197,6 @@ packages: | ||
190 | name: xml | 197 | name: xml |
191 | url: "https://pub.dartlang.org" | 198 | url: "https://pub.dartlang.org" |
192 | source: hosted | 199 | source: hosted |
193 | - version: "3.6.1" | 200 | + version: "3.5.0" |
194 | sdks: | 201 | sdks: |
195 | - dart: ">=2.7.0 <3.0.0" | 202 | + dart: ">=2.4.0 <3.0.0" |
@@ -4,5 +4,3 @@ | @@ -4,5 +4,3 @@ | ||
4 | // utility that Flutter provides. For example, you can send tap and scroll | 4 | // utility that Flutter provides. For example, you can send tap and scroll |
5 | // gestures. You can also use WidgetTester to find child widgets in the widget | 5 | // gestures. You can also use WidgetTester to find child widgets in the widget |
6 | // tree, read text, and verify that the values of widget properties are correct. | 6 | // tree, read text, and verify that the values of widget properties are correct. |
7 | - | ||
8 | - |
1 | - | ||
2 | export 'src/bottom_sheet.dart'; | 1 | export 'src/bottom_sheet.dart'; |
3 | export 'src/bottom_sheet_route.dart'; | 2 | export 'src/bottom_sheet_route.dart'; |
4 | export 'src/material_with_modal_page_route.dart'; | 3 | export 'src/material_with_modal_page_route.dart'; |
5 | export 'src/bottom_sheets/cupertino_bottom_sheet.dart'; | 4 | export 'src/bottom_sheets/cupertino_bottom_sheet.dart'; |
6 | export 'src/bottom_sheets/material_bottom_sheet.dart'; | 5 | export 'src/bottom_sheets/material_bottom_sheet.dart'; |
7 | -export 'src/bottom_sheets/bar_bottom_sheet.dart'; | ||
6 | +export 'src/bottom_sheets/bar_bottom_sheet.dart'; |
@@ -3,7 +3,6 @@ | @@ -3,7 +3,6 @@ | ||
3 | // found in the LICENSE file. | 3 | // found in the LICENSE file. |
4 | 4 | ||
5 | import 'dart:async'; | 5 | import 'dart:async'; |
6 | -import 'dart:math'; | ||
7 | 6 | ||
8 | import 'package:flutter/cupertino.dart'; | 7 | import 'package:flutter/cupertino.dart'; |
9 | import 'package:flutter/foundation.dart'; | 8 | import 'package:flutter/foundation.dart'; |
@@ -12,8 +11,6 @@ import 'package:flutter/material.dart'; | @@ -12,8 +11,6 @@ import 'package:flutter/material.dart'; | ||
12 | import 'package:flutter/scheduler.dart'; | 11 | import 'package:flutter/scheduler.dart'; |
13 | import 'package:flutter/widgets.dart'; | 12 | import 'package:flutter/widgets.dart'; |
14 | 13 | ||
15 | -import 'bottom_sheet_route.dart'; | ||
16 | - | ||
17 | const Duration _bottomSheetDuration = Duration(milliseconds: 400); | 14 | const Duration _bottomSheetDuration = Duration(milliseconds: 400); |
18 | const double _minFlingVelocity = 500.0; | 15 | const double _minFlingVelocity = 500.0; |
19 | const double _closeProgressThreshold = 0.5; | 16 | const double _closeProgressThreshold = 0.5; |
@@ -158,8 +155,8 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -158,8 +155,8 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
158 | 155 | ||
159 | bool _isCheckingShouldClose = false; | 156 | bool _isCheckingShouldClose = false; |
160 | FutureOr<bool> shouldClose() async { | 157 | FutureOr<bool> shouldClose() async { |
161 | - if(_isCheckingShouldClose) return false; | ||
162 | - if(widget.shouldClose == null) return null; | 158 | + if (_isCheckingShouldClose) return false; |
159 | + if (widget.shouldClose == null) return null; | ||
163 | _isCheckingShouldClose = true; | 160 | _isCheckingShouldClose = true; |
164 | final result = await widget.shouldClose(); | 161 | final result = await widget.shouldClose(); |
165 | _isCheckingShouldClose = false; | 162 | _isCheckingShouldClose = false; |
@@ -203,7 +200,6 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -203,7 +200,6 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
203 | isDragging = false; | 200 | isDragging = false; |
204 | _bounceDragController.reverse(); | 201 | _bounceDragController.reverse(); |
205 | 202 | ||
206 | - | ||
207 | bool canClose = true; | 203 | bool canClose = true; |
208 | if (widget.shouldClose != null && hasReachedWillPopThreshold) { | 204 | if (widget.shouldClose != null && hasReachedWillPopThreshold) { |
209 | _cancelClose(); | 205 | _cancelClose(); |
@@ -273,20 +269,18 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | @@ -273,20 +269,18 @@ class _ModalBottomSheetState extends State<ModalBottomSheet> | ||
273 | child, | 269 | child, |
274 | ); | 270 | ); |
275 | 271 | ||
276 | - | ||
277 | // Todo: Add curved Animation when push and pop without gesture | 272 | // Todo: Add curved Animation when push and pop without gesture |
278 | - final Animation<double> containerAnimation = CurvedAnimation( | 273 | + /* final Animation<double> containerAnimation = CurvedAnimation( |
279 | parent: widget.animationController, | 274 | parent: widget.animationController, |
280 | curve: Curves.easeOut, | 275 | curve: Curves.easeOut, |
281 | - ); | 276 | + );*/ |
282 | 277 | ||
283 | return AnimatedBuilder( | 278 | return AnimatedBuilder( |
284 | animation: widget.animationController, | 279 | animation: widget.animationController, |
285 | builder: (context, _) => ClipRect( | 280 | builder: (context, _) => ClipRect( |
286 | child: CustomSingleChildLayout( | 281 | child: CustomSingleChildLayout( |
287 | delegate: _ModalBottomSheetLayout( | 282 | delegate: _ModalBottomSheetLayout( |
288 | - widget.animationController.value, | ||
289 | - widget.expanded), | 283 | + widget.animationController.value, widget.expanded), |
290 | child: !widget.enableDrag | 284 | child: !widget.enableDrag |
291 | ? child | 285 | ? child |
292 | : KeyedSubtree( | 286 | : KeyedSubtree( |
1 | import 'dart:async'; | 1 | import 'dart:async'; |
2 | 2 | ||
3 | import 'package:flutter/cupertino.dart'; | 3 | import 'package:flutter/cupertino.dart'; |
4 | -import 'package:flutter/foundation.dart'; | ||
5 | -import 'package:flutter/gestures.dart'; | ||
6 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
7 | -import 'package:flutter/scheduler.dart'; | ||
8 | -import 'package:flutter/widgets.dart'; | ||
9 | 5 | ||
10 | import '../modal_bottom_sheet.dart'; | 6 | import '../modal_bottom_sheet.dart'; |
11 | -import 'material_with_modal_page_route.dart'; | ||
12 | 7 | ||
13 | const Duration _bottomSheetDuration = Duration(milliseconds: 400); | 8 | const Duration _bottomSheetDuration = Duration(milliseconds: 400); |
14 | 9 | ||
15 | -class _ModalBottomSheetLayout extends SingleChildLayoutDelegate { | ||
16 | - _ModalBottomSheetLayout(this.progress, this.expand); | ||
17 | - | ||
18 | - final double progress; | ||
19 | - final bool expand; | ||
20 | - | ||
21 | - @override | ||
22 | - BoxConstraints getConstraintsForChild(BoxConstraints constraints) { | ||
23 | - return BoxConstraints( | ||
24 | - minWidth: constraints.maxWidth, | ||
25 | - maxWidth: constraints.maxWidth, | ||
26 | - minHeight: expand ? constraints.maxHeight : 0, | ||
27 | - maxHeight: expand ? constraints.maxHeight : constraints.minHeight, | ||
28 | - ); | ||
29 | - } | ||
30 | - | ||
31 | - @override | ||
32 | - Offset getPositionForChild(Size size, Size childSize) { | ||
33 | - return Offset(0.0, size.height - childSize.height * progress); | ||
34 | - } | ||
35 | - | ||
36 | - @override | ||
37 | - bool shouldRelayout(_ModalBottomSheetLayout oldDelegate) { | ||
38 | - return progress != oldDelegate.progress; | ||
39 | - } | ||
40 | -} | ||
41 | - | ||
42 | class _ModalBottomSheet<T> extends StatefulWidget { | 10 | class _ModalBottomSheet<T> extends StatefulWidget { |
43 | const _ModalBottomSheet({ | 11 | const _ModalBottomSheet({ |
44 | Key key, | 12 | Key key, |
@@ -65,13 +33,14 @@ class _ModalBottomSheet<T> extends StatefulWidget { | @@ -65,13 +33,14 @@ class _ModalBottomSheet<T> extends StatefulWidget { | ||
65 | 33 | ||
66 | class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | 34 | class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { |
67 | String _getRouteLabel(MaterialLocalizations localizations) { | 35 | String _getRouteLabel(MaterialLocalizations localizations) { |
68 | - switch (Theme.of(context).platform) { | 36 | + final platform = Theme.of(context).platform; |
37 | + switch (platform) { | ||
69 | case TargetPlatform.iOS: | 38 | case TargetPlatform.iOS: |
70 | - case TargetPlatform.macOS: | ||
71 | return ''; | 39 | return ''; |
72 | case TargetPlatform.android: | 40 | case TargetPlatform.android: |
73 | case TargetPlatform.fuchsia: | 41 | case TargetPlatform.fuchsia: |
74 | return localizations.dialogLabel; | 42 | return localizations.dialogLabel; |
43 | + break; | ||
75 | } | 44 | } |
76 | return null; | 45 | return null; |
77 | } | 46 | } |
@@ -100,9 +69,6 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | @@ -100,9 +69,6 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | ||
100 | MaterialLocalizations.of(context); | 69 | MaterialLocalizations.of(context); |
101 | final String routeLabel = _getRouteLabel(localizations); | 70 | final String routeLabel = _getRouteLabel(localizations); |
102 | 71 | ||
103 | - | ||
104 | - | ||
105 | - | ||
106 | return AnimatedBuilder( | 72 | return AnimatedBuilder( |
107 | animation: widget.route._animationController, | 73 | animation: widget.route._animationController, |
108 | builder: (BuildContext context, Widget child) { | 74 | builder: (BuildContext context, Widget child) { |
@@ -113,27 +79,25 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | @@ -113,27 +79,25 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> { | ||
113 | namesRoute: true, | 79 | namesRoute: true, |
114 | label: routeLabel, | 80 | label: routeLabel, |
115 | explicitChildNodes: true, | 81 | explicitChildNodes: true, |
116 | - child: ModalBottomSheet( | ||
117 | - expanded: widget.route.expanded, | ||
118 | - containerBuilder: widget.route.containerBuilder, | ||
119 | - animationController: widget.route._animationController, | ||
120 | - shouldClose: widget.route.hasScopedWillPopCallback | ||
121 | - ? () async { | ||
122 | - final willPop = await widget.route.willPop(); | ||
123 | - return willPop != RoutePopDisposition.doNotPop; | ||
124 | - } | ||
125 | - : null, | ||
126 | - onClosing: () { | ||
127 | - if (widget.route.isCurrent) { | ||
128 | - Navigator.of(context).pop(); | 82 | + child: ModalBottomSheet( |
83 | + expanded: widget.route.expanded, | ||
84 | + containerBuilder: widget.route.containerBuilder, | ||
85 | + animationController: widget.route._animationController, | ||
86 | + shouldClose: widget.route._hasScopedWillPopCallback | ||
87 | + ? () async { | ||
88 | + final willPop = await widget.route.willPop(); | ||
89 | + return willPop != RoutePopDisposition.doNotPop; | ||
129 | } | 90 | } |
130 | - }, | ||
131 | - builder: widget.route.builder, | ||
132 | - enableDrag: widget.enableDrag, | ||
133 | - bounce: widget.bounce, | ||
134 | - ), | ||
135 | - | ||
136 | - | 91 | + : null, |
92 | + onClosing: () { | ||
93 | + if (widget.route.isCurrent) { | ||
94 | + Navigator.of(context).pop(); | ||
95 | + } | ||
96 | + }, | ||
97 | + builder: widget.route.builder, | ||
98 | + enableDrag: widget.enableDrag, | ||
99 | + bounce: widget.bounce, | ||
100 | + ), | ||
137 | ); | 101 | ); |
138 | }, | 102 | }, |
139 | ); | 103 | ); |
@@ -191,6 +155,8 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -191,6 +155,8 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
191 | return _animationController; | 155 | return _animationController; |
192 | } | 156 | } |
193 | 157 | ||
158 | + bool get _hasScopedWillPopCallback => hasScopedWillPopCallback; | ||
159 | + | ||
194 | @override | 160 | @override |
195 | Widget buildPage(BuildContext context, Animation<double> animation, | 161 | Widget buildPage(BuildContext context, Animation<double> animation, |
196 | Animation<double> secondaryAnimation) { | 162 | Animation<double> secondaryAnimation) { |
1 | - | ||
2 | - | ||
3 | - | ||
4 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
5 | import 'package:flutter/services.dart'; | 2 | import 'package:flutter/services.dart'; |
3 | +import 'dart:async'; | ||
6 | 4 | ||
7 | import '../../modal_bottom_sheet.dart'; | 5 | import '../../modal_bottom_sheet.dart'; |
8 | import '../bottom_sheet_route.dart'; | 6 | import '../bottom_sheet_route.dart'; |
@@ -14,51 +12,47 @@ class BarBottomSheet extends StatelessWidget { | @@ -14,51 +12,47 @@ class BarBottomSheet extends StatelessWidget { | ||
14 | @override | 12 | @override |
15 | Widget build(BuildContext context) { | 13 | Widget build(BuildContext context) { |
16 | return AnnotatedRegion<SystemUiOverlayStyle>( | 14 | return AnnotatedRegion<SystemUiOverlayStyle>( |
17 | - value: SystemUiOverlayStyle.light, | ||
18 | - child: Column( | ||
19 | - mainAxisSize: MainAxisSize.min, | ||
20 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
21 | - children: [ | ||
22 | - SizedBox(height: 12), | ||
23 | - SafeArea( | ||
24 | - bottom: false, | ||
25 | - child: Container( | ||
26 | - height: 6, | ||
27 | - width: 40, | ||
28 | - decoration: BoxDecoration( | ||
29 | - color: Colors.white, | ||
30 | - borderRadius: BorderRadius.circular(6)), | ||
31 | - ), | ||
32 | - ), | ||
33 | - SizedBox(height: 8), | ||
34 | - Flexible( | ||
35 | - flex: 1, | ||
36 | - fit: FlexFit.loose, | ||
37 | - child: ClipRRect( | ||
38 | - borderRadius: BorderRadius.only( | ||
39 | - topLeft: Radius.circular(15), | ||
40 | - topRight: Radius.circular(15)), | 15 | + value: SystemUiOverlayStyle.light, |
16 | + child: Column( | ||
17 | + mainAxisSize: MainAxisSize.min, | ||
18 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
19 | + children: [ | ||
20 | + SizedBox(height: 12), | ||
21 | + SafeArea( | ||
22 | + bottom: false, | ||
41 | child: Container( | 23 | child: Container( |
42 | - decoration: BoxDecoration( | ||
43 | - color: Theme.of(context).scaffoldBackgroundColor, | ||
44 | - boxShadow: [ | ||
45 | - BoxShadow( | ||
46 | - blurRadius: 10, | ||
47 | - color: Colors.black12, | ||
48 | - spreadRadius: 5) | ||
49 | - ]), | ||
50 | - width: double.infinity, | ||
51 | - child: MediaQuery.removePadding( | ||
52 | - context: context, | ||
53 | - removeTop: true, | ||
54 | - child: child | ||
55 | - ) | 24 | + height: 6, |
25 | + width: 40, | ||
26 | + decoration: BoxDecoration( | ||
27 | + color: Colors.white, | ||
28 | + borderRadius: BorderRadius.circular(6)), | ||
56 | ), | 29 | ), |
57 | ), | 30 | ), |
58 | - ), | ||
59 | - ]),); | 31 | + SizedBox(height: 8), |
32 | + Flexible( | ||
33 | + flex: 1, | ||
34 | + fit: FlexFit.loose, | ||
35 | + child: ClipRRect( | ||
36 | + borderRadius: BorderRadius.only( | ||
37 | + topLeft: Radius.circular(15), | ||
38 | + topRight: Radius.circular(15)), | ||
39 | + child: Container( | ||
40 | + decoration: BoxDecoration( | ||
41 | + color: Theme.of(context).scaffoldBackgroundColor, | ||
42 | + boxShadow: [ | ||
43 | + BoxShadow( | ||
44 | + blurRadius: 10, | ||
45 | + color: Colors.black12, | ||
46 | + spreadRadius: 5) | ||
47 | + ]), | ||
48 | + width: double.infinity, | ||
49 | + child: MediaQuery.removePadding( | ||
50 | + context: context, removeTop: true, child: child)), | ||
51 | + ), | ||
52 | + ), | ||
53 | + ]), | ||
54 | + ); | ||
60 | } | 55 | } |
61 | - | ||
62 | } | 56 | } |
63 | 57 | ||
64 | Future<T> showBarModalBottomSheet<T>({ | 58 | Future<T> showBarModalBottomSheet<T>({ |
@@ -88,7 +82,9 @@ Future<T> showBarModalBottomSheet<T>({ | @@ -88,7 +82,9 @@ Future<T> showBarModalBottomSheet<T>({ | ||
88 | .push(ModalBottomSheetRoute<T>( | 82 | .push(ModalBottomSheetRoute<T>( |
89 | builder: builder, | 83 | builder: builder, |
90 | bounce: bounce, | 84 | bounce: bounce, |
91 | - containerBuilder: (_, __, child) => BarBottomSheet(child: child,), | 85 | + containerBuilder: (_, __, child) => BarBottomSheet( |
86 | + child: child, | ||
87 | + ), | ||
92 | secondAnimationController: secondAnimation, | 88 | secondAnimationController: secondAnimation, |
93 | expanded: expand, | 89 | expanded: expand, |
94 | barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, | 90 | barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, |
@@ -98,4 +94,3 @@ Future<T> showBarModalBottomSheet<T>({ | @@ -98,4 +94,3 @@ Future<T> showBarModalBottomSheet<T>({ | ||
98 | )); | 94 | )); |
99 | return result; | 95 | return result; |
100 | } | 96 | } |
101 | - |
@@ -8,7 +8,6 @@ import 'package:flutter/cupertino.dart'; | @@ -8,7 +8,6 @@ import 'package:flutter/cupertino.dart'; | ||
8 | import 'package:flutter/foundation.dart'; | 8 | import 'package:flutter/foundation.dart'; |
9 | import 'package:flutter/gestures.dart'; | 9 | import 'package:flutter/gestures.dart'; |
10 | import 'package:flutter/material.dart'; | 10 | import 'package:flutter/material.dart'; |
11 | -import 'package:flutter/scheduler.dart'; | ||
12 | import 'package:flutter/services.dart'; | 11 | import 'package:flutter/services.dart'; |
13 | import 'package:flutter/widgets.dart'; | 12 | import 'package:flutter/widgets.dart'; |
14 | 13 | ||
@@ -200,7 +199,9 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -200,7 +199,9 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
200 | final progress = curvedAnimation.value; | 199 | final progress = curvedAnimation.value; |
201 | final yOffset = progress * paddingTop; | 200 | final yOffset = progress * paddingTop; |
202 | final scale = 1 - progress / 10; | 201 | final scale = 1 - progress / 10; |
203 | - final radius = progress == 0 ? 0.0 : (1 - progress) * startRoundCorner + progress * 12; | 202 | + final radius = progress == 0 |
203 | + ? 0.0 | ||
204 | + : (1 - progress) * startRoundCorner + progress * 12; | ||
204 | return Stack( | 205 | return Stack( |
205 | children: <Widget>[ | 206 | children: <Widget>[ |
206 | Container(color: Colors.black), | 207 | Container(color: Colors.black), |
1 | - | ||
2 | - | ||
3 | - | ||
4 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
5 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 2 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
3 | +import 'dart:async'; | ||
6 | 4 | ||
7 | /// Shows a modal material design bottom sheet. | 5 | /// Shows a modal material design bottom sheet. |
8 | Future<T> showMaterialModalBottomSheet<T>({ | 6 | Future<T> showMaterialModalBottomSheet<T>({ |
@@ -53,10 +51,10 @@ Future<T> showMaterialModalBottomSheet<T>({ | @@ -53,10 +51,10 @@ Future<T> showMaterialModalBottomSheet<T>({ | ||
53 | //Default container builder is the Material Appearance | 51 | //Default container builder is the Material Appearance |
54 | WidgetWithChildBuilder _materialContainerBuilder(BuildContext context, | 52 | WidgetWithChildBuilder _materialContainerBuilder(BuildContext context, |
55 | {Color backgroundColor, | 53 | {Color backgroundColor, |
56 | - double elevation, | ||
57 | - ThemeData theme, | ||
58 | - Clip clipBehavior, | ||
59 | - ShapeBorder shape}) { | 54 | + double elevation, |
55 | + ThemeData theme, | ||
56 | + Clip clipBehavior, | ||
57 | + ShapeBorder shape}) { | ||
60 | final BottomSheetThemeData bottomSheetTheme = | 58 | final BottomSheetThemeData bottomSheetTheme = |
61 | Theme.of(context).bottomSheetTheme; | 59 | Theme.of(context).bottomSheetTheme; |
62 | final Color color = backgroundColor ?? | 60 | final Color color = backgroundColor ?? |
1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
2 | import 'package:flutter/foundation.dart'; | 2 | import 'package:flutter/foundation.dart'; |
3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
4 | -import 'package:flutter/services.dart'; | ||
5 | 4 | ||
6 | import '../modal_bottom_sheet.dart'; | 5 | import '../modal_bottom_sheet.dart'; |
7 | import 'bottom_sheet_route.dart'; | 6 | import 'bottom_sheet_route.dart'; |
8 | 7 | ||
9 | -class e extends PageRouteBuilder { | ||
10 | - | ||
11 | -} | ||
12 | - | ||
13 | class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | 8 | class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { |
14 | /// Construct a MaterialPageRoute whose contents are defined by [builder]. | 9 | /// Construct a MaterialPageRoute whose contents are defined by [builder]. |
15 | /// | 10 | /// |
@@ -30,8 +25,6 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | @@ -30,8 +25,6 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | ||
30 | builder: builder, | 25 | builder: builder, |
31 | maintainState: maintainState); | 26 | maintainState: maintainState); |
32 | 27 | ||
33 | - | ||
34 | - | ||
35 | ModalBottomSheetRoute _nextModalRoute; | 28 | ModalBottomSheetRoute _nextModalRoute; |
36 | 29 | ||
37 | @override | 30 | @override |
@@ -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.13" | 10 | + version: "2.0.11" |
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.6.0" | 17 | + version: "1.5.2" |
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.1" | 24 | + version: "2.4.0" |
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: "2.0.0" | 31 | + version: "1.0.5" |
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.3" | 38 | + version: "1.1.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.14.12" | 45 | + version: "1.14.11" |
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.4" | 59 | + version: "2.1.3" |
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.12" | 76 | + version: "2.1.4" |
77 | matcher: | 77 | matcher: |
78 | dependency: transitive | 78 | dependency: transitive |
79 | description: | 79 | description: |
@@ -95,6 +95,13 @@ packages: | @@ -95,6 +95,13 @@ packages: | ||
95 | url: "https://pub.dartlang.org" | 95 | url: "https://pub.dartlang.org" |
96 | source: hosted | 96 | source: hosted |
97 | version: "1.6.4" | 97 | version: "1.6.4" |
98 | + pedantic: | ||
99 | + dependency: transitive | ||
100 | + description: | ||
101 | + name: pedantic | ||
102 | + url: "https://pub.dartlang.org" | ||
103 | + source: hosted | ||
104 | + version: "1.8.0+1" | ||
98 | petitparser: | 105 | petitparser: |
99 | dependency: transitive | 106 | dependency: transitive |
100 | description: | 107 | description: |
@@ -108,7 +115,7 @@ packages: | @@ -108,7 +115,7 @@ packages: | ||
108 | name: quiver | 115 | name: quiver |
109 | url: "https://pub.dartlang.org" | 116 | url: "https://pub.dartlang.org" |
110 | source: hosted | 117 | source: hosted |
111 | - version: "2.1.3" | 118 | + version: "2.0.5" |
112 | sky_engine: | 119 | sky_engine: |
113 | dependency: transitive | 120 | dependency: transitive |
114 | description: flutter | 121 | description: flutter |
@@ -120,7 +127,7 @@ packages: | @@ -120,7 +127,7 @@ packages: | ||
120 | name: source_span | 127 | name: source_span |
121 | url: "https://pub.dartlang.org" | 128 | url: "https://pub.dartlang.org" |
122 | source: hosted | 129 | source: hosted |
123 | - version: "1.7.0" | 130 | + version: "1.5.5" |
124 | stack_trace: | 131 | stack_trace: |
125 | dependency: transitive | 132 | dependency: transitive |
126 | description: | 133 | description: |
@@ -155,7 +162,7 @@ packages: | @@ -155,7 +162,7 @@ packages: | ||
155 | name: test_api | 162 | name: test_api |
156 | url: "https://pub.dartlang.org" | 163 | url: "https://pub.dartlang.org" |
157 | source: hosted | 164 | source: hosted |
158 | - version: "0.2.15" | 165 | + version: "0.2.11" |
159 | typed_data: | 166 | typed_data: |
160 | dependency: transitive | 167 | dependency: transitive |
161 | description: | 168 | description: |
@@ -176,6 +183,6 @@ packages: | @@ -176,6 +183,6 @@ packages: | ||
176 | name: xml | 183 | name: xml |
177 | url: "https://pub.dartlang.org" | 184 | url: "https://pub.dartlang.org" |
178 | source: hosted | 185 | source: hosted |
179 | - version: "3.6.1" | 186 | + version: "3.5.0" |
180 | sdks: | 187 | sdks: |
181 | - dart: ">=2.7.0 <3.0.0" | 188 | + dart: ">=2.4.0 <3.0.0" |
1 | name: modal_bottom_sheet | 1 | name: modal_bottom_sheet |
2 | -description: 'Modal bottom sheets: Cupertino, Material, or build your own' | ||
3 | -version: 0.0.1 | ||
4 | -author: 'JB <git@jaimeblasco.com>' | 2 | +description: 'Create flutter advanced modal bottom sheets. Material, Cupertino or your own style' |
3 | +version: 0.1.3 | ||
5 | homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' | 4 | homepage: 'https://github.com/jamesblasco/modal_bottom_sheet' |
6 | 5 | ||
7 | environment: | 6 | environment: |
8 | - sdk: ">=2.7.0 <3.0.0" | 7 | + sdk: ">=2.0.0 <3.0.0" |
8 | + flutter: ">=1.12.0 <2.0.0" | ||
9 | 9 | ||
10 | dependencies: | 10 | dependencies: |
11 | flutter: | 11 | flutter: |
-
Please register or login to post a comment