Skip to content

Commit c4a6ab1

Browse files
authored
Revert "Add actionsPadding to dialog theme (#105109)" (#105293)
This reverts commit 5d10cf5.
1 parent 9929446 commit c4a6ab1

File tree

4 files changed

+5
-24
lines changed

4 files changed

+5
-24
lines changed

dev/tools/gen_defaults/lib/dialog_template.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ class _TokenDefaultsM3 extends DialogTheme {
3434
3535
@override
3636
TextStyle? get contentTextStyle => ${textStyle("md.comp.dialog.supporting-text")};
37-
38-
@override
39-
EdgeInsetsGeometry? get actionsPadding => const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0);
4037
}
4138
''';
4239
}

packages/flutter/lib/src/material/dialog.dart

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,11 @@ class AlertDialog extends StatelessWidget {
554554

555555
if (actions != null) {
556556
final double spacing = (buttonPadding?.horizontal ?? 16) / 2;
557+
final EdgeInsetsGeometry effetiveActionsPadding = (actionsPadding ?? EdgeInsets.zero).add(
558+
theme.useMaterial3 ? const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0) : EdgeInsets.all(spacing),
559+
);
557560
actionsWidget = Padding(
558-
padding: actionsPadding ?? dialogTheme.actionsPadding ?? (
559-
theme.useMaterial3 ? defaults.actionsPadding! : defaults.actionsPadding!.add(EdgeInsets.all(spacing))
560-
),
561+
padding: effetiveActionsPadding,
561562
child: OverflowBar(
562563
alignment: actionsAlignment ?? MainAxisAlignment.end,
563564
spacing: spacing,
@@ -1202,9 +1203,6 @@ class _DefaultsM2 extends DialogTheme {
12021203

12031204
@override
12041205
TextStyle? get contentTextStyle => _textTheme.subtitle1;
1205-
1206-
@override
1207-
EdgeInsetsGeometry? get actionsPadding => EdgeInsets.zero;
12081206
}
12091207

12101208
// BEGIN GENERATED TOKEN PROPERTIES
@@ -1235,9 +1233,6 @@ class _TokenDefaultsM3 extends DialogTheme {
12351233

12361234
@override
12371235
TextStyle? get contentTextStyle => _textTheme.bodyMedium;
1238-
1239-
@override
1240-
EdgeInsetsGeometry? get actionsPadding => const EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0);
12411236
}
12421237

12431238
// END GENERATED TOKEN PROPERTIES

packages/flutter/lib/src/material/dialog_theme.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class DialogTheme with Diagnosticable {
3434
this.alignment,
3535
this.titleTextStyle,
3636
this.contentTextStyle,
37-
this.actionsPadding,
3837
});
3938

4039
/// Overrides the default value for [Dialog.backgroundColor].
@@ -57,9 +56,6 @@ class DialogTheme with Diagnosticable {
5756
/// [AlertDialog.content].
5857
final TextStyle? contentTextStyle;
5958

60-
/// Overrides the default value for [AlertDialog.actionsPadding].
61-
final EdgeInsetsGeometry? actionsPadding;
62-
6359
/// Creates a copy of this object but with the given fields replaced with the
6460
/// new values.
6561
DialogTheme copyWith({
@@ -69,7 +65,6 @@ class DialogTheme with Diagnosticable {
6965
AlignmentGeometry? alignment,
7066
TextStyle? titleTextStyle,
7167
TextStyle? contentTextStyle,
72-
EdgeInsetsGeometry? actionsPadding,
7368
}) {
7469
return DialogTheme(
7570
backgroundColor: backgroundColor ?? this.backgroundColor,
@@ -78,7 +73,6 @@ class DialogTheme with Diagnosticable {
7873
alignment: alignment ?? this.alignment,
7974
titleTextStyle: titleTextStyle ?? this.titleTextStyle,
8075
contentTextStyle: contentTextStyle ?? this.contentTextStyle,
81-
actionsPadding: actionsPadding ?? this.actionsPadding,
8276
);
8377
}
8478

@@ -101,7 +95,6 @@ class DialogTheme with Diagnosticable {
10195
alignment: AlignmentGeometry.lerp(a?.alignment, b?.alignment, t),
10296
titleTextStyle: TextStyle.lerp(a?.titleTextStyle, b?.titleTextStyle, t),
10397
contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t),
104-
actionsPadding: EdgeInsetsGeometry.lerp(a?.actionsPadding, b?.actionsPadding, t),
10598
);
10699
}
107100

@@ -122,8 +115,7 @@ class DialogTheme with Diagnosticable {
122115
&& other.shape == shape
123116
&& other.alignment == alignment
124117
&& other.titleTextStyle == titleTextStyle
125-
&& other.contentTextStyle == contentTextStyle
126-
&& other.actionsPadding == actionsPadding;
118+
&& other.contentTextStyle == contentTextStyle;
127119
}
128120

129121
@override
@@ -135,6 +127,5 @@ class DialogTheme with Diagnosticable {
135127
properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, defaultValue: null));
136128
properties.add(DiagnosticsProperty<TextStyle>('titleTextStyle', titleTextStyle, defaultValue: null));
137129
properties.add(DiagnosticsProperty<TextStyle>('contentTextStyle', contentTextStyle, defaultValue: null));
138-
properties.add(DiagnosticsProperty<EdgeInsetsGeometry>('actionsPadding', actionsPadding, defaultValue: null));
139130
}
140131
}

packages/flutter/test/material/dialog_theme_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ void main() {
5454
alignment: Alignment.bottomLeft,
5555
titleTextStyle: TextStyle(color: Color(0xffffffff)),
5656
contentTextStyle: TextStyle(color: Color(0xff000000)),
57-
actionsPadding: EdgeInsets.all(8.0),
5857
).debugFillProperties(builder);
5958
final List<String> description = builder.properties
6059
.where((DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info))
@@ -65,7 +64,6 @@ void main() {
6564
'alignment: Alignment.bottomLeft',
6665
'titleTextStyle: TextStyle(inherit: true, color: Color(0xffffffff))',
6766
'contentTextStyle: TextStyle(inherit: true, color: Color(0xff000000))',
68-
'actionsPadding: EdgeInsets.all(8.0)',
6967
]);
7068
});
7169

0 commit comments

Comments
 (0)