@@ -11,6 +11,7 @@ import 'color_scheme.dart';
1111import 'colors.dart' ;
1212import 'debug.dart' ;
1313import 'dialog_theme.dart' ;
14+ import 'elevation_overlay.dart' ;
1415import 'ink_well.dart' ;
1516import 'material.dart' ;
1617import 'material_localizations.dart' ;
@@ -45,17 +46,14 @@ class Dialog extends StatelessWidget {
4546 super .key,
4647 this .backgroundColor,
4748 this .elevation,
48- this .shadowColor,
49- this .surfaceTintColor,
5049 this .insetAnimationDuration = const Duration (milliseconds: 100 ),
5150 this .insetAnimationCurve = Curves .decelerate,
5251 this .insetPadding = _defaultInsetPadding,
5352 this .clipBehavior = Clip .none,
5453 this .shape,
5554 this .alignment,
5655 this .child,
57- }) : assert (clipBehavior != null ),
58- assert (elevation == null || elevation >= 0.0 );
56+ }) : assert (clipBehavior != null );
5957
6058 /// {@template flutter.material.dialog.backgroundColor}
6159 /// The background color of the surface of this [Dialog] .
@@ -69,53 +67,12 @@ class Dialog extends StatelessWidget {
6967 /// {@template flutter.material.dialog.elevation}
7068 /// The z-coordinate of this [Dialog] .
7169 ///
72- /// Controls how far above the parent the dialog will appear. Elevation is
73- /// represented by a drop shadow if [shadowColor] is non null,
74- /// and a surface tint overlay on the background color if [surfaceTintColor] is
75- /// non null.
76- ///
77- /// If null then [DialogTheme.elevation] is used, and if that is null then
78- /// the elevation will match the Material Design specification for Dialogs.
79- ///
80- /// See also:
81- /// * [Material.elevation] , which describes how [elevation] effects the
82- /// drop shadow or surface tint overlay.
83- /// * [shadowColor] , color of the drop shadow used to indicate the elevation.
84- /// * [surfaceTintColor] , color of an overlay on top of the background
85- /// color used to indicate the elevation.
86- /// * <https://m3.material.io/components/dialogs/overview>, the Material
87- /// Design specification for dialogs.
70+ /// If null then [DialogTheme.elevation] is used, and if that's null then the
71+ /// dialog's elevation is 24.0.
8872 /// {@endtemplate}
73+ /// {@macro flutter.material.material.elevation}
8974 final double ? elevation;
9075
91- /// {@template flutter.material.dialog.shadowColor}
92- /// The color to paint the [elevation] shadow under the dialog's [Material] .
93- ///
94- /// If null then no drop shadow will be painted.
95- ///
96- /// See also:
97- /// * [Material.shadowColor] , which describes how the drop shadow is painted.
98- /// * [elevation] , effects how the drop shadow is painted.
99- /// * [surfaceTintColor] , if non-null will also provide a surface tint
100- /// overlay on the background color to indicate elevation.
101- /// {@endtemplate}
102- final Color ? shadowColor;
103-
104- /// {@template flutter.material.dialog.surfaceTintColor}
105- /// The color used as a surface tint overlay on the dialog's background color,
106- /// which reflects the dialog's [elevation] .
107- ///
108- /// If null then no surface tint will be applied.
109- ///
110- /// See also:
111- /// * [Material.surfaceTintColor] , which describes how the surface tint will
112- /// be applied to the background color of the dialog.
113- /// * [elevation] , effects the opacity of the surface tint.
114- /// * [shadowColor] , if non-null will also provide a drop shadow to
115- /// indicate elevation.
116- /// {@endtemplate}
117- final Color ? surfaceTintColor;
118-
11976 /// {@template flutter.material.dialog.insetAnimationDuration}
12077 /// The duration of the animation to show when the system keyboard intrudes
12178 /// into the space that the dialog is placed in.
@@ -198,8 +155,6 @@ class Dialog extends StatelessWidget {
198155 child: Material (
199156 color: backgroundColor ?? dialogTheme.backgroundColor ?? Theme .of (context).dialogBackgroundColor,
200157 elevation: elevation ?? dialogTheme.elevation ?? defaults.elevation! ,
201- shadowColor: shadowColor ?? dialogTheme.shadowColor ?? defaults.shadowColor,
202- surfaceTintColor: surfaceTintColor ?? dialogTheme.surfaceTintColor ?? defaults.surfaceTintColor,
203158 shape: shape ?? dialogTheme.shape ?? defaults.shape! ,
204159 type: MaterialType .card,
205160 clipBehavior: clipBehavior,
@@ -325,8 +280,6 @@ class AlertDialog extends StatelessWidget {
325280 this .buttonPadding,
326281 this .backgroundColor,
327282 this .elevation,
328- this .shadowColor,
329- this .surfaceTintColor,
330283 this .semanticLabel,
331284 this .insetPadding = _defaultInsetPadding,
332285 this .clipBehavior = Clip .none,
@@ -525,14 +478,9 @@ class AlertDialog extends StatelessWidget {
525478 final Color ? backgroundColor;
526479
527480 /// {@macro flutter.material.dialog.elevation}
481+ /// {@macro flutter.material.material.elevation}
528482 final double ? elevation;
529483
530- /// {@macro flutter.material.dialog.shadowColor}
531- final Color ? shadowColor;
532-
533- /// {@macro flutter.material.dialog.surfaceTintColor}
534- final Color ? surfaceTintColor;
535-
536484 /// The semantic label of the dialog used by accessibility frameworks to
537485 /// announce screen transitions when the dialog is opened and closed.
538486 ///
@@ -747,8 +695,6 @@ class AlertDialog extends StatelessWidget {
747695 return Dialog (
748696 backgroundColor: backgroundColor,
749697 elevation: elevation,
750- shadowColor: shadowColor,
751- surfaceTintColor: surfaceTintColor,
752698 insetPadding: insetPadding,
753699 clipBehavior: clipBehavior,
754700 shape: shape,
@@ -914,8 +860,6 @@ class SimpleDialog extends StatelessWidget {
914860 this .contentPadding = const EdgeInsets .fromLTRB (0.0 , 12.0 , 0.0 , 16.0 ),
915861 this .backgroundColor,
916862 this .elevation,
917- this .shadowColor,
918- this .surfaceTintColor,
919863 this .semanticLabel,
920864 this .insetPadding = _defaultInsetPadding,
921865 this .clipBehavior = Clip .none,
@@ -971,14 +915,9 @@ class SimpleDialog extends StatelessWidget {
971915 final Color ? backgroundColor;
972916
973917 /// {@macro flutter.material.dialog.elevation}
918+ /// {@macro flutter.material.material.elevation}
974919 final double ? elevation;
975920
976- /// {@macro flutter.material.dialog.shadowColor}
977- final Color ? shadowColor;
978-
979- /// {@macro flutter.material.dialog.surfaceTintColor}
980- final Color ? surfaceTintColor;
981-
982921 /// The semantic label of the dialog used by accessibility frameworks to
983922 /// announce screen transitions when the dialog is opened and closed.
984923 ///
@@ -1092,8 +1031,6 @@ class SimpleDialog extends StatelessWidget {
10921031 return Dialog (
10931032 backgroundColor: backgroundColor,
10941033 elevation: elevation,
1095- shadowColor: shadowColor,
1096- surfaceTintColor: surfaceTintColor,
10971034 insetPadding: insetPadding,
10981035 clipBehavior: clipBehavior,
10991036 shape: shape,
@@ -1359,9 +1296,6 @@ class _DialogDefaultsM2 extends DialogTheme {
13591296 @override
13601297 Color ? get backgroundColor => Theme .of (context).dialogBackgroundColor;
13611298
1362- @override
1363- Color ? get shadowColor => Theme .of (context).shadowColor;
1364-
13651299 @override
13661300 TextStyle ? get titleTextStyle => _textTheme.headline6;
13671301
@@ -1396,11 +1330,9 @@ class _DialogDefaultsM3 extends DialogTheme {
13961330 @override
13971331 Color ? get iconColor => _colors.secondary;
13981332
1333+ // TODO(darrenaustin): overlay should be handled by Material widget: https://github.com/flutter/flutter/issues/9160
13991334 @override
1400- Color ? get backgroundColor => _colors.surface;
1401-
1402- @override
1403- Color ? get surfaceTintColor => _colors.surfaceTint;
1335+ Color ? get backgroundColor => ElevationOverlay .colorWithOverlay (_colors.surface, _colors.primary, 6.0 );
14041336
14051337 @override
14061338 TextStyle ? get titleTextStyle => _textTheme.headlineSmall;
0 commit comments