Showing
1 changed file
with
29 additions
and
22 deletions
@@ -10,11 +10,18 @@ const Radius _default_bar_top_radius = Radius.circular(15); | @@ -10,11 +10,18 @@ const Radius _default_bar_top_radius = Radius.circular(15); | ||
10 | 10 | ||
11 | class BarBottomSheet extends StatelessWidget { | 11 | class BarBottomSheet extends StatelessWidget { |
12 | final Widget child; | 12 | final Widget child; |
13 | - final Widget topControl; | ||
14 | - final Radius topRadius; | 13 | + final Widget control; |
14 | + final Clip clipBehavior; | ||
15 | + final double elevation; | ||
16 | + final ShapeBorder shape; | ||
15 | 17 | ||
16 | const BarBottomSheet( | 18 | const BarBottomSheet( |
17 | - {Key key, this.child, this.topControl, @required this.topRadius}) | 19 | + {Key key, |
20 | + this.child, | ||
21 | + this.control, | ||
22 | + this.clipBehavior, | ||
23 | + this.shape, | ||
24 | + this.elevation}) | ||
18 | : super(key: key); | 25 | : super(key: key); |
19 | 26 | ||
20 | @override | 27 | @override |
@@ -28,7 +35,7 @@ class BarBottomSheet extends StatelessWidget { | @@ -28,7 +35,7 @@ class BarBottomSheet extends StatelessWidget { | ||
28 | SizedBox(height: 12), | 35 | SizedBox(height: 12), |
29 | SafeArea( | 36 | SafeArea( |
30 | bottom: false, | 37 | bottom: false, |
31 | - child: topControl ?? | 38 | + child: control ?? |
32 | Container( | 39 | Container( |
33 | height: 6, | 40 | height: 6, |
34 | width: 40, | 41 | width: 40, |
@@ -41,21 +48,20 @@ class BarBottomSheet extends StatelessWidget { | @@ -41,21 +48,20 @@ class BarBottomSheet extends StatelessWidget { | ||
41 | Flexible( | 48 | Flexible( |
42 | flex: 1, | 49 | flex: 1, |
43 | fit: FlexFit.loose, | 50 | fit: FlexFit.loose, |
44 | - child: ClipRRect( | ||
45 | - borderRadius: | ||
46 | - BorderRadius.only(topLeft: topRadius, topRight: topRadius), | ||
47 | - child: Container( | ||
48 | - decoration: BoxDecoration( | ||
49 | - color: Theme.of(context).scaffoldBackgroundColor, | ||
50 | - boxShadow: [ | ||
51 | - BoxShadow( | ||
52 | - blurRadius: 10, | ||
53 | - color: Colors.black12, | ||
54 | - spreadRadius: 5) | ||
55 | - ]), | ||
56 | - width: double.infinity, | ||
57 | - child: MediaQuery.removePadding( | ||
58 | - context: context, removeTop: true, child: child)), | 51 | + child: Material( |
52 | + shape: RoundedRectangleBorder( | ||
53 | + side: BorderSide(), | ||
54 | + borderRadius: BorderRadius.only( | ||
55 | + topLeft: _default_bar_top_radius, | ||
56 | + topRight: _default_bar_top_radius), | ||
57 | + ), | ||
58 | + clipBehavior: clipBehavior ?? Clip.hardEdge, | ||
59 | + elevation: elevation ?? 2, | ||
60 | + child: SizedBox( | ||
61 | + width: double.infinity, | ||
62 | + child: MediaQuery.removePadding( | ||
63 | + context: context, removeTop: true, child: child), | ||
64 | + ), | ||
59 | ), | 65 | ), |
60 | ), | 66 | ), |
61 | ]), | 67 | ]), |
@@ -78,7 +84,6 @@ Future<T> showBarModalBottomSheet<T>({ | @@ -78,7 +84,6 @@ Future<T> showBarModalBottomSheet<T>({ | ||
78 | bool useRootNavigator = false, | 84 | bool useRootNavigator = false, |
79 | bool isDismissible = true, | 85 | bool isDismissible = true, |
80 | bool enableDrag = true, | 86 | bool enableDrag = true, |
81 | - Radius topRadius = _default_bar_top_radius, | ||
82 | Widget topControl, | 87 | Widget topControl, |
83 | Duration duration, | 88 | Duration duration, |
84 | }) async { | 89 | }) async { |
@@ -96,8 +101,10 @@ Future<T> showBarModalBottomSheet<T>({ | @@ -96,8 +101,10 @@ Future<T> showBarModalBottomSheet<T>({ | ||
96 | bounce: bounce, | 101 | bounce: bounce, |
97 | containerBuilder: (_, __, child) => BarBottomSheet( | 102 | containerBuilder: (_, __, child) => BarBottomSheet( |
98 | child: child, | 103 | child: child, |
99 | - topRadius: topRadius, | ||
100 | - topControl: topControl, | 104 | + control: topControl, |
105 | + clipBehavior: clipBehavior, | ||
106 | + shape: shape, | ||
107 | + elevation: elevation, | ||
101 | ), | 108 | ), |
102 | secondAnimationController: secondAnimation, | 109 | secondAnimationController: secondAnimation, |
103 | expanded: expand, | 110 | expanded: expand, |
-
Please register or login to post a comment