mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove deprecated parameters from ElevatedButton.styleFrom(), OutlinedButton.styleFrom(), and TextButton.styleFrom() (#139267)
This commit is contained in:
parent
9ef1c2b07a
commit
2230c0913a
@ -171,29 +171,14 @@ class ElevatedButton extends ButtonStyleButton {
|
||||
bool? enableFeedback,
|
||||
AlignmentGeometry? alignment,
|
||||
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? disabledBackground = disabledBackgroundColor ?? onSurface?.withOpacity(0.12);
|
||||
final Color? background = backgroundColor;
|
||||
final Color? disabledBackground = disabledBackgroundColor;
|
||||
final MaterialStateProperty<Color?>? backgroundColorProp = (background == null && disabledBackground == null)
|
||||
? null
|
||||
: _ElevatedButtonDefaultColor(background, disabledBackground);
|
||||
final Color? foreground = foregroundColor ?? onPrimary;
|
||||
final Color? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38);
|
||||
final Color? foreground = foregroundColor;
|
||||
final Color? disabledForeground = disabledForegroundColor;
|
||||
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
|
||||
? null
|
||||
: _ElevatedButtonDefaultColor(foreground, disabledForeground);
|
||||
|
||||
@ -158,19 +158,9 @@ class OutlinedButton extends ButtonStyleButton {
|
||||
bool? enableFeedback,
|
||||
AlignmentGeometry? alignment,
|
||||
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? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38);
|
||||
final Color? foreground = foregroundColor;
|
||||
final Color? disabledForeground = disabledForegroundColor;
|
||||
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
|
||||
? null
|
||||
: _OutlinedButtonDefaultColor(foreground, disabledForeground);
|
||||
|
||||
@ -168,19 +168,9 @@ class TextButton extends ButtonStyleButton {
|
||||
bool? enableFeedback,
|
||||
AlignmentGeometry? alignment,
|
||||
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? disabledForeground = disabledForegroundColor ?? onSurface?.withOpacity(0.38);
|
||||
final Color? foreground = foregroundColor;
|
||||
final Color? disabledForeground = disabledForegroundColor;
|
||||
final MaterialStateProperty<Color?>? foregroundColorProp = (foreground == null && disabledForeground == null)
|
||||
? null
|
||||
: _TextButtonDefaultColor(foreground, disabledForeground);
|
||||
|
||||
@ -776,8 +776,8 @@ TimePickerThemeData _timePickerTheme({bool includeInputDecoration = false}) {
|
||||
final MaterialStateColor materialStateColor = MaterialStateColor.resolveWith(getColor);
|
||||
return TimePickerThemeData(
|
||||
backgroundColor: Colors.orange,
|
||||
cancelButtonStyle: TextButton.styleFrom(primary: Colors.red),
|
||||
confirmButtonStyle: TextButton.styleFrom(primary: Colors.green),
|
||||
cancelButtonStyle: TextButton.styleFrom(foregroundColor: Colors.red),
|
||||
confirmButtonStyle: TextButton.styleFrom(foregroundColor: Colors.green),
|
||||
hourMinuteTextColor: materialStateColor,
|
||||
hourMinuteColor: materialStateColor,
|
||||
dayPeriodTextColor: materialStateColor,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user