Unverified Commit 2230c091 authored by Qun Cheng's avatar Qun Cheng Committed by GitHub

Remove deprecated parameters from `ElevatedButton.styleFrom()`,...

Remove deprecated parameters from `ElevatedButton.styleFrom()`, `OutlinedButton.styleFrom()`, and `TextButton.styleFrom()` (#139267)
parent 9ef1c2b0
...@@ -171,29 +171,14 @@ class ElevatedButton extends ButtonStyleButton { ...@@ -171,29 +171,14 @@ class ElevatedButton extends ButtonStyleButton {
bool? enableFeedback, bool? enableFeedback,
AlignmentGeometry? alignment, AlignmentGeometry? alignment,
InteractiveInkFeatureFactory? splashFactory, InteractiveInkFeatureFactory? splashFactory,
@Deprecated(
'Use backgroundColor instead. '
'This feature was deprecated after v3.1.0.'
)
Color? primary,
@Deprecated(
'Use foregroundColor instead. '
'This feature was deprecated after v3.1.0.'
)
Color? onPrimary,
@Deprecated(
'Use disabledForegroundColor and disabledBackgroundColor instead. '
'This feature was deprecated after v3.1.0.'
)
Color? onSurface,
}) { }) {
final Color? background = backgroundColor ?? primary; final Color? background = backgroundColor;
final Color? disabledBackground = disabledBackgroundColor ?? onSurface?.withOpacity(0.12); final Color? disabledBackground = disabledBackgroundColor;
final MaterialStateProperty<Color?>? backgroundColorProp = (background == null && disabledBackground == null) final MaterialStateProperty<Color?>? backgroundColorProp = (background == null && disabledBackground == null)
? null ? null
: _ElevatedButtonDefaultColor(background, disabledBackground); : _ElevatedButtonDefaultColor(background, disabledBackground);
final Color? foreground = foregroundColor ?? onPrimary; final Color? foreground = foregroundColor;
final Color? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38); final Color? disabledForeground = disabledForegroundColor;
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null) final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
? null ? null
: _ElevatedButtonDefaultColor(foreground, disabledForeground); : _ElevatedButtonDefaultColor(foreground, disabledForeground);
......
...@@ -158,19 +158,9 @@ class OutlinedButton extends ButtonStyleButton { ...@@ -158,19 +158,9 @@ class OutlinedButton extends ButtonStyleButton {
bool? enableFeedback, bool? enableFeedback,
AlignmentGeometry? alignment, AlignmentGeometry? alignment,
InteractiveInkFeatureFactory? splashFactory, InteractiveInkFeatureFactory? splashFactory,
@Deprecated(
'Use foregroundColor instead. '
'This feature was deprecated after v3.1.0.'
)
Color? primary,
@Deprecated(
'Use disabledForegroundColor instead. '
'This feature was deprecated after v3.1.0.'
)
Color? onSurface,
}) { }) {
final Color? foreground = foregroundColor ?? primary; final Color? foreground = foregroundColor;
final Color? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38); final Color? disabledForeground = disabledForegroundColor;
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null) final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
? null ? null
: _OutlinedButtonDefaultColor(foreground, disabledForeground); : _OutlinedButtonDefaultColor(foreground, disabledForeground);
......
...@@ -168,19 +168,9 @@ class TextButton extends ButtonStyleButton { ...@@ -168,19 +168,9 @@ class TextButton extends ButtonStyleButton {
bool? enableFeedback, bool? enableFeedback,
AlignmentGeometry? alignment, AlignmentGeometry? alignment,
InteractiveInkFeatureFactory? splashFactory, InteractiveInkFeatureFactory? splashFactory,
@Deprecated(
'Use foregroundColor instead. '
'This feature was deprecated after v3.1.0.'
)
Color? primary,
@Deprecated(
'Use disabledForegroundColor instead. '
'This feature was deprecated after v3.1.0.'
)
Color? onSurface,
}) { }) {
final Color? foreground = foregroundColor ?? primary; final Color? foreground = foregroundColor;
final Color? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38); final Color? disabledForeground = disabledForegroundColor;
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null) final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
? null ? null
: _TextButtonDefaultColor(foreground, disabledForeground); : _TextButtonDefaultColor(foreground, disabledForeground);
......
...@@ -776,8 +776,8 @@ TimePickerThemeData _timePickerTheme({bool includeInputDecoration = false}) { ...@@ -776,8 +776,8 @@ TimePickerThemeData _timePickerTheme({bool includeInputDecoration = false}) {
final MaterialStateColor materialStateColor = MaterialStateColor.resolveWith(getColor); final MaterialStateColor materialStateColor = MaterialStateColor.resolveWith(getColor);
return TimePickerThemeData( return TimePickerThemeData(
backgroundColor: Colors.orange, backgroundColor: Colors.orange,
cancelButtonStyle: TextButton.styleFrom(primary: Colors.red), cancelButtonStyle: TextButton.styleFrom(foregroundColor: Colors.red),
confirmButtonStyle: TextButton.styleFrom(primary: Colors.green), confirmButtonStyle: TextButton.styleFrom(foregroundColor: Colors.green),
hourMinuteTextColor: materialStateColor, hourMinuteTextColor: materialStateColor,
hourMinuteColor: materialStateColor, hourMinuteColor: materialStateColor,
dayPeriodTextColor: materialStateColor, dayPeriodTextColor: materialStateColor,
......
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