Showing
1 changed file
with
11 additions
and
3 deletions
@@ -16,6 +16,11 @@ import '../bottom_sheet_route.dart'; | @@ -16,6 +16,11 @@ import '../bottom_sheet_route.dart'; | ||
16 | 16 | ||
17 | const double _behind_widget_visible_height = 10; | 17 | const double _behind_widget_visible_height = 10; |
18 | 18 | ||
19 | +const BorderRadius _default_border_radius = BorderRadius.only( | ||
20 | + topLeft: Radius.circular(12), | ||
21 | + topRight: Radius.circular(12), | ||
22 | +); | ||
23 | + | ||
19 | /// Cupertino Bottom Sheet Container | 24 | /// Cupertino Bottom Sheet Container |
20 | /// | 25 | /// |
21 | /// Clip the child widget to rectangle with top rounded corners and adds | 26 | /// Clip the child widget to rectangle with top rounded corners and adds |
@@ -24,16 +29,17 @@ const double _behind_widget_visible_height = 10; | @@ -24,16 +29,17 @@ const double _behind_widget_visible_height = 10; | ||
24 | class _CupertinoBottomSheetContainer extends StatelessWidget { | 29 | class _CupertinoBottomSheetContainer extends StatelessWidget { |
25 | final Widget child; | 30 | final Widget child; |
26 | final Color backgroundColor; | 31 | final Color backgroundColor; |
32 | + final BorderRadius borderRadius; | ||
27 | 33 | ||
28 | const _CupertinoBottomSheetContainer( | 34 | const _CupertinoBottomSheetContainer( |
29 | - {Key key, this.child, this.backgroundColor}) | 35 | + {Key key, this.child, this.backgroundColor, this.borderRadius}) |
30 | : super(key: key); | 36 | : super(key: key); |
31 | 37 | ||
32 | @override | 38 | @override |
33 | Widget build(BuildContext context) { | 39 | Widget build(BuildContext context) { |
34 | final topSafeAreaPadding = MediaQuery.of(context).padding.top; | 40 | final topSafeAreaPadding = MediaQuery.of(context).padding.top; |
35 | final topPadding = _behind_widget_visible_height + topSafeAreaPadding; | 41 | final topPadding = _behind_widget_visible_height + topSafeAreaPadding; |
36 | - final radius = Radius.circular(12); | 42 | + |
37 | final shadow = | 43 | final shadow = |
38 | BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); | 44 | BoxShadow(blurRadius: 10, color: Colors.black12, spreadRadius: 5); |
39 | final _backgroundColor = | 45 | final _backgroundColor = |
@@ -41,7 +47,7 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { | @@ -41,7 +47,7 @@ class _CupertinoBottomSheetContainer extends StatelessWidget { | ||
41 | return Padding( | 47 | return Padding( |
42 | padding: EdgeInsets.only(top: topPadding), | 48 | padding: EdgeInsets.only(top: topPadding), |
43 | child: ClipRRect( | 49 | child: ClipRRect( |
44 | - borderRadius: BorderRadius.only(topLeft: radius, topRight: radius), | 50 | + borderRadius: borderRadius, |
45 | child: Container( | 51 | child: Container( |
46 | decoration: | 52 | decoration: |
47 | BoxDecoration(color: _backgroundColor, boxShadow: [shadow]), | 53 | BoxDecoration(color: _backgroundColor, boxShadow: [shadow]), |
@@ -63,6 +69,7 @@ Future<T> showCupertinoModalBottomSheet<T>({ | @@ -63,6 +69,7 @@ Future<T> showCupertinoModalBottomSheet<T>({ | ||
63 | Color backgroundColor, | 69 | Color backgroundColor, |
64 | double elevation, | 70 | double elevation, |
65 | ShapeBorder shape, | 71 | ShapeBorder shape, |
72 | + BorderRadius borderRadius = _default_border_radius, | ||
66 | Clip clipBehavior, | 73 | Clip clipBehavior, |
67 | Color barrierColor, | 74 | Color barrierColor, |
68 | bool expand = false, | 75 | bool expand = false, |
@@ -85,6 +92,7 @@ Future<T> showCupertinoModalBottomSheet<T>({ | @@ -85,6 +92,7 @@ Future<T> showCupertinoModalBottomSheet<T>({ | ||
85 | containerBuilder: (context, _, child) => _CupertinoBottomSheetContainer( | 92 | containerBuilder: (context, _, child) => _CupertinoBottomSheetContainer( |
86 | child: child, | 93 | child: child, |
87 | backgroundColor: backgroundColor, | 94 | backgroundColor: backgroundColor, |
95 | + borderRadius: borderRadius, | ||
88 | ), | 96 | ), |
89 | secondAnimationController: secondAnimation, | 97 | secondAnimationController: secondAnimation, |
90 | expanded: expand, | 98 | expanded: expand, |
-
Please register or login to post a comment