diff --git a/packages/flutter/lib/src/material/tab_bar_theme.dart b/packages/flutter/lib/src/material/tab_bar_theme.dart index 3ee96b205c5..80b80257794 100644 --- a/packages/flutter/lib/src/material/tab_bar_theme.dart +++ b/packages/flutter/lib/src/material/tab_bar_theme.dart @@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/widgets.dart'; import 'ink_well.dart'; -import 'material_state.dart'; import 'tabs.dart'; import 'theme.dart'; @@ -92,9 +91,9 @@ class TabBarTheme extends InheritedTheme with Diagnosticable { final TextStyle? _labelStyle; final Color? _unselectedLabelColor; final TextStyle? _unselectedLabelStyle; - final MaterialStateProperty? _overlayColor; + final WidgetStateProperty? _overlayColor; final InteractiveInkFeatureFactory? _splashFactory; - final MaterialStateProperty? _mouseCursor; + final WidgetStateProperty? _mouseCursor; final TabAlignment? _tabAlignment; final TextScaler? _textScaler; final TabIndicatorAnimation? _indicatorAnimation; @@ -165,7 +164,7 @@ class TabBarTheme extends InheritedTheme with Diagnosticable { /// /// This property is obsolete and will be deprecated in a future release: /// please use the [TabBarThemeData.overlayColor] property in [data] instead. - MaterialStateProperty? get overlayColor => + WidgetStateProperty? get overlayColor => _data != null ? _data.overlayColor : _overlayColor; /// Overrides the default value for [TabBar.splashFactory]. @@ -179,7 +178,7 @@ class TabBarTheme extends InheritedTheme with Diagnosticable { /// /// This property is obsolete and will be deprecated in a future release: /// please use the [TabBarThemeData.mouseCursor] property in [data] instead. - MaterialStateProperty? get mouseCursor => + WidgetStateProperty? get mouseCursor => _data != null ? _data.mouseCursor : _mouseCursor; /// Overrides the default value for [TabBar.tabAlignment]. @@ -239,9 +238,9 @@ class TabBarTheme extends InheritedTheme with Diagnosticable { TextStyle? labelStyle, Color? unselectedLabelColor, TextStyle? unselectedLabelStyle, - MaterialStateProperty? overlayColor, + WidgetStateProperty? overlayColor, InteractiveInkFeatureFactory? splashFactory, - MaterialStateProperty? mouseCursor, + WidgetStateProperty? mouseCursor, TabAlignment? tabAlignment, TextScaler? textScaler, TabIndicatorAnimation? indicatorAnimation, @@ -293,12 +292,7 @@ class TabBarTheme extends InheritedTheme with Diagnosticable { labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t), unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t), unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t), - overlayColor: MaterialStateProperty.lerp( - a.overlayColor, - b.overlayColor, - t, - Color.lerp, - ), + overlayColor: WidgetStateProperty.lerp(a.overlayColor, b.overlayColor, t, Color.lerp), splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory, mouseCursor: t < 0.5 ? a.mouseCursor : b.mouseCursor, tabAlignment: t < 0.5 ? a.tabAlignment : b.tabAlignment, @@ -398,7 +392,7 @@ class TabBarThemeData with Diagnosticable { final TextStyle? unselectedLabelStyle; /// Overrides the default value for [TabBar.overlayColor]. - final MaterialStateProperty? overlayColor; + final WidgetStateProperty? overlayColor; /// Overrides the default value for [TabBar.splashFactory]. final InteractiveInkFeatureFactory? splashFactory; @@ -406,7 +400,7 @@ class TabBarThemeData with Diagnosticable { /// {@macro flutter.material.tabs.mouseCursor} /// /// If specified, overrides the default value of [TabBar.mouseCursor]. - final MaterialStateProperty? mouseCursor; + final WidgetStateProperty? mouseCursor; /// Overrides the default value for [TabBar.tabAlignment]. final TabAlignment? tabAlignment; @@ -433,9 +427,9 @@ class TabBarThemeData with Diagnosticable { TextStyle? labelStyle, Color? unselectedLabelColor, TextStyle? unselectedLabelStyle, - MaterialStateProperty? overlayColor, + WidgetStateProperty? overlayColor, InteractiveInkFeatureFactory? splashFactory, - MaterialStateProperty? mouseCursor, + WidgetStateProperty? mouseCursor, TabAlignment? tabAlignment, TextScaler? textScaler, TabIndicatorAnimation? indicatorAnimation, @@ -480,12 +474,7 @@ class TabBarThemeData with Diagnosticable { labelStyle: TextStyle.lerp(a.labelStyle, b.labelStyle, t), unselectedLabelColor: Color.lerp(a.unselectedLabelColor, b.unselectedLabelColor, t), unselectedLabelStyle: TextStyle.lerp(a.unselectedLabelStyle, b.unselectedLabelStyle, t), - overlayColor: MaterialStateProperty.lerp( - a.overlayColor, - b.overlayColor, - t, - Color.lerp, - ), + overlayColor: WidgetStateProperty.lerp(a.overlayColor, b.overlayColor, t, Color.lerp), splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory, mouseCursor: t < 0.5 ? a.mouseCursor : b.mouseCursor, tabAlignment: t < 0.5 ? a.tabAlignment : b.tabAlignment, @@ -574,7 +563,7 @@ class TabBarThemeData with Diagnosticable { ), ); properties.add( - DiagnosticsProperty?>( + DiagnosticsProperty?>( 'overlayColor', overlayColor, defaultValue: null, @@ -588,7 +577,7 @@ class TabBarThemeData with Diagnosticable { ), ); properties.add( - DiagnosticsProperty?>( + DiagnosticsProperty?>( 'mouseCursor', mouseCursor, defaultValue: null, diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 00482c5e62f..0ba14d4f772 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -1226,7 +1226,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget { /// * pressed - ThemeData.colorScheme.primary(0.1) /// * hovered - ThemeData.colorScheme.onSurface(0.08) /// * focused - ThemeData.colorScheme.onSurface(0.1) - final MaterialStateProperty? overlayColor; + final WidgetStateProperty? overlayColor; /// {@macro flutter.widgets.scrollable.dragStartBehavior} final DragStartBehavior dragStartBehavior; @@ -1930,15 +1930,16 @@ class _TabBarState extends State { }; final MouseCursor effectiveMouseCursor = - MaterialStateProperty.resolveAs(widget.mouseCursor, selectedState) ?? + WidgetStateProperty.resolveAs(widget.mouseCursor, selectedState) ?? tabBarTheme.mouseCursor?.resolve(selectedState) ?? MaterialStateMouseCursor.clickable.resolve(selectedState); - final MaterialStateProperty defaultOverlay = - MaterialStateProperty.resolveWith((Set states) { - final Set effectiveStates = selectedState..addAll(states); - return _defaults.overlayColor?.resolve(effectiveStates); - }); + final WidgetStateProperty defaultOverlay = WidgetStateProperty.resolveWith(( + Set states, + ) { + final Set effectiveStates = selectedState..addAll(states); + return _defaults.overlayColor?.resolve(effectiveStates); + }); wrappedTabs[index] = InkWell( mouseCursor: effectiveMouseCursor, onTap: () { diff --git a/packages/flutter/lib/src/material/text_button.dart b/packages/flutter/lib/src/material/text_button.dart index e9a20dbf7f2..8c693691211 100644 --- a/packages/flutter/lib/src/material/text_button.dart +++ b/packages/flutter/lib/src/material/text_button.dart @@ -229,21 +229,18 @@ class TextButton extends ButtonStyleButton { ButtonLayerBuilder? backgroundBuilder, ButtonLayerBuilder? foregroundBuilder, }) { - final MaterialStateProperty? backgroundColorProp = switch (( + final WidgetStateProperty? backgroundColorProp = switch (( backgroundColor, disabledBackgroundColor, )) { (_?, null) => MaterialStatePropertyAll(backgroundColor), (_, _) => ButtonStyleButton.defaultColor(backgroundColor, disabledBackgroundColor), }; - final MaterialStateProperty? iconColorProp = switch ((iconColor, disabledIconColor)) { + final WidgetStateProperty? iconColorProp = switch ((iconColor, disabledIconColor)) { (_?, null) => MaterialStatePropertyAll(iconColor), (_, _) => ButtonStyleButton.defaultColor(iconColor, disabledIconColor), }; - final MaterialStateProperty? overlayColorProp = switch (( - foregroundColor, - overlayColor, - )) { + final WidgetStateProperty? overlayColorProp = switch ((foregroundColor, overlayColor)) { (null, null) => null, (_, Color(a: 0.0)) => WidgetStatePropertyAll(overlayColor), (_, final Color color) || diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart index 36e6349cb44..be3fc68ccd8 100644 --- a/packages/flutter/lib/src/material/text_field.dart +++ b/packages/flutter/lib/src/material/text_field.dart @@ -1461,7 +1461,7 @@ class _TextFieldState extends State MaterialStatesController? _internalStatesController; void _handleStatesControllerChange() { - // Force a rebuild to resolve MaterialStateProperty properties. + // Force a rebuild to resolve WidgetStateProperty properties. setState(() {}); } @@ -1506,11 +1506,11 @@ class _TextFieldState extends State TextStyle _getInputStyleForState(TextStyle style) { final ThemeData theme = Theme.of(context); - final TextStyle stateStyle = MaterialStateProperty.resolveAs( + final TextStyle stateStyle = WidgetStateProperty.resolveAs( theme.useMaterial3 ? _m3StateInputStyle(context)! : _m2StateInputStyle(context)!, _statesController.value, ); - final TextStyle providedStyle = MaterialStateProperty.resolveAs(style, _statesController.value); + final TextStyle providedStyle = WidgetStateProperty.resolveAs(style, _statesController.value); return providedStyle.merge(stateStyle); } @@ -1528,7 +1528,7 @@ class _TextFieldState extends State final ThemeData theme = Theme.of(context); final DefaultSelectionStyle selectionStyle = DefaultSelectionStyle.of(context); - final TextStyle? providedStyle = MaterialStateProperty.resolveAs( + final TextStyle? providedStyle = WidgetStateProperty.resolveAs( widget.style, _statesController.value, ); @@ -1767,7 +1767,7 @@ class _TextFieldState extends State child: child, ); } - final MouseCursor effectiveMouseCursor = MaterialStateProperty.resolveAs( + final MouseCursor effectiveMouseCursor = WidgetStateProperty.resolveAs( widget.mouseCursor ?? MaterialStateMouseCursor.textable, _statesController.value, ); diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index 6f3adf5ba4e..3808f5a74d4 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -360,12 +360,12 @@ class _HourMinuteControl extends StatelessWidget { final ShapeBorder shape = timePickerTheme.hourMinuteShape ?? defaultTheme.hourMinuteShape; final Set states = {if (isSelected) MaterialState.selected}; - final Color effectiveTextColor = MaterialStateProperty.resolveAs( + final Color effectiveTextColor = WidgetStateProperty.resolveAs( _TimePickerModel.themeOf(context).hourMinuteTextColor ?? _TimePickerModel.defaultThemeOf(context).hourMinuteTextColor, states, ); - final TextStyle effectiveStyle = MaterialStateProperty.resolveAs( + final TextStyle effectiveStyle = WidgetStateProperty.resolveAs( timePickerTheme.hourMinuteTextStyle ?? defaultTheme.hourMinuteTextStyle, states, ).copyWith(color: effectiveTextColor); @@ -383,7 +383,7 @@ class _HourMinuteControl extends StatelessWidget { return SizedBox( height: height, child: Material( - color: MaterialStateProperty.resolveAs(backgroundColor, states), + color: WidgetStateProperty.resolveAs(backgroundColor, states), clipBehavior: Clip.antiAlias, shape: shape, child: InkWell( @@ -497,14 +497,14 @@ class _TimeSelectorSeparator extends StatelessWidget { : _TimePickerDefaultsM2(context); final Set states = {}; - final Color effectiveTextColor = MaterialStateProperty.resolveAs( + final Color effectiveTextColor = WidgetStateProperty.resolveAs( timePickerTheme.timeSelectorSeparatorColor?.resolve(states) ?? timePickerTheme.hourMinuteTextColor ?? defaultTheme.timeSelectorSeparatorColor?.resolve(states) ?? defaultTheme.hourMinuteTextColor, states, ); - final TextStyle effectiveStyle = MaterialStateProperty.resolveAs( + final TextStyle effectiveStyle = WidgetStateProperty.resolveAs( timePickerTheme.timeSelectorSeparatorTextStyle?.resolve(states) ?? timePickerTheme.hourMinuteTextStyle ?? defaultTheme.timeSelectorSeparatorTextStyle?.resolve(states) ?? @@ -791,15 +791,15 @@ class _AmPmButton extends StatelessWidget { final Set states = {if (selected) MaterialState.selected}; final TimePickerThemeData timePickerTheme = _TimePickerModel.themeOf(context); final _TimePickerDefaults defaultTheme = _TimePickerModel.defaultThemeOf(context); - final Color resolvedBackgroundColor = MaterialStateProperty.resolveAs( + final Color resolvedBackgroundColor = WidgetStateProperty.resolveAs( timePickerTheme.dayPeriodColor ?? defaultTheme.dayPeriodColor, states, ); - final Color resolvedTextColor = MaterialStateProperty.resolveAs( + final Color resolvedTextColor = WidgetStateProperty.resolveAs( timePickerTheme.dayPeriodTextColor ?? defaultTheme.dayPeriodTextColor, states, ); - final TextStyle? resolvedTextStyle = MaterialStateProperty.resolveAs( + final TextStyle? resolvedTextStyle = WidgetStateProperty.resolveAs( timePickerTheme.dayPeriodTextStyle ?? defaultTheme.dayPeriodTextStyle, states, )?.copyWith(color: resolvedTextColor); @@ -1621,11 +1621,11 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { timePickerTheme.dialBackgroundColor ?? defaultTheme.dialBackgroundColor; final Color dialHandColor = timePickerTheme.dialHandColor ?? defaultTheme.dialHandColor; final TextStyle labelStyle = timePickerTheme.dialTextStyle ?? defaultTheme.dialTextStyle; - final Color dialTextUnselectedColor = MaterialStateProperty.resolveAs( + final Color dialTextUnselectedColor = WidgetStateProperty.resolveAs( timePickerTheme.dialTextColor ?? defaultTheme.dialTextColor, {}, ); - final Color dialTextSelectedColor = MaterialStateProperty.resolveAs( + final Color dialTextSelectedColor = WidgetStateProperty.resolveAs( timePickerTheme.dialTextColor ?? defaultTheme.dialTextColor, {MaterialState.selected}, ); @@ -2234,7 +2234,7 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> with Restora defaultTheme.hourMinuteColor; final Color fillColor; if (theme.useMaterial3) { - fillColor = MaterialStateProperty.resolveAs(startingFillColor, { + fillColor = WidgetStateProperty.resolveAs(startingFillColor, { if (focusNode.hasFocus) MaterialState.focused, if (focusNode.hasFocus) MaterialState.selected, }); @@ -2248,11 +2248,11 @@ class _HourMinuteTextFieldState extends State<_HourMinuteTextField> with Restora if (focusNode.hasFocus) MaterialState.focused, if (focusNode.hasFocus) MaterialState.selected, }; - final Color effectiveTextColor = MaterialStateProperty.resolveAs( + final Color effectiveTextColor = WidgetStateProperty.resolveAs( timePickerTheme.hourMinuteTextColor ?? defaultTheme.hourMinuteTextColor, states, ); - final TextStyle effectiveStyle = MaterialStateProperty.resolveAs( + final TextStyle effectiveStyle = WidgetStateProperty.resolveAs( widget.style, states, ).copyWith(color: effectiveTextColor); diff --git a/packages/flutter/lib/src/material/time_picker_theme.dart b/packages/flutter/lib/src/material/time_picker_theme.dart index 7ef8106c795..c0a5a43181f 100644 --- a/packages/flutter/lib/src/material/time_picker_theme.dart +++ b/packages/flutter/lib/src/material/time_picker_theme.dart @@ -303,7 +303,7 @@ class TimePickerThemeData with Diagnosticable { /// /// If this is null and [ThemeData.useMaterial3] is false, then defaults to the value of /// [hourMinuteTextColor]. - final MaterialStateProperty? timeSelectorSeparatorColor; + final WidgetStateProperty? timeSelectorSeparatorColor; /// Used to configure the text style for the time selector separator between the hour /// and minute controls. @@ -313,7 +313,7 @@ class TimePickerThemeData with Diagnosticable { /// /// If this is null and [ThemeData.useMaterial3] is false, then defaults to the value of /// [hourMinuteTextStyle]. - final MaterialStateProperty? timeSelectorSeparatorTextStyle; + final WidgetStateProperty? timeSelectorSeparatorTextStyle; /// Creates a copy of this object with the given fields replaced with the /// new values. @@ -341,8 +341,8 @@ class TimePickerThemeData with Diagnosticable { InputDecorationTheme? inputDecorationTheme, EdgeInsetsGeometry? padding, ShapeBorder? shape, - MaterialStateProperty? timeSelectorSeparatorColor, - MaterialStateProperty? timeSelectorSeparatorTextStyle, + WidgetStateProperty? timeSelectorSeparatorColor, + WidgetStateProperty? timeSelectorSeparatorTextStyle, }) { return TimePickerThemeData( backgroundColor: backgroundColor ?? this.backgroundColor, @@ -414,13 +414,13 @@ class TimePickerThemeData with Diagnosticable { inputDecorationTheme: t < 0.5 ? a?.inputDecorationTheme : b?.inputDecorationTheme, padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t), shape: ShapeBorder.lerp(a?.shape, b?.shape, t), - timeSelectorSeparatorColor: MaterialStateProperty.lerp( + timeSelectorSeparatorColor: WidgetStateProperty.lerp( a?.timeSelectorSeparatorColor, b?.timeSelectorSeparatorColor, t, Color.lerp, ), - timeSelectorSeparatorTextStyle: MaterialStateProperty.lerp( + timeSelectorSeparatorTextStyle: WidgetStateProperty.lerp( a?.timeSelectorSeparatorTextStyle, b?.timeSelectorSeparatorTextStyle, t, @@ -554,14 +554,14 @@ class TimePickerThemeData with Diagnosticable { properties.add(DiagnosticsProperty('padding', padding, defaultValue: null)); properties.add(DiagnosticsProperty('shape', shape, defaultValue: null)); properties.add( - DiagnosticsProperty>( + DiagnosticsProperty>( 'timeSelectorSeparatorColor', timeSelectorSeparatorColor, defaultValue: null, ), ); properties.add( - DiagnosticsProperty>( + DiagnosticsProperty>( 'timeSelectorSeparatorTextStyle', timeSelectorSeparatorTextStyle, defaultValue: null, diff --git a/packages/flutter/lib/src/material/toggle_buttons.dart b/packages/flutter/lib/src/material/toggle_buttons.dart index 863d42aa183..d85824843ea 100644 --- a/packages/flutter/lib/src/material/toggle_buttons.dart +++ b/packages/flutter/lib/src/material/toggle_buttons.dart @@ -903,22 +903,22 @@ class ToggleButtons extends StatelessWidget { } @immutable -class _ResolveFillColor extends MaterialStateProperty with Diagnosticable { +class _ResolveFillColor extends WidgetStateProperty with Diagnosticable { _ResolveFillColor(this.primary); final Color? primary; @override Color? resolve(Set states) { - if (primary is MaterialStateProperty) { - return MaterialStateProperty.resolveAs(primary, states); + if (primary is WidgetStateProperty) { + return WidgetStateProperty.resolveAs(primary, states); } return states.contains(MaterialState.selected) ? primary : null; } } @immutable -class _DefaultFillColor extends MaterialStateProperty with Diagnosticable { +class _DefaultFillColor extends WidgetStateProperty with Diagnosticable { _DefaultFillColor(this.colorScheme); final ColorScheme colorScheme; @@ -933,7 +933,7 @@ class _DefaultFillColor extends MaterialStateProperty with Diagnosticable } @immutable -class _ToggleButtonDefaultOverlay extends MaterialStateProperty { +class _ToggleButtonDefaultOverlay extends WidgetStateProperty { _ToggleButtonDefaultOverlay({ required this.selected, required this.unselected, diff --git a/packages/flutter/test/material/action_chip_test.dart b/packages/flutter/test/material/action_chip_test.dart index ed66a059531..0607997e2d6 100644 --- a/packages/flutter/test/material/action_chip_test.dart +++ b/packages/flutter/test/material/action_chip_test.dart @@ -247,7 +247,7 @@ void main() { testWidgets('ActionChip.color resolves material states', (WidgetTester tester) async { const Color disabledColor = Color(0xff00ff00); const Color backgroundColor = Color(0xff0000ff); - final MaterialStateProperty color = MaterialStateProperty.resolveWith(( + final WidgetStateProperty color = WidgetStateProperty.resolveWith(( Set states, ) { if (states.contains(MaterialState.disabled)) { diff --git a/packages/flutter/test/material/bottom_navigation_bar_theme_test.dart b/packages/flutter/test/material/bottom_navigation_bar_theme_test.dart index 667d8f69b42..f6a4a809314 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_theme_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_theme_test.dart @@ -139,9 +139,7 @@ void main() { type: BottomNavigationBarType.fixed, selectedLabelStyle: selectedTextStyle, unselectedLabelStyle: unselectedTextStyle, - mouseCursor: MaterialStateProperty.resolveWith(( - Set states, - ) { + mouseCursor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return SystemMouseCursors.grab; } diff --git a/packages/flutter/test/material/bottom_sheet_test.dart b/packages/flutter/test/material/bottom_sheet_test.dart index 8c6b9cbc2f7..3fdec19e26d 100644 --- a/packages/flutter/test/material/bottom_sheet_test.dart +++ b/packages/flutter/test/material/bottom_sheet_test.dart @@ -1254,7 +1254,7 @@ void main() { semantics.dispose(); }); - testWidgets('Drag handle color can take MaterialStateProperty', (WidgetTester tester) async { + testWidgets('Drag handle color can take WidgetStateProperty', (WidgetTester tester) async { const Color defaultColor = Colors.blue; const Color hoveringColor = Colors.green; diff --git a/packages/flutter/test/material/button_style_test.dart b/packages/flutter/test/material/button_style_test.dart index 5215620ee26..d361e59da3c 100644 --- a/packages/flutter/test/material/button_style_test.dart +++ b/packages/flutter/test/material/button_style_test.dart @@ -110,42 +110,38 @@ void main() { }); testWidgets('ButtonStyle copyWith, merge', (WidgetTester tester) async { - const MaterialStateProperty textStyle = MaterialStatePropertyAll( + const WidgetStateProperty textStyle = MaterialStatePropertyAll( TextStyle(fontSize: 10), ); - const MaterialStateProperty backgroundColor = MaterialStatePropertyAll( + const WidgetStateProperty backgroundColor = MaterialStatePropertyAll( Color(0xfffffff1), ); - const MaterialStateProperty foregroundColor = MaterialStatePropertyAll( + const WidgetStateProperty foregroundColor = MaterialStatePropertyAll( Color(0xfffffff2), ); - const MaterialStateProperty overlayColor = MaterialStatePropertyAll( + const WidgetStateProperty overlayColor = MaterialStatePropertyAll( Color(0xfffffff3), ); - const MaterialStateProperty shadowColor = MaterialStatePropertyAll( + const WidgetStateProperty shadowColor = MaterialStatePropertyAll( Color(0xfffffff4), ); - const MaterialStateProperty surfaceTintColor = MaterialStatePropertyAll( + const WidgetStateProperty surfaceTintColor = MaterialStatePropertyAll( Color(0xfffffff5), ); - const MaterialStateProperty elevation = MaterialStatePropertyAll(1); - const MaterialStateProperty padding = MaterialStatePropertyAll( + const WidgetStateProperty elevation = MaterialStatePropertyAll(1); + const WidgetStateProperty padding = MaterialStatePropertyAll( EdgeInsets.all(1), ); - const MaterialStateProperty minimumSize = MaterialStatePropertyAll(Size(1, 2)); - const MaterialStateProperty fixedSize = MaterialStatePropertyAll(Size(3, 4)); - const MaterialStateProperty maximumSize = MaterialStatePropertyAll(Size(5, 6)); - const MaterialStateProperty iconColor = MaterialStatePropertyAll( - Color(0xfffffff6), - ); - const MaterialStateProperty iconSize = MaterialStatePropertyAll(48.0); - const MaterialStateProperty side = MaterialStatePropertyAll( - BorderSide(), - ); - const MaterialStateProperty shape = MaterialStatePropertyAll( + const WidgetStateProperty minimumSize = MaterialStatePropertyAll(Size(1, 2)); + const WidgetStateProperty fixedSize = MaterialStatePropertyAll(Size(3, 4)); + const WidgetStateProperty maximumSize = MaterialStatePropertyAll(Size(5, 6)); + const WidgetStateProperty iconColor = MaterialStatePropertyAll(Color(0xfffffff6)); + const WidgetStateProperty iconSize = MaterialStatePropertyAll(48.0); + const WidgetStateProperty side = MaterialStatePropertyAll(BorderSide()); + const WidgetStateProperty shape = MaterialStatePropertyAll( StadiumBorder(), ); - const MaterialStateProperty mouseCursor = MaterialStatePropertyAll( + const WidgetStateProperty mouseCursor = MaterialStatePropertyAll( SystemMouseCursors.forbidden, ); const VisualDensity visualDensity = VisualDensity.compact; diff --git a/packages/flutter/test/material/checkbox_list_tile_test.dart b/packages/flutter/test/material/checkbox_list_tile_test.dart index d23d82bdf78..f73265e6814 100644 --- a/packages/flutter/test/material/checkbox_list_tile_test.dart +++ b/packages/flutter/test/material/checkbox_list_tile_test.dart @@ -122,7 +122,7 @@ void main() { child: Theme( data: ThemeData( checkboxTheme: CheckboxThemeData( - fillColor: MaterialStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { return states.contains(MaterialState.selected) ? themeColor : null; }), ), @@ -356,7 +356,7 @@ void main() { return MaterialApp( theme: ThemeData( checkboxTheme: CheckboxThemeData( - fillColor: MaterialStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { return states.contains(MaterialState.selected) ? fillColor : null; }), ), @@ -647,7 +647,7 @@ void main() { return activeEnabledFillColor; } - final MaterialStateProperty fillColor = MaterialStateColor.resolveWith(getFillColor); + final WidgetStateProperty fillColor = MaterialStateColor.resolveWith(getFillColor); Widget buildFrame({required bool enabled}) { return wrap( @@ -683,7 +683,7 @@ void main() { return Colors.transparent; } - final MaterialStateProperty fillColor = MaterialStateColor.resolveWith(getFillColor); + final WidgetStateProperty fillColor = MaterialStateColor.resolveWith(getFillColor); Widget buildFrame() { return wrap( @@ -802,7 +802,7 @@ void main() { value: active, onChanged: (_) {}, fillColor: const MaterialStatePropertyAll(fillColor), - overlayColor: useOverlay ? MaterialStateProperty.resolveWith(getOverlayColor) : null, + overlayColor: useOverlay ? WidgetStateProperty.resolveWith(getOverlayColor) : null, hoverColor: hoverColor, splashRadius: splashRadius, ), @@ -924,7 +924,7 @@ void main() { value: active, onChanged: (_) {}, fillColor: const MaterialStatePropertyAll(fillColor), - overlayColor: useOverlay ? MaterialStateProperty.resolveWith(getOverlayColor) : null, + overlayColor: useOverlay ? WidgetStateProperty.resolveWith(getOverlayColor) : null, hoverColor: hoverColor, splashRadius: splashRadius, ), diff --git a/packages/flutter/test/material/checkbox_test.dart b/packages/flutter/test/material/checkbox_test.dart index 549abbcfd63..89a3db513db 100644 --- a/packages/flutter/test/material/checkbox_test.dart +++ b/packages/flutter/test/material/checkbox_test.dart @@ -1343,7 +1343,7 @@ void main() { return activeEnabledFillColor; } - final MaterialStateProperty fillColor = MaterialStateColor.resolveWith(getFillColor); + final WidgetStateProperty fillColor = MaterialStateColor.resolveWith(getFillColor); Widget buildFrame({required bool enabled}) { return Material( @@ -1395,7 +1395,7 @@ void main() { return Colors.transparent; } - final MaterialStateProperty fillColor = MaterialStateColor.resolveWith(getFillColor); + final WidgetStateProperty fillColor = MaterialStateColor.resolveWith(getFillColor); Widget buildFrame() { return Material( @@ -1680,7 +1680,7 @@ void main() { value: active, onChanged: (_) {}, fillColor: const MaterialStatePropertyAll(fillColor), - overlayColor: useOverlay ? MaterialStateProperty.resolveWith(getOverlayColor) : null, + overlayColor: useOverlay ? WidgetStateProperty.resolveWith(getOverlayColor) : null, hoverColor: hoverColor, focusColor: focusColor, splashRadius: splashRadius, @@ -1795,7 +1795,7 @@ void main() { value = v; }); }, - overlayColor: MaterialStateProperty.resolveWith(getOverlayColor), + overlayColor: WidgetStateProperty.resolveWith(getOverlayColor), splashRadius: splashRadius, ); }, @@ -2401,7 +2401,7 @@ void main() { home: Material( child: Center( child: Checkbox( - fillColor: MaterialStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return activeBackgroundColor; } @@ -2444,7 +2444,7 @@ void main() { home: Material( child: Center( child: Checkbox( - fillColor: MaterialStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return activeBackgroundColor; } diff --git a/packages/flutter/test/material/checkbox_theme_test.dart b/packages/flutter/test/material/checkbox_theme_test.dart index 775faf3fc35..8ccfcf6c323 100644 --- a/packages/flutter/test/material/checkbox_theme_test.dart +++ b/packages/flutter/test/material/checkbox_theme_test.dart @@ -101,19 +101,19 @@ void main() { theme: ThemeData( checkboxTheme: CheckboxThemeData( mouseCursor: const MaterialStatePropertyAll(mouseCursor), - fillColor: MaterialStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return selectedFillColor; } return defaultFillColor; }), - checkColor: MaterialStateProperty.resolveWith((Set states) { + checkColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.focused)) { return focusedCheckColor; } return defaultCheckColor; }), - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.focused)) { return focusOverlayColor; } @@ -207,14 +207,14 @@ void main() { theme: ThemeData( checkboxTheme: CheckboxThemeData( mouseCursor: const MaterialStatePropertyAll(themeMouseCursor), - fillColor: MaterialStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return themeSelectedFillColor; } return themeDefaultFillColor; }), checkColor: const MaterialStatePropertyAll(themeCheckColor), - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.focused)) { return themeFocusOverlayColor; } @@ -234,7 +234,7 @@ void main() { value: selected, autofocus: autofocus, mouseCursor: mouseCursor, - fillColor: MaterialStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return selectedFillColor; } @@ -297,7 +297,7 @@ void main() { return MaterialApp( theme: ThemeData( checkboxTheme: CheckboxThemeData( - fillColor: MaterialStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return themeSelectedFillColor; } @@ -348,7 +348,7 @@ void main() { return MaterialApp( theme: ThemeData( checkboxTheme: CheckboxThemeData( - overlayColor: MaterialStateProperty.resolveWith(getOverlayColor), + overlayColor: WidgetStateProperty.resolveWith(getOverlayColor), splashRadius: splashRadius, ), ), @@ -437,9 +437,9 @@ void main() { test('CheckboxThemeData lerp from populated to null parameters', () { final CheckboxThemeData theme = CheckboxThemeData( - fillColor: MaterialStateProperty.all(const Color(0xfffffff0)), - checkColor: MaterialStateProperty.all(const Color(0xfffffff1)), - overlayColor: MaterialStateProperty.all(const Color(0xfffffff2)), + fillColor: WidgetStateProperty.all(const Color(0xfffffff0)), + checkColor: WidgetStateProperty.all(const Color(0xfffffff1)), + overlayColor: WidgetStateProperty.all(const Color(0xfffffff2)), splashRadius: 3.0, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, visualDensity: const VisualDensity(vertical: 1.0, horizontal: 1.0), @@ -464,9 +464,9 @@ void main() { test('CheckboxThemeData lerp from null to populated parameters', () { final CheckboxThemeData theme = CheckboxThemeData( - fillColor: MaterialStateProperty.all(const Color(0xfffffff0)), - checkColor: MaterialStateProperty.all(const Color(0xfffffff1)), - overlayColor: MaterialStateProperty.all(const Color(0xfffffff2)), + fillColor: WidgetStateProperty.all(const Color(0xfffffff0)), + checkColor: WidgetStateProperty.all(const Color(0xfffffff1)), + overlayColor: WidgetStateProperty.all(const Color(0xfffffff2)), splashRadius: 4.0, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, visualDensity: const VisualDensity(vertical: 1.0, horizontal: 1.0), @@ -500,9 +500,9 @@ void main() { test('CheckboxThemeData lerp from populated parameters', () { final CheckboxThemeData themeA = CheckboxThemeData( - fillColor: MaterialStateProperty.all(const Color(0xfffffff0)), - checkColor: MaterialStateProperty.all(const Color(0xfffffff1)), - overlayColor: MaterialStateProperty.all(const Color(0xfffffff2)), + fillColor: WidgetStateProperty.all(const Color(0xfffffff0)), + checkColor: WidgetStateProperty.all(const Color(0xfffffff1)), + overlayColor: WidgetStateProperty.all(const Color(0xfffffff2)), splashRadius: 3.0, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, visualDensity: const VisualDensity(vertical: 1.0, horizontal: 1.0), @@ -510,9 +510,9 @@ void main() { side: const BorderSide(width: 4.0), ); final CheckboxThemeData themeB = CheckboxThemeData( - fillColor: MaterialStateProperty.all(const Color(0xfffffff3)), - checkColor: MaterialStateProperty.all(const Color(0xfffffff4)), - overlayColor: MaterialStateProperty.all(const Color(0xfffffff5)), + fillColor: WidgetStateProperty.all(const Color(0xfffffff3)), + checkColor: WidgetStateProperty.all(const Color(0xfffffff4)), + overlayColor: WidgetStateProperty.all(const Color(0xfffffff5)), splashRadius: 9.0, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, visualDensity: const VisualDensity(vertical: 2.0, horizontal: 2.0), diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index 9078b94a27f..c7c0d1d532e 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -4887,7 +4887,7 @@ void main() { child: RawChip( isEnabled: enabled, selected: selected, - color: MaterialStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.disabled) && states.contains(MaterialState.selected)) { return disabledSelectedColor; diff --git a/packages/flutter/test/material/chip_theme_test.dart b/packages/flutter/test/material/chip_theme_test.dart index aa540200735..501745c9bf1 100644 --- a/packages/flutter/test/material/chip_theme_test.dart +++ b/packages/flutter/test/material/chip_theme_test.dart @@ -1102,7 +1102,7 @@ void main() { return MaterialApp( theme: ThemeData( chipTheme: ChipThemeData( - color: MaterialStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.disabled) && states.contains(MaterialState.selected)) { return disabledSelectedColor; diff --git a/packages/flutter/test/material/choice_chip_test.dart b/packages/flutter/test/material/choice_chip_test.dart index 052acddbad4..095361f03fc 100644 --- a/packages/flutter/test/material/choice_chip_test.dart +++ b/packages/flutter/test/material/choice_chip_test.dart @@ -416,7 +416,7 @@ void main() { const Color disabledColor = Color(0xff00ff00); const Color backgroundColor = Color(0xff0000ff); const Color selectedColor = Color(0xffff0000); - final MaterialStateProperty color = MaterialStateProperty.resolveWith(( + final WidgetStateProperty color = WidgetStateProperty.resolveWith(( Set states, ) { if (states.contains(MaterialState.disabled) && states.contains(MaterialState.selected)) { diff --git a/packages/flutter/test/material/data_table_test.dart b/packages/flutter/test/material/data_table_test.dart index 40b4c682fd4..0f794d13f73 100644 --- a/packages/flutter/test/material/data_table_test.dart +++ b/packages/flutter/test/material/data_table_test.dart @@ -1355,7 +1355,7 @@ void main() { rows: [ DataRow( selected: selected, - color: MaterialStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return selectedColor; } @@ -1395,7 +1395,7 @@ void main() { onSelectChanged: (bool? value) {}, ), DataRow( - color: MaterialStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.disabled)) { return disabledColor; } @@ -1431,7 +1431,7 @@ void main() { columns: const [DataColumn(label: Text('Column1'))], rows: [ DataRow( - color: MaterialStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.pressed)) { return pressedColor; } @@ -1467,7 +1467,7 @@ void main() { columns: const [DataColumn(label: Text('Column1'))], rows: [ DataRow( - color: MaterialStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.pressed)) { return pressedColor; } @@ -1783,7 +1783,7 @@ void main() { rows: [ DataRow( selected: selected, - color: MaterialStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return selectedColor; } @@ -1948,7 +1948,7 @@ void main() { columns: [ // This column can be sorted. DataColumn( - mouseCursor: MaterialStateProperty.resolveWith((Set states) { + mouseCursor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.disabled)) { return SystemMouseCursors.forbidden; } @@ -1960,7 +1960,7 @@ void main() { ), // This column cannot be sorted. DataColumn( - mouseCursor: MaterialStateProperty.resolveWith((Set states) { + mouseCursor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.disabled)) { return SystemMouseCursors.forbidden; } @@ -2014,7 +2014,7 @@ void main() { rows: [ // This row can be selected. DataRow( - mouseCursor: MaterialStateProperty.resolveWith((Set states) { + mouseCursor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return SystemMouseCursors.copy; } @@ -2027,7 +2027,7 @@ void main() { DataRow( selected: true, onSelectChanged: (bool? selected) {}, - mouseCursor: MaterialStateProperty.resolveWith((Set states) { + mouseCursor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.selected)) { return SystemMouseCursors.copy; } diff --git a/packages/flutter/test/material/data_table_theme_test.dart b/packages/flutter/test/material/data_table_theme_test.dart index b4450b92251..e2e7c8c85eb 100644 --- a/packages/flutter/test/material/data_table_theme_test.dart +++ b/packages/flutter/test/material/data_table_theme_test.dart @@ -84,13 +84,13 @@ void main() { final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder(); DataTableThemeData( decoration: const BoxDecoration(color: Color(0xfffffff0)), - dataRowColor: MaterialStateProperty.resolveWith( + dataRowColor: WidgetStateProperty.resolveWith( (Set states) => const Color(0xfffffff1), ), dataRowMinHeight: 41.0, dataRowMaxHeight: 42.0, dataTextStyle: const TextStyle(fontSize: 12.0), - headingRowColor: MaterialStateProperty.resolveWith( + headingRowColor: WidgetStateProperty.resolveWith( (Set states) => const Color(0xfffffff2), ), headingRowHeight: 52.0, @@ -128,12 +128,12 @@ void main() { testWidgets('DataTable is themeable', (WidgetTester tester) async { const BoxDecoration decoration = BoxDecoration(color: Color(0xfffffff0)); - const MaterialStateProperty dataRowColor = MaterialStatePropertyAll( + const WidgetStateProperty dataRowColor = MaterialStatePropertyAll( Color(0xfffffff1), ); const double minMaxDataRowHeight = 41.0; const TextStyle dataTextStyle = TextStyle(fontSize: 12.5); - const MaterialStateProperty headingRowColor = MaterialStatePropertyAll( + const WidgetStateProperty headingRowColor = MaterialStatePropertyAll( Color(0xfffffff2), ); const double headingRowHeight = 52.0; @@ -141,9 +141,9 @@ void main() { const double horizontalMargin = 3.0; const double columnSpacing = 4.0; const double dividerThickness = 5.0; - const MaterialStateProperty headingCellCursor = + const WidgetStateProperty headingCellCursor = MaterialStatePropertyAll(SystemMouseCursors.grab); - const MaterialStateProperty dataRowCursor = MaterialStatePropertyAll( + const WidgetStateProperty dataRowCursor = MaterialStatePropertyAll( SystemMouseCursors.forbidden, ); @@ -269,12 +269,12 @@ void main() { testWidgets('DataTable properties are taken over the theme values', (WidgetTester tester) async { const BoxDecoration themeDecoration = BoxDecoration(color: Color(0xfffffff1)); - const MaterialStateProperty themeDataRowColor = MaterialStatePropertyAll( + const WidgetStateProperty themeDataRowColor = MaterialStatePropertyAll( Color(0xfffffff0), ); const double minMaxThemeDataRowHeight = 50.0; const TextStyle themeDataTextStyle = TextStyle(fontSize: 11.5); - const MaterialStateProperty themeHeadingRowColor = MaterialStatePropertyAll( + const WidgetStateProperty themeHeadingRowColor = MaterialStatePropertyAll( Color(0xfffffff1), ); const double themeHeadingRowHeight = 51.0; @@ -282,18 +282,18 @@ void main() { const double themeHorizontalMargin = 2.0; const double themeColumnSpacing = 3.0; const double themeDividerThickness = 4.0; - const MaterialStateProperty themeHeadingCellCursor = + const WidgetStateProperty themeHeadingCellCursor = MaterialStatePropertyAll(SystemMouseCursors.copy); - const MaterialStateProperty themeDataRowCursor = + const WidgetStateProperty themeDataRowCursor = MaterialStatePropertyAll(SystemMouseCursors.copy); const BoxDecoration decoration = BoxDecoration(color: Color(0xfffffff0)); - const MaterialStateProperty dataRowColor = MaterialStatePropertyAll( + const WidgetStateProperty dataRowColor = MaterialStatePropertyAll( Color(0xfffffff1), ); const double minMaxDataRowHeight = 51.0; const TextStyle dataTextStyle = TextStyle(fontSize: 12.5); - const MaterialStateProperty headingRowColor = MaterialStatePropertyAll( + const WidgetStateProperty headingRowColor = MaterialStatePropertyAll( Color(0xfffffff2), ); const double headingRowHeight = 52.0; @@ -301,9 +301,9 @@ void main() { const double horizontalMargin = 3.0; const double columnSpacing = 4.0; const double dividerThickness = 5.0; - const MaterialStateProperty headingCellCursor = + const WidgetStateProperty headingCellCursor = MaterialStatePropertyAll(SystemMouseCursors.forbidden); - const MaterialStateProperty dataRowCursor = MaterialStatePropertyAll( + const WidgetStateProperty dataRowCursor = MaterialStatePropertyAll( SystemMouseCursors.forbidden, ); @@ -452,12 +452,12 @@ void main() { WidgetTester tester, ) async { const BoxDecoration globalThemeDecoration = BoxDecoration(color: Color(0xfffffff1)); - const MaterialStateProperty globalThemeDataRowColor = MaterialStatePropertyAll( + const WidgetStateProperty globalThemeDataRowColor = MaterialStatePropertyAll( Color(0xfffffff0), ); const double minMaxGlobalThemeDataRowHeight = 50.0; const TextStyle globalThemeDataTextStyle = TextStyle(fontSize: 11.5); - const MaterialStateProperty globalThemeHeadingRowColor = MaterialStatePropertyAll( + const WidgetStateProperty globalThemeHeadingRowColor = MaterialStatePropertyAll( Color(0xfffffff1), ); const double globalThemeHeadingRowHeight = 51.0; @@ -465,18 +465,18 @@ void main() { const double globalThemeHorizontalMargin = 2.0; const double globalThemeColumnSpacing = 3.0; const double globalThemeDividerThickness = 4.0; - const MaterialStateProperty globalHeadingCellCursor = + const WidgetStateProperty globalHeadingCellCursor = MaterialStatePropertyAll(SystemMouseCursors.allScroll); - const MaterialStateProperty globalDataRowCursor = + const WidgetStateProperty globalDataRowCursor = MaterialStatePropertyAll(SystemMouseCursors.allScroll); const BoxDecoration localThemeDecoration = BoxDecoration(color: Color(0xfffffff0)); - const MaterialStateProperty localThemeDataRowColor = MaterialStatePropertyAll( + const WidgetStateProperty localThemeDataRowColor = MaterialStatePropertyAll( Color(0xfffffff1), ); const double minMaxLocalThemeDataRowHeight = 51.0; const TextStyle localThemeDataTextStyle = TextStyle(fontSize: 12.5); - const MaterialStateProperty localThemeHeadingRowColor = MaterialStatePropertyAll( + const WidgetStateProperty localThemeHeadingRowColor = MaterialStatePropertyAll( Color(0xfffffff2), ); const double localThemeHeadingRowHeight = 52.0; @@ -484,9 +484,9 @@ void main() { const double localThemeHorizontalMargin = 3.0; const double localThemeColumnSpacing = 4.0; const double localThemeDividerThickness = 5.0; - const MaterialStateProperty localHeadingCellCursor = + const WidgetStateProperty localHeadingCellCursor = MaterialStatePropertyAll(SystemMouseCursors.move); - const MaterialStateProperty localDataRowCursor = + const WidgetStateProperty localDataRowCursor = MaterialStatePropertyAll(SystemMouseCursors.move); await tester.pumpWidget( diff --git a/packages/flutter/test/material/date_picker_theme_test.dart b/packages/flutter/test/material/date_picker_theme_test.dart index b91bfd9edf6..501c7290257 100644 --- a/packages/flutter/test/material/date_picker_theme_test.dart +++ b/packages/flutter/test/material/date_picker_theme_test.dart @@ -965,7 +965,7 @@ void main() { testWidgets('DatePickerDialog resolves DatePickerTheme.dayOverlayColor states', ( WidgetTester tester, ) async { - final MaterialStateProperty dayOverlayColor = MaterialStateProperty.resolveWith(( + final WidgetStateProperty dayOverlayColor = WidgetStateProperty.resolveWith(( Set states, ) { if (states.contains(MaterialState.hovered)) { @@ -1068,7 +1068,7 @@ void main() { testWidgets('DatePickerDialog resolves DatePickerTheme.yearOverlayColor states', ( WidgetTester tester, ) async { - final MaterialStateProperty yearOverlayColor = MaterialStateProperty.resolveWith(( + final WidgetStateProperty yearOverlayColor = WidgetStateProperty.resolveWith(( Set states, ) { if (states.contains(MaterialState.hovered)) { @@ -1147,8 +1147,8 @@ void main() { testWidgets('DateRangePickerDialog resolves DatePickerTheme.rangeSelectionOverlayColor states', ( WidgetTester tester, ) async { - final MaterialStateProperty rangeSelectionOverlayColor = - MaterialStateProperty.resolveWith((Set states) { + final WidgetStateProperty rangeSelectionOverlayColor = + WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.hovered)) { return const Color(0xff00ff00); } @@ -1302,7 +1302,7 @@ void main() { MaterialApp( theme: ThemeData( datePickerTheme: datePickerTheme.copyWith( - yearShape: MaterialStateProperty.all(yearShpae), + yearShape: WidgetStateProperty.all(yearShpae), ), ), home: Directionality( diff --git a/packages/flutter/test/material/dropdown_menu_test.dart b/packages/flutter/test/material/dropdown_menu_test.dart index 10d42cd8aad..c2d4a54ecef 100644 --- a/packages/flutter/test/material/dropdown_menu_test.dart +++ b/packages/flutter/test/material/dropdown_menu_test.dart @@ -144,25 +144,25 @@ void main() { const Color defaultOverlayColor = Color(0xffffff00); final ButtonStyle customButtonStyle = ButtonStyle( - backgroundColor: MaterialStateProperty.resolveWith((Set states) { + backgroundColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.focused)) { return focusedBackgroundColor; } return defaultBackgroundColor; }), - foregroundColor: MaterialStateProperty.resolveWith((Set states) { + foregroundColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.focused)) { return focusedForegroundColor; } return defaultForegroundColor; }), - iconColor: MaterialStateProperty.resolveWith((Set states) { + iconColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.focused)) { return focusedIconColor; } return defaultIconColor; }), - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.focused)) { return focusedOverlayColor; } @@ -378,10 +378,10 @@ void main() { const Color luckyColor = Color(0xff777777); final ButtonStyle singleColorButtonStyle = ButtonStyle( - backgroundColor: MaterialStateProperty.all(luckyColor), - foregroundColor: MaterialStateProperty.all(luckyColor), - iconColor: MaterialStateProperty.all(luckyColor), - overlayColor: MaterialStateProperty.all(luckyColor), + backgroundColor: WidgetStateProperty.all(luckyColor), + foregroundColor: WidgetStateProperty.all(luckyColor), + iconColor: WidgetStateProperty.all(luckyColor), + overlayColor: WidgetStateProperty.all(luckyColor), ); await tester.pumpWidget( @@ -442,8 +442,8 @@ void main() { const Color luckyColor = Color(0xff777777); final ButtonStyle partialButtonStyle = ButtonStyle( - backgroundColor: MaterialStateProperty.all(luckyColor), - foregroundColor: MaterialStateProperty.all(luckyColor), + backgroundColor: WidgetStateProperty.all(luckyColor), + foregroundColor: WidgetStateProperty.all(luckyColor), ); final List> partiallyStyledMenuEntries = diff --git a/packages/flutter/test/material/elevated_button_test.dart b/packages/flutter/test/material/elevated_button_test.dart index 9f3f01dfe00..2c1eba9c6b5 100644 --- a/packages/flutter/test/material/elevated_button_test.dart +++ b/packages/flutter/test/material/elevated_button_test.dart @@ -468,7 +468,7 @@ void main() { child: ElevatedButtonTheme( data: ElevatedButtonThemeData( style: ButtonStyle( - foregroundColor: MaterialStateProperty.resolveWith(getTextColor), + foregroundColor: WidgetStateProperty.resolveWith(getTextColor), ), ), child: Builder( @@ -544,8 +544,8 @@ void main() { child: ElevatedButtonTheme( data: ElevatedButtonThemeData( style: ButtonStyle( - foregroundColor: MaterialStateProperty.resolveWith(getTextColor), - iconColor: MaterialStateProperty.resolveWith(getTextColor), + foregroundColor: WidgetStateProperty.resolveWith(getTextColor), + iconColor: WidgetStateProperty.resolveWith(getTextColor), ), ), child: Builder( @@ -863,7 +863,7 @@ void main() { textDirection: TextDirection.ltr, child: ElevatedButton( style: ButtonStyle( - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { return states.contains(MaterialState.hovered) ? hoverColor : null; }), ), @@ -893,7 +893,7 @@ void main() { textDirection: TextDirection.ltr, child: ElevatedButton( style: ButtonStyle( - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { return states.contains(MaterialState.focused) ? focusColor : null; }), ), @@ -930,7 +930,7 @@ void main() { child: ElevatedButton( autofocus: true, style: ButtonStyle( - overlayColor: MaterialStateProperty.resolveWith(getOverlayColor), + overlayColor: WidgetStateProperty.resolveWith(getOverlayColor), ), focusNode: focusNode, onPressed: () {}, diff --git a/packages/flutter/test/material/elevated_button_theme_test.dart b/packages/flutter/test/material/elevated_button_theme_test.dart index 0e9cdb3540c..24f207beba5 100644 --- a/packages/flutter/test/material/elevated_button_theme_test.dart +++ b/packages/flutter/test/material/elevated_button_theme_test.dart @@ -194,11 +194,11 @@ void main() { expect(material.shadowColor, shadowColor); expect(material.elevation, elevation); expect( - MaterialStateProperty.resolveAs(inkWell.mouseCursor!, enabled), + WidgetStateProperty.resolveAs(inkWell.mouseCursor!, enabled), enabledMouseCursor, ); expect( - MaterialStateProperty.resolveAs(inkWell.mouseCursor!, disabled), + WidgetStateProperty.resolveAs(inkWell.mouseCursor!, disabled), disabledMouseCursor, ); expect(inkWell.overlayColor!.resolve(hovered), foregroundColor.withOpacity(0.08)); diff --git a/packages/flutter/test/material/filled_button_test.dart b/packages/flutter/test/material/filled_button_test.dart index 307717f89d7..5ba97a75661 100644 --- a/packages/flutter/test/material/filled_button_test.dart +++ b/packages/flutter/test/material/filled_button_test.dart @@ -655,7 +655,7 @@ void main() { child: FilledButtonTheme( data: FilledButtonThemeData( style: ButtonStyle( - foregroundColor: MaterialStateProperty.resolveWith(getTextColor), + foregroundColor: WidgetStateProperty.resolveWith(getTextColor), ), ), child: Builder( @@ -730,8 +730,8 @@ void main() { child: FilledButtonTheme( data: FilledButtonThemeData( style: ButtonStyle( - foregroundColor: MaterialStateProperty.resolveWith(getTextColor), - iconColor: MaterialStateProperty.resolveWith(getTextColor), + foregroundColor: WidgetStateProperty.resolveWith(getTextColor), + iconColor: WidgetStateProperty.resolveWith(getTextColor), ), ), child: Builder( @@ -1045,7 +1045,7 @@ void main() { textDirection: TextDirection.ltr, child: FilledButton( style: ButtonStyle( - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { return states.contains(MaterialState.hovered) ? hoverColor : null; }), ), @@ -1075,7 +1075,7 @@ void main() { textDirection: TextDirection.ltr, child: FilledButton( style: ButtonStyle( - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { return states.contains(MaterialState.focused) ? focusColor : null; }), ), @@ -1111,7 +1111,7 @@ void main() { child: FilledButton( autofocus: true, style: ButtonStyle( - overlayColor: MaterialStateProperty.resolveWith(getOverlayColor), + overlayColor: WidgetStateProperty.resolveWith(getOverlayColor), ), focusNode: focusNode, onPressed: () {}, diff --git a/packages/flutter/test/material/filled_button_theme_test.dart b/packages/flutter/test/material/filled_button_theme_test.dart index 94700d13646..756606bcf19 100644 --- a/packages/flutter/test/material/filled_button_theme_test.dart +++ b/packages/flutter/test/material/filled_button_theme_test.dart @@ -151,11 +151,11 @@ void main() { expect(material.shadowColor, shadowColor); expect(material.elevation, elevation); expect( - MaterialStateProperty.resolveAs(inkWell.mouseCursor!, enabled), + WidgetStateProperty.resolveAs(inkWell.mouseCursor!, enabled), enabledMouseCursor, ); expect( - MaterialStateProperty.resolveAs(inkWell.mouseCursor!, disabled), + WidgetStateProperty.resolveAs(inkWell.mouseCursor!, disabled), disabledMouseCursor, ); expect(inkWell.overlayColor!.resolve(hovered), foregroundColor.withOpacity(0.08)); diff --git a/packages/flutter/test/material/filter_chip_test.dart b/packages/flutter/test/material/filter_chip_test.dart index 63c3601022d..6ef23825492 100644 --- a/packages/flutter/test/material/filter_chip_test.dart +++ b/packages/flutter/test/material/filter_chip_test.dart @@ -471,7 +471,7 @@ void main() { const Color disabledColor = Color(0xff00ff00); const Color backgroundColor = Color(0xff0000ff); const Color selectedColor = Color(0xffff0000); - final MaterialStateProperty color = MaterialStateProperty.resolveWith(( + final WidgetStateProperty color = WidgetStateProperty.resolveWith(( Set states, ) { if (states.contains(MaterialState.disabled) && states.contains(MaterialState.selected)) { diff --git a/packages/flutter/test/material/floating_action_button_theme_test.dart b/packages/flutter/test/material/floating_action_button_theme_test.dart index 90cd46ada09..d61967cbf91 100644 --- a/packages/flutter/test/material/floating_action_button_theme_test.dart +++ b/packages/flutter/test/material/floating_action_button_theme_test.dart @@ -547,7 +547,7 @@ void main() { MaterialApp( theme: ThemeData().copyWith( floatingActionButtonTheme: FloatingActionButtonThemeData( - mouseCursor: MaterialStateProperty.all(SystemMouseCursors.text), + mouseCursor: WidgetStateProperty.all(SystemMouseCursors.text), ), ), home: Scaffold( diff --git a/packages/flutter/test/material/icon_button_test.dart b/packages/flutter/test/material/icon_button_test.dart index 55e3b216c12..82e50240d04 100644 --- a/packages/flutter/test/material/icon_button_test.dart +++ b/packages/flutter/test/material/icon_button_test.dart @@ -2133,7 +2133,7 @@ void main() { body: Center( child: IconButton( style: ButtonStyle( - foregroundColor: MaterialStateProperty.resolveWith(getIconColor), + foregroundColor: WidgetStateProperty.resolveWith(getIconColor), ), isSelected: isSelected, onPressed: () { diff --git a/packages/flutter/test/material/icon_button_theme_test.dart b/packages/flutter/test/material/icon_button_theme_test.dart index 5673c705c29..5ba091b0179 100644 --- a/packages/flutter/test/material/icon_button_theme_test.dart +++ b/packages/flutter/test/material/icon_button_theme_test.dart @@ -145,11 +145,11 @@ void main() { expect(material.shadowColor, shadowColor); expect(material.elevation, elevation); expect( - MaterialStateProperty.resolveAs(inkWell.mouseCursor, enabled), + WidgetStateProperty.resolveAs(inkWell.mouseCursor, enabled), enabledMouseCursor, ); expect( - MaterialStateProperty.resolveAs(inkWell.mouseCursor, disabled), + WidgetStateProperty.resolveAs(inkWell.mouseCursor, disabled), disabledMouseCursor, ); expect(inkWell.overlayColor!.resolve(hovered), foregroundColor.withOpacity(0.08)); diff --git a/packages/flutter/test/material/ink_well_test.dart b/packages/flutter/test/material/ink_well_test.dart index d46165eee4c..bbae1f7b9be 100644 --- a/packages/flutter/test/material/ink_well_test.dart +++ b/packages/flutter/test/material/ink_well_test.dart @@ -236,7 +236,7 @@ void main() { width: 100, height: 100, child: InkWell( - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.hovered)) { return const Color(0xff00ff00); } @@ -329,7 +329,7 @@ void main() { height: 100, child: InkWell( focusNode: focusNode, - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.hovered)) { return const Color(0xff00ff00); } @@ -381,7 +381,7 @@ void main() { height: 100, child: InkWell( splashFactory: NoSplash.splashFactory, - overlayColor: MaterialStateProperty.resolveWith((Set states) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.pressed)) { return pressedColor; } @@ -571,7 +571,7 @@ void main() { width: 100, height: 100, child: InkWell( - overlayColor: MaterialStateProperty.resolveWith(( + overlayColor: WidgetStateProperty.resolveWith(( Set states, ) { if (states.contains(MaterialState.hovered)) { @@ -2420,9 +2420,7 @@ void main() { width: 100, height: 100, child: InkWell( - overlayColor: MaterialStateProperty.resolveWith(( - Set states, - ) { + overlayColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.hovered)) { return const Color(0xff00ff00); } diff --git a/packages/flutter/test/material/input_chip_test.dart b/packages/flutter/test/material/input_chip_test.dart index a1fcadf04d7..fe6200e6058 100644 --- a/packages/flutter/test/material/input_chip_test.dart +++ b/packages/flutter/test/material/input_chip_test.dart @@ -128,7 +128,7 @@ void main() { child: InputChip( onSelected: enabled ? (bool value) {} : null, selected: selected, - color: MaterialStateProperty.resolveWith((Set states) { + color: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.disabled) && states.contains(MaterialState.selected)) { return disabledSelectedColor; diff --git a/packages/flutter/test/material/input_decorator_test.dart b/packages/flutter/test/material/input_decorator_test.dart index 11f0be146d9..fef32caef7b 100644 --- a/packages/flutter/test/material/input_decorator_test.dart +++ b/packages/flutter/test/material/input_decorator_test.dart @@ -10125,7 +10125,7 @@ void main() { const Color iconErrorColor = Color(0xffff0000); const Color iconColor = Color(0xff00ff00); final ButtonStyle iconButtonStyle = ButtonStyle( - foregroundColor: MaterialStateProperty.resolveWith((Set states) { + foregroundColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.error)) { return iconErrorColor; } @@ -10167,7 +10167,7 @@ void main() { const Color iconErrorColor = Color(0xffff0000); const Color iconColor = Color(0xff00ff00); final ButtonStyle iconButtonStyle = ButtonStyle( - foregroundColor: MaterialStateProperty.resolveWith((Set states) { + foregroundColor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.error)) { return iconErrorColor; } diff --git a/packages/flutter/test/material/list_tile_theme_test.dart b/packages/flutter/test/material/list_tile_theme_test.dart index e5ddc072fb0..dc4da022563 100644 --- a/packages/flutter/test/material/list_tile_theme_test.dart +++ b/packages/flutter/test/material/list_tile_theme_test.dart @@ -230,7 +230,7 @@ void main() { iconColor: iconColor, textColor: textColor, minVerticalPadding: 25.0, - mouseCursor: MaterialStateProperty.resolveWith((Set states) { + mouseCursor: WidgetStateProperty.resolveWith((Set states) { if (states.contains(MaterialState.disabled)) { return SystemMouseCursors.forbidden; } diff --git a/packages/flutter/test/material/menu_anchor_test.dart b/packages/flutter/test/material/menu_anchor_test.dart index 15448db8520..9a7b950c7d0 100644 --- a/packages/flutter/test/material/menu_anchor_test.dart +++ b/packages/flutter/test/material/menu_anchor_test.dart @@ -506,7 +506,7 @@ void main() { menuChildren: [ MenuItemButton( style: ButtonStyle( - minimumSize: MaterialStateProperty.all(const Size.fromHeight(1000)), + minimumSize: WidgetStateProperty.all(const Size.fromHeight(1000)), ), onPressed: () {}, child: const Text('Category'), @@ -544,7 +544,7 @@ void main() { menuChildren: [ MenuItemButton( style: ButtonStyle( - minimumSize: MaterialStateProperty.all(const Size.fromHeight(1000)), + minimumSize: WidgetStateProperty.all(const Size.fromHeight(1000)), ), onPressed: () {}, child: const Text('Category'), @@ -1097,7 +1097,7 @@ void main() { Expanded( child: MenuBar( style: MenuStyle( - elevation: MaterialStateProperty.all(10), + elevation: WidgetStateProperty.all(10), backgroundColor: const MaterialStatePropertyAll(Colors.red), ), children: createTestMenus(onPressed: onPressed), @@ -2992,13 +2992,13 @@ void main() { testWidgets('diagnostics', (WidgetTester tester) async { final ButtonStyle style = ButtonStyle( - shape: MaterialStateProperty.all(const StadiumBorder()), - elevation: MaterialStateProperty.all(10.0), + shape: WidgetStateProperty.all(const StadiumBorder()), + elevation: WidgetStateProperty.all(10.0), backgroundColor: const MaterialStatePropertyAll(Colors.red), ); final MenuStyle menuStyle = MenuStyle( - shape: MaterialStateProperty.all(const RoundedRectangleBorder()), - elevation: MaterialStateProperty.all(20.0), + shape: WidgetStateProperty.all(const RoundedRectangleBorder()), + elevation: WidgetStateProperty.all(20.0), backgroundColor: const MaterialStatePropertyAll(Colors.green), ); await tester.pumpWidget( diff --git a/packages/flutter/test/material/navigation_bar_test.dart b/packages/flutter/test/material/navigation_bar_test.dart index fbb954ffd75..94590f65866 100644 --- a/packages/flutter/test/material/navigation_bar_test.dart +++ b/packages/flutter/test/material/navigation_bar_test.dart @@ -1086,7 +1086,7 @@ void main() { const Color hoverColor = Color(0xff0000ff); const Color focusColor = Color(0xff00ffff); const Color pressedColor = Color(0xffff00ff); - final MaterialStateProperty overlayColor = MaterialStateProperty.resolveWith(( + final WidgetStateProperty overlayColor = WidgetStateProperty.resolveWith(( Set states, ) { if (states.contains(MaterialState.hovered)) {