diff --git a/dev/tools/gen_defaults/lib/dialog_template.dart b/dev/tools/gen_defaults/lib/dialog_template.dart index edeb132dab..62d5ab29b3 100644 --- a/dev/tools/gen_defaults/lib/dialog_template.dart +++ b/dev/tools/gen_defaults/lib/dialog_template.dart @@ -34,9 +34,6 @@ class _TokenDefaultsM3 extends DialogTheme { @override TextStyle? get contentTextStyle => ${textStyle("md.comp.dialog.supporting-text")}; - - @override - EdgeInsetsGeometry? get actionsPadding => const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0); } '''; } diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index 9fce42469d..4986177e88 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -554,10 +554,11 @@ class AlertDialog extends StatelessWidget { if (actions != null) { final double spacing = (buttonPadding?.horizontal ?? 16) / 2; + final EdgeInsetsGeometry effetiveActionsPadding = (actionsPadding ?? EdgeInsets.zero).add( + theme.useMaterial3 ? const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0) : EdgeInsets.all(spacing), + ); actionsWidget = Padding( - padding: actionsPadding ?? dialogTheme.actionsPadding ?? ( - theme.useMaterial3 ? defaults.actionsPadding! : defaults.actionsPadding!.add(EdgeInsets.all(spacing)) - ), + padding: effetiveActionsPadding, child: OverflowBar( alignment: actionsAlignment ?? MainAxisAlignment.end, spacing: spacing, @@ -1202,9 +1203,6 @@ class _DefaultsM2 extends DialogTheme { @override TextStyle? get contentTextStyle => _textTheme.subtitle1; - - @override - EdgeInsetsGeometry? get actionsPadding => EdgeInsets.zero; } // BEGIN GENERATED TOKEN PROPERTIES @@ -1235,9 +1233,6 @@ class _TokenDefaultsM3 extends DialogTheme { @override TextStyle? get contentTextStyle => _textTheme.bodyMedium; - - @override - EdgeInsetsGeometry? get actionsPadding => const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0); } // END GENERATED TOKEN PROPERTIES diff --git a/packages/flutter/lib/src/material/dialog_theme.dart b/packages/flutter/lib/src/material/dialog_theme.dart index d18aa64947..aa93e68943 100644 --- a/packages/flutter/lib/src/material/dialog_theme.dart +++ b/packages/flutter/lib/src/material/dialog_theme.dart @@ -34,7 +34,6 @@ class DialogTheme with Diagnosticable { this.alignment, this.titleTextStyle, this.contentTextStyle, - this.actionsPadding, }); /// Overrides the default value for [Dialog.backgroundColor]. @@ -57,9 +56,6 @@ class DialogTheme with Diagnosticable { /// [AlertDialog.content]. final TextStyle? contentTextStyle; - /// Overrides the default value for [AlertDialog.actionsPadding]. - final EdgeInsetsGeometry? actionsPadding; - /// Creates a copy of this object but with the given fields replaced with the /// new values. DialogTheme copyWith({ @@ -69,7 +65,6 @@ class DialogTheme with Diagnosticable { AlignmentGeometry? alignment, TextStyle? titleTextStyle, TextStyle? contentTextStyle, - EdgeInsetsGeometry? actionsPadding, }) { return DialogTheme( backgroundColor: backgroundColor ?? this.backgroundColor, @@ -78,7 +73,6 @@ class DialogTheme with Diagnosticable { alignment: alignment ?? this.alignment, titleTextStyle: titleTextStyle ?? this.titleTextStyle, contentTextStyle: contentTextStyle ?? this.contentTextStyle, - actionsPadding: actionsPadding ?? this.actionsPadding, ); } @@ -101,7 +95,6 @@ class DialogTheme with Diagnosticable { alignment: AlignmentGeometry.lerp(a?.alignment, b?.alignment, t), titleTextStyle: TextStyle.lerp(a?.titleTextStyle, b?.titleTextStyle, t), contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t), - actionsPadding: EdgeInsetsGeometry.lerp(a?.actionsPadding, b?.actionsPadding, t), ); } @@ -122,8 +115,7 @@ class DialogTheme with Diagnosticable { && other.shape == shape && other.alignment == alignment && other.titleTextStyle == titleTextStyle - && other.contentTextStyle == contentTextStyle - && other.actionsPadding == actionsPadding; + && other.contentTextStyle == contentTextStyle; } @override @@ -135,6 +127,5 @@ class DialogTheme with Diagnosticable { properties.add(DiagnosticsProperty('alignment', alignment, defaultValue: null)); properties.add(DiagnosticsProperty('titleTextStyle', titleTextStyle, defaultValue: null)); properties.add(DiagnosticsProperty('contentTextStyle', contentTextStyle, defaultValue: null)); - properties.add(DiagnosticsProperty('actionsPadding', actionsPadding, defaultValue: null)); } } diff --git a/packages/flutter/test/material/dialog_theme_test.dart b/packages/flutter/test/material/dialog_theme_test.dart index 7380f20698..a9d573e9b9 100644 --- a/packages/flutter/test/material/dialog_theme_test.dart +++ b/packages/flutter/test/material/dialog_theme_test.dart @@ -54,7 +54,6 @@ void main() { alignment: Alignment.bottomLeft, titleTextStyle: TextStyle(color: Color(0xffffffff)), contentTextStyle: TextStyle(color: Color(0xff000000)), - actionsPadding: EdgeInsets.all(8.0), ).debugFillProperties(builder); final List description = builder.properties .where((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info)) @@ -65,7 +64,6 @@ void main() { 'alignment: Alignment.bottomLeft', 'titleTextStyle: TextStyle(inherit: true, color: Color(0xffffffff))', 'contentTextStyle: TextStyle(inherit: true, color: Color(0xff000000))', - 'actionsPadding: EdgeInsets.all(8.0)', ]); });