Showing
1 changed file
with
13 additions
and
13 deletions
@@ -19,15 +19,15 @@ import 'package:flutter/widgets.dart'; | @@ -19,15 +19,15 @@ import 'package:flutter/widgets.dart'; | ||
19 | import '../../modal_bottom_sheet.dart'; | 19 | import '../../modal_bottom_sheet.dart'; |
20 | import '../bottom_sheet_route.dart'; | 20 | import '../bottom_sheet_route.dart'; |
21 | 21 | ||
22 | -const double _behind_widget_visible_height = 10; | 22 | +const double _kPreviousPageVisibleOffset = 10; |
23 | 23 | ||
24 | -const Radius _default_top_radius = Radius.circular(12); | ||
25 | -const BoxShadow _default_box_shadow = BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); | 24 | +const Radius _kDefaultTopRadius = Radius.circular(12); |
25 | +const BoxShadow _kDefaultBoxShadow = BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); | ||
26 | 26 | ||
27 | /// Cupertino Bottom Sheet Container | 27 | /// Cupertino Bottom Sheet Container |
28 | /// | 28 | /// |
29 | /// Clip the child widget to rectangle with top rounded corners and adds | 29 | /// Clip the child widget to rectangle with top rounded corners and adds |
30 | -/// top padding(+safe area padding). This padding [_behind_widget_visible_height] | 30 | +/// top padding(+safe area padding). This padding [_kPreviousPageVisibleOffset] |
31 | /// is the height that will be displayed from previous route. | 31 | /// is the height that will be displayed from previous route. |
32 | class _CupertinoBottomSheetContainer extends StatelessWidget { | 32 | class _CupertinoBottomSheetContainer extends StatelessWidget { |
33 | final Widget child; | 33 | final Widget child; |
@@ -47,9 +47,9 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { | @@ -47,9 +47,9 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { | ||
47 | @override | 47 | @override |
48 | Widget build(BuildContext context) { | 48 | Widget build(BuildContext context) { |
49 | final topSafeAreaPadding = MediaQuery.of(context).padding.top; | 49 | final topSafeAreaPadding = MediaQuery.of(context).padding.top; |
50 | - final topPadding = _behind_widget_visible_height + topSafeAreaPadding; | 50 | + final topPadding = _kPreviousPageVisibleOffset + topSafeAreaPadding; |
51 | 51 | ||
52 | - final _shadow = shadow ?? _default_box_shadow; | 52 | + final _shadow = shadow ?? _kDefaultBoxShadow; |
53 | BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); | 53 | BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); |
54 | final _backgroundColor = | 54 | final _backgroundColor = |
55 | backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor; | 55 | backgroundColor ?? CupertinoTheme.of(context).scaffoldBackgroundColor; |
@@ -89,7 +89,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | @@ -89,7 +89,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({ | ||
89 | bool bounce = true, | 89 | bool bounce = true, |
90 | bool? isDismissible, | 90 | bool? isDismissible, |
91 | bool enableDrag = true, | 91 | bool enableDrag = true, |
92 | - Radius topRadius = _default_top_radius, | 92 | + Radius topRadius = _kDefaultTopRadius, |
93 | Duration? duration, | 93 | Duration? duration, |
94 | RouteSettings? settings, | 94 | RouteSettings? settings, |
95 | Color? transitionBackgroundColor, | 95 | Color? transitionBackgroundColor, |
@@ -169,9 +169,9 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -169,9 +169,9 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
169 | Duration? duration, | 169 | Duration? duration, |
170 | RouteSettings? settings, | 170 | RouteSettings? settings, |
171 | ScrollController? scrollController, | 171 | ScrollController? scrollController, |
172 | - this.boxShadow = _default_box_shadow, | 172 | + this.boxShadow = _kDefaultBoxShadow, |
173 | this.transitionBackgroundColor, | 173 | this.transitionBackgroundColor, |
174 | - this.topRadius = _default_top_radius, | 174 | + this.topRadius = _kDefaultTopRadius, |
175 | this.previousRouteAnimationCurve, | 175 | this.previousRouteAnimationCurve, |
176 | }) : assert(expanded != null), | 176 | }) : assert(expanded != null), |
177 | assert(isDismissible != null), | 177 | assert(isDismissible != null), |
@@ -202,7 +202,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | @@ -202,7 +202,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> { | ||
202 | ) { | 202 | ) { |
203 | final paddingTop = MediaQuery.of(context).padding.top; | 203 | final paddingTop = MediaQuery.of(context).padding.top; |
204 | final distanceWithScale = | 204 | final distanceWithScale = |
205 | - (paddingTop + _behind_widget_visible_height) * 0.9; | 205 | + (paddingTop + _kPreviousPageVisibleOffset) * 0.9; |
206 | final offsetY = secondaryAnimation.value * (paddingTop - distanceWithScale); | 206 | final offsetY = secondaryAnimation.value * (paddingTop - distanceWithScale); |
207 | final scale = 1 - secondaryAnimation.value / 10; | 207 | final scale = 1 - secondaryAnimation.value / 10; |
208 | return AnimatedBuilder( | 208 | return AnimatedBuilder( |
@@ -331,7 +331,7 @@ class CupertinoScaffold extends StatefulWidget { | @@ -331,7 +331,7 @@ class CupertinoScaffold extends StatefulWidget { | ||
331 | const CupertinoScaffold({ | 331 | const CupertinoScaffold({ |
332 | Key? key, | 332 | Key? key, |
333 | required this.body, | 333 | required this.body, |
334 | - this.topRadius = _default_top_radius, | 334 | + this.topRadius = _kDefaultTopRadius, |
335 | this.transitionBackgroundColor = Colors.black, | 335 | this.transitionBackgroundColor = Colors.black, |
336 | }) : super(key: key); | 336 | }) : super(key: key); |
337 | 337 | ||
@@ -377,7 +377,7 @@ class CupertinoScaffold extends StatefulWidget { | @@ -377,7 +377,7 @@ class CupertinoScaffold extends StatefulWidget { | ||
377 | containerBuilder: (context, _, child) => _CupertinoBottomSheetContainer( | 377 | containerBuilder: (context, _, child) => _CupertinoBottomSheetContainer( |
378 | child: child, | 378 | child: child, |
379 | backgroundColor: backgroundColor, | 379 | backgroundColor: backgroundColor, |
380 | - topRadius: topRadius ?? _default_top_radius, | 380 | + topRadius: topRadius ?? _kDefaultTopRadius, |
381 | shadow: shadow, | 381 | shadow: shadow, |
382 | ), | 382 | ), |
383 | expanded: expand, | 383 | expanded: expand, |
@@ -386,7 +386,7 @@ class CupertinoScaffold extends StatefulWidget { | @@ -386,7 +386,7 @@ class CupertinoScaffold extends StatefulWidget { | ||
386 | isDismissible: isDismissible ?? expand == false ? true : false, | 386 | isDismissible: isDismissible ?? expand == false ? true : false, |
387 | modalBarrierColor: barrierColor ?? Colors.black12, | 387 | modalBarrierColor: barrierColor ?? Colors.black12, |
388 | enableDrag: enableDrag, | 388 | enableDrag: enableDrag, |
389 | - topRadius: topRadius ?? _default_top_radius, | 389 | + topRadius: topRadius ?? _kDefaultTopRadius, |
390 | animationCurve: animationCurve, | 390 | animationCurve: animationCurve, |
391 | previousRouteAnimationCurve: previousRouteAnimationCurve, | 391 | previousRouteAnimationCurve: previousRouteAnimationCurve, |
392 | duration: duration, | 392 | duration: duration, |
-
Please register or login to post a comment