Committed by
GitHub
Merge pull request #50 from Serjobas/feature/bar-bottom-sheet-new-args
New params to add the more customizable look of BarBottomSheet
Showing
1 changed file
with
21 additions
and
11 deletions
@@ -6,10 +6,16 @@ import 'package:flutter/services.dart'; | @@ -6,10 +6,16 @@ import 'package:flutter/services.dart'; | ||
6 | import '../../modal_bottom_sheet.dart'; | 6 | import '../../modal_bottom_sheet.dart'; |
7 | import '../bottom_sheet_route.dart'; | 7 | import '../bottom_sheet_route.dart'; |
8 | 8 | ||
9 | +const Radius _default_bar_top_radius = Radius.circular(15); | ||
10 | + | ||
9 | class BarBottomSheet extends StatelessWidget { | 11 | class BarBottomSheet extends StatelessWidget { |
10 | final Widget child; | 12 | final Widget child; |
13 | + final Widget topControl; | ||
14 | + final Radius topRadius; | ||
11 | 15 | ||
12 | - const BarBottomSheet({Key key, this.child}) : super(key: key); | 16 | + const BarBottomSheet( |
17 | + {Key key, this.child, this.topControl, @required this.topRadius}) | ||
18 | + : super(key: key); | ||
13 | 19 | ||
14 | @override | 20 | @override |
15 | Widget build(BuildContext context) { | 21 | Widget build(BuildContext context) { |
@@ -22,22 +28,22 @@ class BarBottomSheet extends StatelessWidget { | @@ -22,22 +28,22 @@ class BarBottomSheet extends StatelessWidget { | ||
22 | SizedBox(height: 12), | 28 | SizedBox(height: 12), |
23 | SafeArea( | 29 | SafeArea( |
24 | bottom: false, | 30 | bottom: false, |
25 | - child: Container( | ||
26 | - height: 6, | ||
27 | - width: 40, | ||
28 | - decoration: BoxDecoration( | ||
29 | - color: Colors.white, | ||
30 | - borderRadius: BorderRadius.circular(6)), | ||
31 | - ), | 31 | + child: topControl ?? |
32 | + Container( | ||
33 | + height: 6, | ||
34 | + width: 40, | ||
35 | + decoration: BoxDecoration( | ||
36 | + color: Colors.white, | ||
37 | + borderRadius: BorderRadius.circular(6)), | ||
38 | + ), | ||
32 | ), | 39 | ), |
33 | SizedBox(height: 8), | 40 | SizedBox(height: 8), |
34 | Flexible( | 41 | Flexible( |
35 | flex: 1, | 42 | flex: 1, |
36 | fit: FlexFit.loose, | 43 | fit: FlexFit.loose, |
37 | child: ClipRRect( | 44 | child: ClipRRect( |
38 | - borderRadius: BorderRadius.only( | ||
39 | - topLeft: Radius.circular(15), | ||
40 | - topRight: Radius.circular(15)), | 45 | + borderRadius: |
46 | + BorderRadius.only(topLeft: topRadius, topRight: topRadius), | ||
41 | child: Container( | 47 | child: Container( |
42 | decoration: BoxDecoration( | 48 | decoration: BoxDecoration( |
43 | color: Theme.of(context).scaffoldBackgroundColor, | 49 | color: Theme.of(context).scaffoldBackgroundColor, |
@@ -72,6 +78,8 @@ Future<T> showBarModalBottomSheet<T>({ | @@ -72,6 +78,8 @@ Future<T> showBarModalBottomSheet<T>({ | ||
72 | bool useRootNavigator = false, | 78 | bool useRootNavigator = false, |
73 | bool isDismissible = true, | 79 | bool isDismissible = true, |
74 | bool enableDrag = true, | 80 | bool enableDrag = true, |
81 | + Radius topRadius = _default_bar_top_radius, | ||
82 | + Widget topControl, | ||
75 | Duration duration, | 83 | Duration duration, |
76 | }) async { | 84 | }) async { |
77 | assert(context != null); | 85 | assert(context != null); |
@@ -88,6 +96,8 @@ Future<T> showBarModalBottomSheet<T>({ | @@ -88,6 +96,8 @@ Future<T> showBarModalBottomSheet<T>({ | ||
88 | bounce: bounce, | 96 | bounce: bounce, |
89 | containerBuilder: (_, __, child) => BarBottomSheet( | 97 | containerBuilder: (_, __, child) => BarBottomSheet( |
90 | child: child, | 98 | child: child, |
99 | + topRadius: topRadius, | ||
100 | + topControl: topControl, | ||
91 | ), | 101 | ), |
92 | secondAnimationController: secondAnimation, | 102 | secondAnimationController: secondAnimation, |
93 | expanded: expand, | 103 | expanded: expand, |
-
Please register or login to post a comment