Skip to content

Commit 2230c09

Browse files
authored
Remove deprecated parameters from ElevatedButton.styleFrom(), OutlinedButton.styleFrom(), and TextButton.styleFrom() (#139267)
1 parent 9ef1c2b commit 2230c09

4 files changed

Lines changed: 10 additions & 45 deletions

File tree

‎packages/flutter/lib/src/material/elevated_button.dart‎

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -171,29 +171,14 @@ class ElevatedButton extends ButtonStyleButton {
171171
bool? enableFeedback,
172172
AlignmentGeometry? alignment,
173173
InteractiveInkFeatureFactory? splashFactory,
174-
@Deprecated(
175-
'Use backgroundColor instead. '
176-
'This feature was deprecated after v3.1.0.'
177-
)
178-
Color? primary,
179-
@Deprecated(
180-
'Use foregroundColor instead. '
181-
'This feature was deprecated after v3.1.0.'
182-
)
183-
Color? onPrimary,
184-
@Deprecated(
185-
'Use disabledForegroundColor and disabledBackgroundColor instead. '
186-
'This feature was deprecated after v3.1.0.'
187-
)
188-
Color? onSurface,
189174
}) {
190-
final Color? background = backgroundColor ?? primary;
191-
final Color? disabledBackground = disabledBackgroundColor ?? onSurface?.withOpacity(0.12);
175+
final Color? background = backgroundColor;
176+
final Color? disabledBackground = disabledBackgroundColor;
192177
final MaterialStateProperty<Color?>? backgroundColorProp = (background == null && disabledBackground == null)
193178
? null
194179
: _ElevatedButtonDefaultColor(background, disabledBackground);
195-
final Color? foreground = foregroundColor ?? onPrimary;
196-
final Color? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38);
180+
final Color? foreground = foregroundColor;
181+
final Color? disabledForeground = disabledForegroundColor;
197182
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
198183
? null
199184
: _ElevatedButtonDefaultColor(foreground, disabledForeground);

‎packages/flutter/lib/src/material/outlined_button.dart‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,9 @@ class OutlinedButton extends ButtonStyleButton {
158158
bool? enableFeedback,
159159
AlignmentGeometry? alignment,
160160
InteractiveInkFeatureFactory? splashFactory,
161-
@Deprecated(
162-
'Use foregroundColor instead. '
163-
'This feature was deprecated after v3.1.0.'
164-
)
165-
Color? primary,
166-
@Deprecated(
167-
'Use disabledForegroundColor instead. '
168-
'This feature was deprecated after v3.1.0.'
169-
)
170-
Color? onSurface,
171161
}) {
172-
final Color? foreground = foregroundColor ?? primary;
173-
final Color? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38);
162+
final Color? foreground = foregroundColor;
163+
final Color? disabledForeground = disabledForegroundColor;
174164
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
175165
? null
176166
: _OutlinedButtonDefaultColor(foreground, disabledForeground);

‎packages/flutter/lib/src/material/text_button.dart‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,19 +168,9 @@ class TextButton extends ButtonStyleButton {
168168
bool? enableFeedback,
169169
AlignmentGeometry? alignment,
170170
InteractiveInkFeatureFactory? splashFactory,
171-
@Deprecated(
172-
'Use foregroundColor instead. '
173-
'This feature was deprecated after v3.1.0.'
174-
)
175-
Color? primary,
176-
@Deprecated(
177-
'Use disabledForegroundColor instead. '
178-
'This feature was deprecated after v3.1.0.'
179-
)
180-
Color? onSurface,
181171
}) {
182-
final Color? foreground = foregroundColor ?? primary;
183-
final Color? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38);
172+
final Color? foreground = foregroundColor;
173+
final Color? disabledForeground = disabledForegroundColor;
184174
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
185175
? null
186176
: _TextButtonDefaultColor(foreground, disabledForeground);

‎packages/flutter/test/material/time_picker_theme_test.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,8 @@ TimePickerThemeData _timePickerTheme({bool includeInputDecoration = false}) {
776776
final MaterialStateColor materialStateColor = MaterialStateColor.resolveWith(getColor);
777777
return TimePickerThemeData(
778778
backgroundColor: Colors.orange,
779-
cancelButtonStyle: TextButton.styleFrom(primary: Colors.red),
780-
confirmButtonStyle: TextButton.styleFrom(primary: Colors.green),
779+
cancelButtonStyle: TextButton.styleFrom(foregroundColor: Colors.red),
780+
confirmButtonStyle: TextButton.styleFrom(foregroundColor: Colors.green),
781781
hourMinuteTextColor: materialStateColor,
782782
hourMinuteColor: materialStateColor,
783783
dayPeriodTextColor: materialStateColor,

0 commit comments

Comments
 (0)