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> { ...@@ -344,6 +344,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
this.elevation, this.elevation,
this.shape, this.shape,
this.clipBehavior, this.clipBehavior,
this.modalBarrierColor,
this.isDismissible = true, this.isDismissible = true,
@required this.isScrollControlled, @required this.isScrollControlled,
RouteSettings settings, RouteSettings settings,
...@@ -358,6 +359,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> { ...@@ -358,6 +359,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
final double elevation; final double elevation;
final ShapeBorder shape; final ShapeBorder shape;
final Clip clipBehavior; final Clip clipBehavior;
final Color modalBarrierColor;
final bool isDismissible; final bool isDismissible;
@override @override
...@@ -370,7 +372,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> { ...@@ -370,7 +372,7 @@ class _ModalBottomSheetRoute<T> extends PopupRoute<T> {
final String barrierLabel; final String barrierLabel;
@override @override
Color get barrierColor => Colors.black54; Color get barrierColor => modalBarrierColor ?? Colors.black54;
AnimationController _animationController; AnimationController _animationController;
...@@ -501,6 +503,7 @@ Future<T> showModalBottomSheet<T>({ ...@@ -501,6 +503,7 @@ Future<T> showModalBottomSheet<T>({
double elevation, double elevation,
ShapeBorder shape, ShapeBorder shape,
Clip clipBehavior, Clip clipBehavior,
Color barrierColor,
bool isScrollControlled = false, bool isScrollControlled = false,
bool useRootNavigator = false, bool useRootNavigator = false,
bool isDismissible = true, bool isDismissible = true,
...@@ -523,6 +526,7 @@ Future<T> showModalBottomSheet<T>({ ...@@ -523,6 +526,7 @@ Future<T> showModalBottomSheet<T>({
shape: shape, shape: shape,
clipBehavior: clipBehavior, clipBehavior: clipBehavior,
isDismissible: isDismissible, isDismissible: isDismissible,
modalBarrierColor: barrierColor
)); ));
} }
......
...@@ -342,6 +342,7 @@ void main() { ...@@ -342,6 +342,7 @@ void main() {
const double elevation = 9.0; const double elevation = 9.0;
final ShapeBorder shape = BeveledRectangleBorder(borderRadius: BorderRadius.circular(12)); final ShapeBorder shape = BeveledRectangleBorder(borderRadius: BorderRadius.circular(12));
const Clip clipBehavior = Clip.antiAlias; const Clip clipBehavior = Clip.antiAlias;
const Color barrierColor = Colors.red;
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
home: Scaffold( home: Scaffold(
...@@ -353,6 +354,7 @@ void main() { ...@@ -353,6 +354,7 @@ void main() {
showModalBottomSheet<void>( showModalBottomSheet<void>(
context: scaffoldKey.currentContext, context: scaffoldKey.currentContext,
backgroundColor: color, backgroundColor: color,
barrierColor: barrierColor,
elevation: elevation, elevation: elevation,
shape: shape, shape: shape,
clipBehavior: clipBehavior, clipBehavior: clipBehavior,
...@@ -371,6 +373,9 @@ void main() { ...@@ -371,6 +373,9 @@ void main() {
expect(bottomSheet.elevation, elevation); expect(bottomSheet.elevation, elevation);
expect(bottomSheet.shape, shape); expect(bottomSheet.shape, shape);
expect(bottomSheet.clipBehavior, clipBehavior); 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 { 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