Skip to content

Commit 24ab5e8

Browse files
Merge branch 'master' into fix-78120
2 parents 56981e6 + 35eb77f commit 24ab5e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+290
-237
lines changed

.ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5438,7 +5438,6 @@ targets:
54385438

54395439
- name: Mac_ios ios_debug_workflow
54405440
recipe: devicelab/devicelab_drone
5441-
bringup: true
54425441
presubmit: false
54435442
timeout: 60
54445443
properties:

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

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart';
66
import 'package:flutter/widgets.dart';
77

88
import 'ink_well.dart';
9-
import 'material_state.dart';
109
import 'tabs.dart';
1110
import 'theme.dart';
1211

@@ -92,9 +91,9 @@ class TabBarTheme extends InheritedTheme with Diagnosticable {
9291
final TextStyle? _labelStyle;
9392
final Color? _unselectedLabelColor;
9493
final TextStyle? _unselectedLabelStyle;
95-
final MaterialStateProperty<Color?>? _overlayColor;
94+
final WidgetStateProperty<Color?>? _overlayColor;
9695
final InteractiveInkFeatureFactory? _splashFactory;
97-
final MaterialStateProperty<MouseCursor?>? _mouseCursor;
96+
final WidgetStateProperty<MouseCursor?>? _mouseCursor;
9897
final TabAlignment? _tabAlignment;
9998
final TextScaler? _textScaler;
10099
final TabIndicatorAnimation? _indicatorAnimation;
@@ -165,7 +164,7 @@ class TabBarTheme extends InheritedTheme with Diagnosticable {
165164
///
166165
/// This property is obsolete and will be deprecated in a future release:
167166
/// please use the [TabBarThemeData.overlayColor] property in [data] instead.
168-
MaterialStateProperty<Color?>? get overlayColor =>
167+
WidgetStateProperty<Color?>? get overlayColor =>
169168
_data != null ? _data.overlayColor : _overlayColor;
170169

171170
/// Overrides the default value for [TabBar.splashFactory].
@@ -179,7 +178,7 @@ class TabBarTheme extends InheritedTheme with Diagnosticable {
179178
///
180179
/// This property is obsolete and will be deprecated in a future release:
181180
/// please use the [TabBarThemeData.mouseCursor] property in [data] instead.
182-
MaterialStateProperty<MouseCursor?>? get mouseCursor =>
181+
WidgetStateProperty<MouseCursor?>? get mouseCursor =>
183182
_data != null ? _data.mouseCursor : _mouseCursor;
184183

185184
/// Overrides the default value for [TabBar.tabAlignment].
@@ -239,9 +238,9 @@ class TabBarTheme extends InheritedTheme with Diagnosticable {
239238
TextStyle? labelStyle,
240239
Color? unselectedLabelColor,
241240
TextStyle? unselectedLabelStyle,
242-
MaterialStateProperty<Color?>? overlayColor,
241+
WidgetStateProperty<Color?>? overlayColor,
243242
InteractiveInkFeatureFactory? splashFactory,
244-
MaterialStateProperty<MouseCursor?>? mouseCursor,
243+
WidgetStateProperty<MouseCursor?>? mouseCursor,
245244
TabAlignment? tabAlignment,
246245
TextScaler? textScaler,
247246
TabIndicatorAnimation? indicatorAnimation,
@@ -293,12 +292,7 @@ class TabBarTheme extends InheritedTheme with Diagnosticable {
293292
labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t),
294293
unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t),
295294
unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t),
296-
overlayColor: MaterialStateProperty.lerp<Color?>(
297-
a.overlayColor,
298-
b.overlayColor,
299-
t,
300-
Color.lerp,
301-
),
295+
overlayColor: WidgetStateProperty.lerp<Color?>(a.overlayColor, b.overlayColor, t, Color.lerp),
302296
splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory,
303297
mouseCursor: t < 0.5 ? a.mouseCursor : b.mouseCursor,
304298
tabAlignment: t < 0.5 ? a.tabAlignment : b.tabAlignment,
@@ -398,15 +392,15 @@ class TabBarThemeData with Diagnosticable {
398392
final TextStyle? unselectedLabelStyle;
399393

400394
/// Overrides the default value for [TabBar.overlayColor].
401-
final MaterialStateProperty<Color?>? overlayColor;
395+
final WidgetStateProperty<Color?>? overlayColor;
402396

403397
/// Overrides the default value for [TabBar.splashFactory].
404398
final InteractiveInkFeatureFactory? splashFactory;
405399

406400
/// {@macro flutter.material.tabs.mouseCursor}
407401
///
408402
/// If specified, overrides the default value of [TabBar.mouseCursor].
409-
final MaterialStateProperty<MouseCursor?>? mouseCursor;
403+
final WidgetStateProperty<MouseCursor?>? mouseCursor;
410404

411405
/// Overrides the default value for [TabBar.tabAlignment].
412406
final TabAlignment? tabAlignment;
@@ -433,9 +427,9 @@ class TabBarThemeData with Diagnosticable {
433427
TextStyle? labelStyle,
434428
Color? unselectedLabelColor,
435429
TextStyle? unselectedLabelStyle,
436-
MaterialStateProperty<Color?>? overlayColor,
430+
WidgetStateProperty<Color?>? overlayColor,
437431
InteractiveInkFeatureFactory? splashFactory,
438-
MaterialStateProperty<MouseCursor?>? mouseCursor,
432+
WidgetStateProperty<MouseCursor?>? mouseCursor,
439433
TabAlignment? tabAlignment,
440434
TextScaler? textScaler,
441435
TabIndicatorAnimation? indicatorAnimation,
@@ -480,12 +474,7 @@ class TabBarThemeData with Diagnosticable {
480474
labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t),
481475
unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t),
482476
unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t),
483-
overlayColor: MaterialStateProperty.lerp<Color?>(
484-
a.overlayColor,
485-
b.overlayColor,
486-
t,
487-
Color.lerp,
488-
),
477+
overlayColor: WidgetStateProperty.lerp<Color?>(a.overlayColor, b.overlayColor, t, Color.lerp),
489478
splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory,
490479
mouseCursor: t < 0.5 ? a.mouseCursor : b.mouseCursor,
491480
tabAlignment: t < 0.5 ? a.tabAlignment : b.tabAlignment,
@@ -574,7 +563,7 @@ class TabBarThemeData with Diagnosticable {
574563
),
575564
);
576565
properties.add(
577-
DiagnosticsProperty<MaterialStateProperty<Color?>?>(
566+
DiagnosticsProperty<WidgetStateProperty<Color?>?>(
578567
'overlayColor',
579568
overlayColor,
580569
defaultValue: null,
@@ -588,7 +577,7 @@ class TabBarThemeData with Diagnosticable {
588577
),
589578
);
590579
properties.add(
591-
DiagnosticsProperty<MaterialStateProperty<MouseCursor?>?>(
580+
DiagnosticsProperty<WidgetStateProperty<MouseCursor?>?>(
592581
'mouseCursor',
593582
mouseCursor,
594583
defaultValue: null,

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
12261226
/// * pressed - ThemeData.colorScheme.primary(0.1)
12271227
/// * hovered - ThemeData.colorScheme.onSurface(0.08)
12281228
/// * focused - ThemeData.colorScheme.onSurface(0.1)
1229-
final MaterialStateProperty<Color?>? overlayColor;
1229+
final WidgetStateProperty<Color?>? overlayColor;
12301230

12311231
/// {@macro flutter.widgets.scrollable.dragStartBehavior}
12321232
final DragStartBehavior dragStartBehavior;
@@ -1930,15 +1930,16 @@ class _TabBarState extends State<TabBar> {
19301930
};
19311931

19321932
final MouseCursor effectiveMouseCursor =
1933-
MaterialStateProperty.resolveAs<MouseCursor?>(widget.mouseCursor, selectedState) ??
1933+
WidgetStateProperty.resolveAs<MouseCursor?>(widget.mouseCursor, selectedState) ??
19341934
tabBarTheme.mouseCursor?.resolve(selectedState) ??
19351935
MaterialStateMouseCursor.clickable.resolve(selectedState);
19361936

1937-
final MaterialStateProperty<Color?> defaultOverlay =
1938-
MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
1939-
final Set<MaterialState> effectiveStates = selectedState..addAll(states);
1940-
return _defaults.overlayColor?.resolve(effectiveStates);
1941-
});
1937+
final WidgetStateProperty<Color?> defaultOverlay = WidgetStateProperty.resolveWith<Color?>((
1938+
Set<MaterialState> states,
1939+
) {
1940+
final Set<MaterialState> effectiveStates = selectedState..addAll(states);
1941+
return _defaults.overlayColor?.resolve(effectiveStates);
1942+
});
19421943
wrappedTabs[index] = InkWell(
19431944
mouseCursor: effectiveMouseCursor,
19441945
onTap: () {

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,18 @@ class TextButton extends ButtonStyleButton {
229229
ButtonLayerBuilder? backgroundBuilder,
230230
ButtonLayerBuilder? foregroundBuilder,
231231
}) {
232-
final MaterialStateProperty<Color?>? backgroundColorProp = switch ((
232+
final WidgetStateProperty<Color?>? backgroundColorProp = switch ((
233233
backgroundColor,
234234
disabledBackgroundColor,
235235
)) {
236236
(_?, null) => MaterialStatePropertyAll<Color?>(backgroundColor),
237237
(_, _) => ButtonStyleButton.defaultColor(backgroundColor, disabledBackgroundColor),
238238
};
239-
final MaterialStateProperty<Color?>? iconColorProp = switch ((iconColor, disabledIconColor)) {
239+
final WidgetStateProperty<Color?>? iconColorProp = switch ((iconColor, disabledIconColor)) {
240240
(_?, null) => MaterialStatePropertyAll<Color?>(iconColor),
241241
(_, _) => ButtonStyleButton.defaultColor(iconColor, disabledIconColor),
242242
};
243-
final MaterialStateProperty<Color?>? overlayColorProp = switch ((
244-
foregroundColor,
245-
overlayColor,
246-
)) {
243+
final WidgetStateProperty<Color?>? overlayColorProp = switch ((foregroundColor, overlayColor)) {
247244
(null, null) => null,
248245
(_, Color(a: 0.0)) => WidgetStatePropertyAll<Color?>(overlayColor),
249246
(_, final Color color) ||

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ class _TextFieldState extends State<TextField>
14611461
MaterialStatesController? _internalStatesController;
14621462

14631463
void _handleStatesControllerChange() {
1464-
// Force a rebuild to resolve MaterialStateProperty properties.
1464+
// Force a rebuild to resolve WidgetStateProperty properties.
14651465
setState(() {});
14661466
}
14671467

@@ -1506,11 +1506,11 @@ class _TextFieldState extends State<TextField>
15061506

15071507
TextStyle _getInputStyleForState(TextStyle style) {
15081508
final ThemeData theme = Theme.of(context);
1509-
final TextStyle stateStyle = MaterialStateProperty.resolveAs(
1509+
final TextStyle stateStyle = WidgetStateProperty.resolveAs(
15101510
theme.useMaterial3 ? _m3StateInputStyle(context)! : _m2StateInputStyle(context)!,
15111511
_statesController.value,
15121512
);
1513-
final TextStyle providedStyle = MaterialStateProperty.resolveAs(style, _statesController.value);
1513+
final TextStyle providedStyle = WidgetStateProperty.resolveAs(style, _statesController.value);
15141514
return providedStyle.merge(stateStyle);
15151515
}
15161516

@@ -1528,7 +1528,7 @@ class _TextFieldState extends State<TextField>
15281528

15291529
final ThemeData theme = Theme.of(context);
15301530
final DefaultSelectionStyle selectionStyle = DefaultSelectionStyle.of(context);
1531-
final TextStyle? providedStyle = MaterialStateProperty.resolveAs(
1531+
final TextStyle? providedStyle = WidgetStateProperty.resolveAs(
15321532
widget.style,
15331533
_statesController.value,
15341534
);
@@ -1767,7 +1767,7 @@ class _TextFieldState extends State<TextField>
17671767
child: child,
17681768
);
17691769
}
1770-
final MouseCursor effectiveMouseCursor = MaterialStateProperty.resolveAs<MouseCursor>(
1770+
final MouseCursor effectiveMouseCursor = WidgetStateProperty.resolveAs<MouseCursor>(
17711771
widget.mouseCursor ?? MaterialStateMouseCursor.textable,
17721772
_statesController.value,
17731773
);

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,12 @@ class _HourMinuteControl extends StatelessWidget {
360360
final ShapeBorder shape = timePickerTheme.hourMinuteShape ?? defaultTheme.hourMinuteShape;
361361

362362
final Set<MaterialState> states = <MaterialState>{if (isSelected) MaterialState.selected};
363-
final Color effectiveTextColor = MaterialStateProperty.resolveAs<Color>(
363+
final Color effectiveTextColor = WidgetStateProperty.resolveAs<Color>(
364364
_TimePickerModel.themeOf(context).hourMinuteTextColor ??
365365
_TimePickerModel.defaultThemeOf(context).hourMinuteTextColor,
366366
states,
367367
);
368-
final TextStyle effectiveStyle = MaterialStateProperty.resolveAs<TextStyle>(
368+
final TextStyle effectiveStyle = WidgetStateProperty.resolveAs<TextStyle>(
369369
timePickerTheme.hourMinuteTextStyle ?? defaultTheme.hourMinuteTextStyle,
370370
states,
371371
).copyWith(color: effectiveTextColor);
@@ -383,7 +383,7 @@ class _HourMinuteControl extends StatelessWidget {
383383
return SizedBox(
384384
height: height,
385385
child: Material(
386-
color: MaterialStateProperty.resolveAs(backgroundColor, states),
386+
color: WidgetStateProperty.resolveAs(backgroundColor, states),
387387
clipBehavior: Clip.antiAlias,
388388
shape: shape,
389389
child: InkWell(
@@ -497,14 +497,14 @@ class _TimeSelectorSeparator extends StatelessWidget {
497497
: _TimePickerDefaultsM2(context);
498498
final Set<MaterialState> states = <MaterialState>{};
499499

500-
final Color effectiveTextColor = MaterialStateProperty.resolveAs<Color>(
500+
final Color effectiveTextColor = WidgetStateProperty.resolveAs<Color>(
501501
timePickerTheme.timeSelectorSeparatorColor?.resolve(states) ??
502502
timePickerTheme.hourMinuteTextColor ??
503503
defaultTheme.timeSelectorSeparatorColor?.resolve(states) ??
504504
defaultTheme.hourMinuteTextColor,
505505
states,
506506
);
507-
final TextStyle effectiveStyle = MaterialStateProperty.resolveAs<TextStyle>(
507+
final TextStyle effectiveStyle = WidgetStateProperty.resolveAs<TextStyle>(
508508
timePickerTheme.timeSelectorSeparatorTextStyle?.resolve(states) ??
509509
timePickerTheme.hourMinuteTextStyle ??
510510
defaultTheme.timeSelectorSeparatorTextStyle?.resolve(states) ??
@@ -791,15 +791,15 @@ class _AmPmButton extends StatelessWidget {
791791
final Set<MaterialState> states = <MaterialState>{if (selected) MaterialState.selected};
792792
final TimePickerThemeData timePickerTheme = _TimePickerModel.themeOf(context);
793793
final _TimePickerDefaults defaultTheme = _TimePickerModel.defaultThemeOf(context);
794-
final Color resolvedBackgroundColor = MaterialStateProperty.resolveAs<Color>(
794+
final Color resolvedBackgroundColor = WidgetStateProperty.resolveAs<Color>(
795795
timePickerTheme.dayPeriodColor ?? defaultTheme.dayPeriodColor,
796796
states,
797797
);
798-
final Color resolvedTextColor = MaterialStateProperty.resolveAs<Color>(
798+
final Color resolvedTextColor = WidgetStateProperty.resolveAs<Color>(
799799
timePickerTheme.dayPeriodTextColor ?? defaultTheme.dayPeriodTextColor,
800800
states,
801801
);
802-
final TextStyle? resolvedTextStyle = MaterialStateProperty.resolveAs<TextStyle?>(
802+
final TextStyle? resolvedTextStyle = WidgetStateProperty.resolveAs<TextStyle?>(
803803
timePickerTheme.dayPeriodTextStyle ?? defaultTheme.dayPeriodTextStyle,
804804
states,
805805
)?.copyWith(color: resolvedTextColor);
@@ -1621,11 +1621,11 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin {
16211621
timePickerTheme.dialBackgroundColor ?? defaultTheme.dialBackgroundColor;
16221622
final Color dialHandColor = timePickerTheme.dialHandColor ?? defaultTheme.dialHandColor;
16231623
final TextStyle labelStyle = timePickerTheme.dialTextStyle ?? defaultTheme.dialTextStyle;
1624-
final Color dialTextUnselectedColor = MaterialStateProperty.resolveAs<Color>(
1624+
final Color dialTextUnselectedColor = WidgetStateProperty.resolveAs<Color>(
16251625
timePickerTheme.dialTextColor ?? defaultTheme.dialTextColor,
16261626
<MaterialState>{},
16271627
);
1628-
final Color dialTextSelectedColor = MaterialStateProperty.resolveAs<Color>(
1628+
final Color dialTextSelectedColor = WidgetStateProperty.resolveAs<Color>(
16291629
timePickerTheme.dialTextColor ?? defaultTheme.dialTextColor,
16301630
<MaterialState>{MaterialState.selected},
16311631
);
@@ -2234,7 +2234,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> with Restora
22342234
defaultTheme.hourMinuteColor;
22352235
final Color fillColor;
22362236
if (theme.useMaterial3) {
2237-
fillColor = MaterialStateProperty.resolveAs<Color>(startingFillColor, <MaterialState>{
2237+
fillColor = WidgetStateProperty.resolveAs<Color>(startingFillColor, <MaterialState>{
22382238
if (focusNode.hasFocus) MaterialState.focused,
22392239
if (focusNode.hasFocus) MaterialState.selected,
22402240
});
@@ -2248,11 +2248,11 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> with Restora
22482248
if (focusNode.hasFocus) MaterialState.focused,
22492249
if (focusNode.hasFocus) MaterialState.selected,
22502250
};
2251-
final Color effectiveTextColor = MaterialStateProperty.resolveAs<Color>(
2251+
final Color effectiveTextColor = WidgetStateProperty.resolveAs<Color>(
22522252
timePickerTheme.hourMinuteTextColor ?? defaultTheme.hourMinuteTextColor,
22532253
states,
22542254
);
2255-
final TextStyle effectiveStyle = MaterialStateProperty.resolveAs<TextStyle>(
2255+
final TextStyle effectiveStyle = WidgetStateProperty.resolveAs<TextStyle>(
22562256
widget.style,
22572257
states,
22582258
).copyWith(color: effectiveTextColor);

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ class TimePickerThemeData with Diagnosticable {
303303
///
304304
/// If this is null and [ThemeData.useMaterial3] is false, then defaults to the value of
305305
/// [hourMinuteTextColor].
306-
final MaterialStateProperty<Color?>? timeSelectorSeparatorColor;
306+
final WidgetStateProperty<Color?>? timeSelectorSeparatorColor;
307307

308308
/// Used to configure the text style for the time selector separator between the hour
309309
/// and minute controls.
@@ -313,7 +313,7 @@ class TimePickerThemeData with Diagnosticable {
313313
///
314314
/// If this is null and [ThemeData.useMaterial3] is false, then defaults to the value of
315315
/// [hourMinuteTextStyle].
316-
final MaterialStateProperty<TextStyle?>? timeSelectorSeparatorTextStyle;
316+
final WidgetStateProperty<TextStyle?>? timeSelectorSeparatorTextStyle;
317317

318318
/// Creates a copy of this object with the given fields replaced with the
319319
/// new values.
@@ -341,8 +341,8 @@ class TimePickerThemeData with Diagnosticable {
341341
InputDecorationTheme? inputDecorationTheme,
342342
EdgeInsetsGeometry? padding,
343343
ShapeBorder? shape,
344-
MaterialStateProperty<Color?>? timeSelectorSeparatorColor,
345-
MaterialStateProperty<TextStyle?>? timeSelectorSeparatorTextStyle,
344+
WidgetStateProperty<Color?>? timeSelectorSeparatorColor,
345+
WidgetStateProperty<TextStyle?>? timeSelectorSeparatorTextStyle,
346346
}) {
347347
return TimePickerThemeData(
348348
backgroundColor: backgroundColor ?? this.backgroundColor,
@@ -414,13 +414,13 @@ class TimePickerThemeData with Diagnosticable {
414414
inputDecorationTheme: t < 0.5 ? a?.inputDecorationTheme : b?.inputDecorationTheme,
415415
padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t),
416416
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
417-
timeSelectorSeparatorColor: MaterialStateProperty.lerp<Color?>(
417+
timeSelectorSeparatorColor: WidgetStateProperty.lerp<Color?>(
418418
a?.timeSelectorSeparatorColor,
419419
b?.timeSelectorSeparatorColor,
420420
t,
421421
Color.lerp,
422422
),
423-
timeSelectorSeparatorTextStyle: MaterialStateProperty.lerp<TextStyle?>(
423+
timeSelectorSeparatorTextStyle: WidgetStateProperty.lerp<TextStyle?>(
424424
a?.timeSelectorSeparatorTextStyle,
425425
b?.timeSelectorSeparatorTextStyle,
426426
t,
@@ -554,14 +554,14 @@ class TimePickerThemeData with Diagnosticable {
554554
properties.add(DiagnosticsProperty<EdgeInsetsGeometry>('padding', padding, defaultValue: null));
555555
properties.add(DiagnosticsProperty<ShapeBorder>('shape', shape, defaultValue: null));
556556
properties.add(
557-
DiagnosticsProperty<MaterialStateProperty<Color?>>(
557+
DiagnosticsProperty<WidgetStateProperty<Color?>>(
558558
'timeSelectorSeparatorColor',
559559
timeSelectorSeparatorColor,
560560
defaultValue: null,
561561
),
562562
);
563563
properties.add(
564-
DiagnosticsProperty<MaterialStateProperty<TextStyle?>>(
564+
DiagnosticsProperty<WidgetStateProperty<TextStyle?>>(
565565
'timeSelectorSeparatorTextStyle',
566566
timeSelectorSeparatorTextStyle,
567567
defaultValue: null,

0 commit comments

Comments
 (0)