Commit 645c3231 authored by Sebastian Döll's avatar Sebastian Döll Committed by Darren Austin

Set modal bottom sheet barrier color (#45067)

parent 5469804c
......@@ -344,6 +344,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
this.elevation,
this.shape,
this.clipBehavior,
this.modalBarrierColor,
this.isDismissible = true,
@required this.isScrollControlled,
RouteSettings settings,
......@@ -358,6 +359,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
final double elevation;
final ShapeBorder shape;
final Clip clipBehavior;
final Color modalBarrierColor;
final bool isDismissible;
@override
......@@ -370,7 +372,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
final String barrierLabel;
@override
Color get barrierColor => Colors.black54;
Color get barrierColor => modalBarrierColor ?? Colors.black54;
AnimationController _animationController;
......@@ -501,6 +503,7 @@ Future<T> showModalBottomSheet<T>({
double elevation,
ShapeBorder shape,
Clip clipBehavior,
Color barrierColor,
bool isScrollControlled = false,
bool useRootNavigator = false,
bool isDismissible = true,
......@@ -523,6 +526,7 @@ Future<T> showModalBottomSheet<T>({
shape: shape,
clipBehavior: clipBehavior,
isDismissible: isDismissible,
modalBarrierColor: barrierColor
));
}
......
......@@ -342,6 +342,7 @@ void main() {
const double elevation = 9.0;
final ShapeBorder shape = BeveledRectangleBorder(borderRadius: BorderRadius.circular(12));
const Clip clipBehavior = Clip.antiAlias;
const Color barrierColor = Colors.red;
await tester.pumpWidget(MaterialApp(
home: Scaffold(
......@@ -353,6 +354,7 @@ void main() {
showModalBottomSheet<void>(
context: scaffoldKey.currentContext,
backgroundColor: color,
barrierColor: barrierColor,
elevation: elevation,
shape: shape,
clipBehavior: clipBehavior,
......@@ -371,6 +373,9 @@ void main() {
expect(bottomSheet.elevation, elevation);
expect(bottomSheet.shape, shape);
expect(bottomSheet.clipBehavior, clipBehavior);
final ModalBarrier modalBarrier = tester.widget(find.byType(ModalBarrier).last);
expect(modalBarrier.color, barrierColor);
});
testWidgets('modal BottomSheet with scrollController has semantics', (WidgetTester tester) async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment