Showing
14 changed files
with
12 additions
and
78 deletions
@@ -2,7 +2,6 @@ import 'dart:math'; | @@ -2,7 +2,6 @@ import 'dart:math'; | ||
2 | 2 | ||
3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
4 | import 'package:flutter/services.dart'; | 4 | import 'package:flutter/services.dart'; |
5 | -import 'package:flutter/widgets.dart'; | ||
6 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 5 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
7 | 6 | ||
8 | class AvatarBottomSheet extends StatelessWidget { | 7 | class AvatarBottomSheet extends StatelessWidget { |
@@ -83,12 +82,6 @@ Future<T?> showAvatarModalBottomSheet<T>({ | @@ -83,12 +82,6 @@ Future<T?> showAvatarModalBottomSheet<T>({ | ||
83 | bool enableDrag = true, | 82 | bool enableDrag = true, |
84 | Duration? duration, | 83 | Duration? duration, |
85 | }) async { | 84 | }) async { |
86 | - assert(context != null); | ||
87 | - assert(builder != null); | ||
88 | - assert(expand != null); | ||
89 | - assert(useRootNavigator != null); | ||
90 | - assert(isDismissible != null); | ||
91 | - assert(enableDrag != null); | ||
92 | assert(debugCheckHasMediaQuery(context)); | 85 | assert(debugCheckHasMediaQuery(context)); |
93 | assert(debugCheckHasMaterialLocalizations(context)); | 86 | assert(debugCheckHasMaterialLocalizations(context)); |
94 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) | 87 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | -import 'package:flutter/widgets.dart'; | ||
3 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; | 2 | import 'package:modal_bottom_sheet/modal_bottom_sheet.dart'; |
4 | 3 | ||
5 | class FloatingModal extends StatelessWidget { | 4 | class FloatingModal extends StatelessWidget { |
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/rendering.dart'; | ||
5 | import 'package:url_launcher/url_launcher.dart'; | 4 | import 'package:url_launcher/url_launcher.dart'; |
6 | 5 | ||
7 | class WebFrame extends StatelessWidget { | 6 | class WebFrame extends StatelessWidget { |
@@ -3,12 +3,8 @@ | @@ -3,12 +3,8 @@ | ||
3 | // found in the LICENSE file. | 3 | // found in the LICENSE file. |
4 | 4 | ||
5 | import 'dart:async'; | 5 | import 'dart:async'; |
6 | -import 'package:flutter/cupertino.dart'; | ||
7 | -import 'package:flutter/foundation.dart'; | ||
8 | import 'package:flutter/gestures.dart'; | 6 | import 'package:flutter/gestures.dart'; |
9 | import 'package:flutter/material.dart'; | 7 | import 'package:flutter/material.dart'; |
10 | -import 'package:flutter/scheduler.dart'; | ||
11 | -import 'package:flutter/widgets.dart'; | ||
12 | import 'package:modal_bottom_sheet/src/utils/scroll_to_top_status_bar.dart'; | 8 | import 'package:modal_bottom_sheet/src/utils/scroll_to_top_status_bar.dart'; |
13 | 9 | ||
14 | import 'package:modal_bottom_sheet/src/utils/bottom_sheet_suspended_curve.dart'; | 10 | import 'package:modal_bottom_sheet/src/utils/bottom_sheet_suspended_curve.dart'; |
@@ -49,10 +45,7 @@ class ModalBottomSheet extends StatefulWidget { | @@ -49,10 +45,7 @@ class ModalBottomSheet extends StatefulWidget { | ||
49 | required this.expanded, | 45 | required this.expanded, |
50 | required this.onClosing, | 46 | required this.onClosing, |
51 | required this.child, | 47 | required this.child, |
52 | - }) : assert(enableDrag != null), | ||
53 | - assert(onClosing != null), | ||
54 | - assert(child != null), | ||
55 | - super(key: key); | 48 | + }) : super(key: key); |
56 | 49 | ||
57 | /// The closeProgressThreshold parameter | 50 | /// The closeProgressThreshold parameter |
58 | /// specifies when the bottom sheet will be dismissed when user drags it. | 51 | /// specifies when the bottom sheet will be dismissed when user drags it. |
1 | import 'dart:async'; | 1 | import 'dart:async'; |
2 | 2 | ||
3 | -import 'package:flutter/cupertino.dart'; | ||
4 | -import 'package:flutter/foundation.dart'; | ||
5 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
6 | -import 'package:modal_bottom_sheet/src/utils/modal_scroll_controller.dart'; | ||
7 | 4 | ||
8 | import '../modal_bottom_sheet.dart'; | 5 | import '../modal_bottom_sheet.dart'; |
9 | 6 | ||
@@ -19,9 +16,7 @@ class _ModalBottomSheet<T> extends StatefulWidget { | @@ -19,9 +16,7 @@ class _ModalBottomSheet<T> extends StatefulWidget { | ||
19 | this.expanded = false, | 16 | this.expanded = false, |
20 | this.enableDrag = true, | 17 | this.enableDrag = true, |
21 | this.animationCurve, | 18 | this.animationCurve, |
22 | - }) : assert(expanded != null), | ||
23 | - assert(enableDrag != null), | ||
24 | - super(key: key); | 19 | + }) : super(key: key); |
25 | 20 | ||
26 | final double? closeProgressThreshold; | 21 | final double? closeProgressThreshold; |
27 | final ModalBottomSheetRoute<T> route; | 22 | final ModalBottomSheetRoute<T> route; |
@@ -143,10 +138,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | @@ -143,10 +138,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> { | ||
143 | this.animationCurve, | 138 | this.animationCurve, |
144 | this.duration, | 139 | this.duration, |
145 | RouteSettings? settings, | 140 | RouteSettings? settings, |
146 | - }) : assert(expanded != null), | ||
147 | - assert(isDismissible != null), | ||
148 | - assert(enableDrag != null), | ||
149 | - super(settings: settings); | 141 | + }) : super(settings: settings); |
150 | 142 | ||
151 | final double? closeProgressThreshold; | 143 | final double? closeProgressThreshold; |
152 | final WidgetWithChildBuilder? containerBuilder; | 144 | final WidgetWithChildBuilder? containerBuilder; |
@@ -246,13 +238,6 @@ Future<T?> showCustomModalBottomSheet<T>({ | @@ -246,13 +238,6 @@ Future<T?> showCustomModalBottomSheet<T>({ | ||
246 | bool enableDrag = true, | 238 | bool enableDrag = true, |
247 | Duration? duration, | 239 | Duration? duration, |
248 | }) async { | 240 | }) async { |
249 | - assert(context != null); | ||
250 | - assert(builder != null); | ||
251 | - assert(containerWidget != null); | ||
252 | - assert(expand != null); | ||
253 | - assert(useRootNavigator != null); | ||
254 | - assert(isDismissible != null); | ||
255 | - assert(enableDrag != null); | ||
256 | assert(debugCheckHasMediaQuery(context)); | 241 | assert(debugCheckHasMediaQuery(context)); |
257 | assert(debugCheckHasMaterialLocalizations(context)); | 242 | assert(debugCheckHasMaterialLocalizations(context)); |
258 | final hasMaterialLocalizations = | 243 | final hasMaterialLocalizations = |
@@ -89,12 +89,6 @@ Future<T?> showBarModalBottomSheet<T>({ | @@ -89,12 +89,6 @@ Future<T?> showBarModalBottomSheet<T>({ | ||
89 | Widget? topControl, | 89 | Widget? topControl, |
90 | Duration? duration, | 90 | Duration? duration, |
91 | }) async { | 91 | }) async { |
92 | - assert(context != null); | ||
93 | - assert(builder != null); | ||
94 | - assert(expand != null); | ||
95 | - assert(useRootNavigator != null); | ||
96 | - assert(isDismissible != null); | ||
97 | - assert(enableDrag != null); | ||
98 | assert(debugCheckHasMediaQuery(context)); | 92 | assert(debugCheckHasMediaQuery(context)); |
99 | assert(debugCheckHasMaterialLocalizations(context)); | 93 | assert(debugCheckHasMaterialLocalizations(context)); |
100 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) | 94 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) |
@@ -5,8 +5,6 @@ | @@ -5,8 +5,6 @@ | ||
5 | import 'dart:async'; | 5 | import 'dart:async'; |
6 | 6 | ||
7 | import 'package:flutter/cupertino.dart' show CupertinoTheme, CupertinoApp; | 7 | import 'package:flutter/cupertino.dart' show CupertinoTheme, CupertinoApp; |
8 | -import 'package:flutter/foundation.dart'; | ||
9 | -import 'package:flutter/gestures.dart'; | ||
10 | import 'package:flutter/material.dart' | 8 | import 'package:flutter/material.dart' |
11 | show | 9 | show |
12 | Colors, | 10 | Colors, |
@@ -17,7 +15,6 @@ import 'package:flutter/services.dart'; | @@ -17,7 +15,6 @@ import 'package:flutter/services.dart'; | ||
17 | import 'package:flutter/widgets.dart'; | 15 | import 'package:flutter/widgets.dart'; |
18 | 16 | ||
19 | import '../../modal_bottom_sheet.dart'; | 17 | import '../../modal_bottom_sheet.dart'; |
20 | -import '../bottom_sheet_route.dart'; | ||
21 | 18 | ||
22 | const double _kPreviousPageVisibleOffset = 10; | 19 | const double _kPreviousPageVisibleOffset = 10; |
23 | 20 | ||
@@ -95,11 +92,6 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | @@ -95,11 +92,6 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | ||
95 | Color? transitionBackgroundColor, | 92 | Color? transitionBackgroundColor, |
96 | BoxShadow? shadow, | 93 | BoxShadow? shadow, |
97 | }) async { | 94 | }) async { |
98 | - assert(context != null); | ||
99 | - assert(builder != null); | ||
100 | - assert(expand != null); | ||
101 | - assert(useRootNavigator != null); | ||
102 | - assert(enableDrag != null); | ||
103 | assert(debugCheckHasMediaQuery(context)); | 95 | assert(debugCheckHasMediaQuery(context)); |
104 | final hasMaterialLocalizations = | 96 | final hasMaterialLocalizations = |
105 | Localizations.of<MaterialLocalizations>(context, MaterialLocalizations) != | 97 | Localizations.of<MaterialLocalizations>(context, MaterialLocalizations) != |
@@ -173,10 +165,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -173,10 +165,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
173 | this.transitionBackgroundColor, | 165 | this.transitionBackgroundColor, |
174 | this.topRadius = _kDefaultTopRadius, | 166 | this.topRadius = _kDefaultTopRadius, |
175 | this.previousRouteAnimationCurve, | 167 | this.previousRouteAnimationCurve, |
176 | - }) : assert(expanded != null), | ||
177 | - assert(isDismissible != null), | ||
178 | - assert(enableDrag != null), | ||
179 | - super( | 168 | + }) : super( |
180 | closeProgressThreshold: closeProgressThreshold, | 169 | closeProgressThreshold: closeProgressThreshold, |
181 | scrollController: scrollController, | 170 | scrollController: scrollController, |
182 | containerBuilder: containerBuilder, | 171 | containerBuilder: containerBuilder, |
@@ -266,7 +255,10 @@ class _CupertinoModalTransition extends StatelessWidget { | @@ -266,7 +255,10 @@ class _CupertinoModalTransition extends StatelessWidget { | ||
266 | ); | 255 | ); |
267 | 256 | ||
268 | return AnnotatedRegion<SystemUiOverlayStyle>( | 257 | return AnnotatedRegion<SystemUiOverlayStyle>( |
269 | - value: SystemUiOverlayStyle.light, | 258 | + value: SystemUiOverlayStyle( |
259 | + statusBarIconBrightness: Brightness.light, | ||
260 | + statusBarBrightness: Brightness.dark, | ||
261 | + ), | ||
270 | child: AnimatedBuilder( | 262 | child: AnimatedBuilder( |
271 | animation: curvedAnimation, | 263 | animation: curvedAnimation, |
272 | child: body, | 264 | child: body, |
@@ -355,11 +347,6 @@ class CupertinoScaffold extends StatefulWidget { | @@ -355,11 +347,6 @@ class CupertinoScaffold extends StatefulWidget { | ||
355 | RouteSettings? settings, | 347 | RouteSettings? settings, |
356 | BoxShadow? shadow, | 348 | BoxShadow? shadow, |
357 | }) async { | 349 | }) async { |
358 | - assert(context != null); | ||
359 | - assert(builder != null); | ||
360 | - assert(expand != null); | ||
361 | - assert(useRootNavigator != null); | ||
362 | - assert(enableDrag != null); | ||
363 | assert(debugCheckHasMediaQuery(context)); | 350 | assert(debugCheckHasMediaQuery(context)); |
364 | final isCupertinoApp = | 351 | final isCupertinoApp = |
365 | context.findAncestorWidgetOfExactType<CupertinoApp>() != null; | 352 | context.findAncestorWidgetOfExactType<CupertinoApp>() != null; |
@@ -400,8 +387,6 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold> | @@ -400,8 +387,6 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold> | ||
400 | with TickerProviderStateMixin { | 387 | with TickerProviderStateMixin { |
401 | late AnimationController animationController; | 388 | late AnimationController animationController; |
402 | 389 | ||
403 | - SystemUiOverlayStyle? lastStyle; | ||
404 | - | ||
405 | @override | 390 | @override |
406 | void initState() { | 391 | void initState() { |
407 | animationController = | 392 | animationController = |
@@ -21,12 +21,6 @@ Future<T?> showMaterialModalBottomSheet<T>({ | @@ -21,12 +21,6 @@ Future<T?> showMaterialModalBottomSheet<T>({ | ||
21 | bool enableDrag = true, | 21 | bool enableDrag = true, |
22 | Duration? duration, | 22 | Duration? duration, |
23 | }) async { | 23 | }) async { |
24 | - assert(context != null); | ||
25 | - assert(builder != null); | ||
26 | - assert(expand != null); | ||
27 | - assert(useRootNavigator != null); | ||
28 | - assert(isDismissible != null); | ||
29 | - assert(enableDrag != null); | ||
30 | assert(debugCheckHasMediaQuery(context)); | 24 | assert(debugCheckHasMediaQuery(context)); |
31 | assert(debugCheckHasMaterialLocalizations(context)); | 25 | assert(debugCheckHasMaterialLocalizations(context)); |
32 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) | 26 | final result = await Navigator.of(context, rootNavigator: useRootNavigator) |
1 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
2 | -import 'package:flutter/foundation.dart'; | ||
3 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
4 | 3 | ||
5 | import '../modal_bottom_sheet.dart'; | 4 | import '../modal_bottom_sheet.dart'; |
@@ -15,10 +14,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | @@ -15,10 +14,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> { | ||
15 | RouteSettings? settings, | 14 | RouteSettings? settings, |
16 | bool maintainState = true, | 15 | bool maintainState = true, |
17 | bool fullscreenDialog = false, | 16 | bool fullscreenDialog = false, |
18 | - }) : assert(builder != null), | ||
19 | - assert(maintainState != null), | ||
20 | - assert(fullscreenDialog != null), | ||
21 | - super( | 17 | + }) : super( |
22 | settings: settings, | 18 | settings: settings, |
23 | fullscreenDialog: fullscreenDialog, | 19 | fullscreenDialog: fullscreenDialog, |
24 | builder: builder, | 20 | builder: builder, |
@@ -30,8 +30,7 @@ class BottomSheetSuspendedCurve extends Curve { | @@ -30,8 +30,7 @@ class BottomSheetSuspendedCurve extends Curve { | ||
30 | const BottomSheetSuspendedCurve( | 30 | const BottomSheetSuspendedCurve( |
31 | this.startingPoint, { | 31 | this.startingPoint, { |
32 | this.curve = Curves.easeOutCubic, | 32 | this.curve = Curves.easeOutCubic, |
33 | - }) : assert(startingPoint != null), | ||
34 | - assert(curve != null); | 33 | + }); |
35 | 34 | ||
36 | /// The progress value at which [curve] should begin. | 35 | /// The progress value at which [curve] should begin. |
37 | /// | 36 | /// |
@@ -16,8 +16,7 @@ class ModalScrollController extends InheritedWidget { | @@ -16,8 +16,7 @@ class ModalScrollController extends InheritedWidget { | ||
16 | Key? key, | 16 | Key? key, |
17 | required this.controller, | 17 | required this.controller, |
18 | required Widget child, | 18 | required Widget child, |
19 | - }) : assert(controller != null), | ||
20 | - super( | 19 | + }) : super( |
21 | key: key, | 20 | key: key, |
22 | child: PrimaryScrollController( | 21 | child: PrimaryScrollController( |
23 | controller: controller, | 22 | controller: controller, |
@@ -50,7 +50,7 @@ class _ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> { | @@ -50,7 +50,7 @@ class _ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> { | ||
50 | 50 | ||
51 | void _handleStatusBarTap(BuildContext context) { | 51 | void _handleStatusBarTap(BuildContext context) { |
52 | final controller = widget.scrollController; | 52 | final controller = widget.scrollController; |
53 | - if (controller != null && controller.hasClients) { | 53 | + if (controller.hasClients) { |
54 | controller.animateTo( | 54 | controller.animateTo( |
55 | 0.0, | 55 | 0.0, |
56 | duration: const Duration(milliseconds: 300), | 56 | duration: const Duration(milliseconds: 300), |
-
Please register or login to post a comment