Deprecate toggleableActiveColor
(#97972)
This commit is contained in:
parent
c6bb9cc0b8
commit
52829523d6
@ -30,7 +30,6 @@ ThemeData _buildDarkTheme() {
|
|||||||
primaryColorDark: const Color(0xFF0050a0),
|
primaryColorDark: const Color(0xFF0050a0),
|
||||||
primaryColorLight: secondaryColor,
|
primaryColorLight: secondaryColor,
|
||||||
indicatorColor: Colors.white,
|
indicatorColor: Colors.white,
|
||||||
toggleableActiveColor: const Color(0xFF6997DF),
|
|
||||||
canvasColor: const Color(0xFF202124),
|
canvasColor: const Color(0xFF202124),
|
||||||
scaffoldBackgroundColor: const Color(0xFF202124),
|
scaffoldBackgroundColor: const Color(0xFF202124),
|
||||||
backgroundColor: const Color(0xFF202124),
|
backgroundColor: const Color(0xFF202124),
|
||||||
@ -54,7 +53,6 @@ ThemeData _buildLightTheme() {
|
|||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme,
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
indicatorColor: Colors.white,
|
indicatorColor: Colors.white,
|
||||||
toggleableActiveColor: const Color(0xFF1E88E5),
|
|
||||||
splashColor: Colors.white24,
|
splashColor: Colors.white24,
|
||||||
splashFactory: InkRipple.splashFactory,
|
splashFactory: InkRipple.splashFactory,
|
||||||
canvasColor: Colors.white,
|
canvasColor: Colors.white,
|
||||||
|
@ -17,6 +17,438 @@
|
|||||||
|
|
||||||
version: 1
|
version: 1
|
||||||
transforms:
|
transforms:
|
||||||
|
# Changes made in https://github.com/flutter/flutter/pull/97972/
|
||||||
|
- title: "Migrate 'ThemeData.toggleableActiveColor' to individual themes"
|
||||||
|
date: 2022-05-18
|
||||||
|
element:
|
||||||
|
uris: [ 'material.dart' ]
|
||||||
|
constructor: ''
|
||||||
|
inClass: 'ThemeData'
|
||||||
|
changes:
|
||||||
|
- kind: 'removeParameter'
|
||||||
|
name: 'toggleableActiveColor'
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 96
|
||||||
|
name: 'checkboxTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "CheckboxThemeData(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && checkboxTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 97
|
||||||
|
name: 'checkboxTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% checkboxTheme %}.copyWith(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && checkboxTheme != ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 98
|
||||||
|
name: 'radioTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "RadioThemeData(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && radioTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 99
|
||||||
|
name: 'radioTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% radioTheme %}.copyWith(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && radioTheme != ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 100
|
||||||
|
name: 'switchTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "SwitchThemeData(\n
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && switchTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 101
|
||||||
|
name: 'switchTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% switchTheme %}.copyWith(\n
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && switchTheme != ''"
|
||||||
|
variables:
|
||||||
|
checkboxTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[checkboxTheme]'
|
||||||
|
radioTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[radioTheme]'
|
||||||
|
switchTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[switchTheme]'
|
||||||
|
toggleableActiveColor:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[toggleableActiveColor]'
|
||||||
|
|
||||||
|
# Changes made in https://github.com/flutter/flutter/pull/97972/
|
||||||
|
- title: "Migrate 'ThemeData.raw.toggleableActiveColor' to individual themes"
|
||||||
|
date: 2022-05-18
|
||||||
|
element:
|
||||||
|
uris: [ 'material.dart' ]
|
||||||
|
constructor: 'raw'
|
||||||
|
inClass: 'ThemeData'
|
||||||
|
changes:
|
||||||
|
- kind: 'removeParameter'
|
||||||
|
name: 'toggleableActiveColor'
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 96
|
||||||
|
name: 'checkboxTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "CheckboxThemeData(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && checkboxTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 97
|
||||||
|
name: 'checkboxTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% checkboxTheme %}.copyWith(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && checkboxTheme != ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 98
|
||||||
|
name: 'radioTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "RadioThemeData(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && radioTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 99
|
||||||
|
name: 'radioTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% radioTheme %}.copyWith(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && radioTheme != ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 100
|
||||||
|
name: 'switchTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "SwitchThemeData(\n
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && switchTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 101
|
||||||
|
name: 'switchTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% switchTheme %}.copyWith(\n
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && switchTheme != ''"
|
||||||
|
variables:
|
||||||
|
checkboxTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[checkboxTheme]'
|
||||||
|
radioTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[radioTheme]'
|
||||||
|
switchTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[switchTheme]'
|
||||||
|
toggleableActiveColor:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[toggleableActiveColor]'
|
||||||
|
|
||||||
|
# Changes made in https://github.com/flutter/flutter/pull/97972/
|
||||||
|
- title: "Migrate 'ThemeData.copyWith.toggleableActiveColor' to individual themes"
|
||||||
|
date: 2022-05-18
|
||||||
|
element:
|
||||||
|
uris: [ 'material.dart' ]
|
||||||
|
method: 'copyWith'
|
||||||
|
inClass: 'ThemeData'
|
||||||
|
changes:
|
||||||
|
- kind: 'removeParameter'
|
||||||
|
name: 'toggleableActiveColor'
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 96
|
||||||
|
name: 'checkboxTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "CheckboxThemeData(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && checkboxTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 97
|
||||||
|
name: 'checkboxTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% checkboxTheme %}.copyWith(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && checkboxTheme != ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 98
|
||||||
|
name: 'radioTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "RadioThemeData(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && radioTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 99
|
||||||
|
name: 'radioTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% radioTheme %}.copyWith(\n
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && radioTheme != ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 100
|
||||||
|
name: 'switchTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "SwitchThemeData(\n
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && switchTheme == ''"
|
||||||
|
- kind: 'addParameter'
|
||||||
|
index: 101
|
||||||
|
name: 'switchTheme'
|
||||||
|
style: optional_named
|
||||||
|
argumentValue:
|
||||||
|
expression: "{% switchTheme %}.copyWith(\n
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {\n
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}\n
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return {% toggleableActiveColor %};
|
||||||
|
}\n
|
||||||
|
return null;\n
|
||||||
|
}),\n
|
||||||
|
)"
|
||||||
|
requiredIf: "toggleableActiveColor != '' && switchTheme != ''"
|
||||||
|
variables:
|
||||||
|
checkboxTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[checkboxTheme]'
|
||||||
|
radioTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[radioTheme]'
|
||||||
|
switchTheme:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[switchTheme]'
|
||||||
|
toggleableActiveColor:
|
||||||
|
kind: 'fragment'
|
||||||
|
value: 'arguments[toggleableActiveColor]'
|
||||||
|
|
||||||
# Changes made in https://github.com/flutter/flutter/pull/105291
|
# Changes made in https://github.com/flutter/flutter/pull/105291
|
||||||
- title: "Migrate 'ElevatedButton.styleFrom(primary)' to 'ElevatedButton.styleFrom(backgroundColor)'"
|
- title: "Migrate 'ElevatedButton.styleFrom(primary)' to 'ElevatedButton.styleFrom(backgroundColor)'"
|
||||||
date: 2022-05-27
|
date: 2022-05-27
|
||||||
|
@ -147,7 +147,7 @@ class Checkbox extends StatefulWidget {
|
|||||||
|
|
||||||
/// The color to use when this checkbox is checked.
|
/// The color to use when this checkbox is checked.
|
||||||
///
|
///
|
||||||
/// Defaults to [ThemeData.toggleableActiveColor].
|
/// Defaults to [ColorScheme.secondary].
|
||||||
///
|
///
|
||||||
/// If [fillColor] returns a non-null color in the [MaterialState.selected]
|
/// If [fillColor] returns a non-null color in the [MaterialState.selected]
|
||||||
/// state, it will be used instead of this color.
|
/// state, it will be used instead of this color.
|
||||||
@ -185,7 +185,7 @@ class Checkbox extends StatefulWidget {
|
|||||||
/// If null, then the value of [activeColor] is used in the selected
|
/// If null, then the value of [activeColor] is used in the selected
|
||||||
/// state. If that is also null, the value of [CheckboxThemeData.fillColor]
|
/// state. If that is also null, the value of [CheckboxThemeData.fillColor]
|
||||||
/// is used. If that is also null, then [ThemeData.disabledColor] is used in
|
/// is used. If that is also null, then [ThemeData.disabledColor] is used in
|
||||||
/// the disabled state, [ThemeData.toggleableActiveColor] is used in the
|
/// the disabled state, [ColorScheme.secondary] is used in the
|
||||||
/// selected state, and [ThemeData.unselectedWidgetColor] is used in the
|
/// selected state, and [ThemeData.unselectedWidgetColor] is used in the
|
||||||
/// default state.
|
/// default state.
|
||||||
final MaterialStateProperty<Color?>? fillColor;
|
final MaterialStateProperty<Color?>? fillColor;
|
||||||
@ -272,7 +272,7 @@ class Checkbox extends StatefulWidget {
|
|||||||
/// [kRadialReactionAlpha], [focusColor] and [hoverColor] is used in the
|
/// [kRadialReactionAlpha], [focusColor] and [hoverColor] is used in the
|
||||||
/// pressed, focused and hovered state. If that is also null,
|
/// pressed, focused and hovered state. If that is also null,
|
||||||
/// the value of [CheckboxThemeData.overlayColor] is used. If that is
|
/// the value of [CheckboxThemeData.overlayColor] is used. If that is
|
||||||
/// also null, then the value of [ThemeData.toggleableActiveColor] with alpha
|
/// also null, then the value of [ColorScheme.secondary] with alpha
|
||||||
/// [kRadialReactionAlpha], [ThemeData.focusColor] and [ThemeData.hoverColor]
|
/// [kRadialReactionAlpha], [ThemeData.focusColor] and [ThemeData.hoverColor]
|
||||||
/// is used in the pressed, focused and hovered state.
|
/// is used in the pressed, focused and hovered state.
|
||||||
final MaterialStateProperty<Color?>? overlayColor;
|
final MaterialStateProperty<Color?>? overlayColor;
|
||||||
@ -385,7 +385,7 @@ class _CheckboxState extends State<Checkbox> with TickerProviderStateMixin, Togg
|
|||||||
return themeData.disabledColor;
|
return themeData.disabledColor;
|
||||||
}
|
}
|
||||||
if (states.contains(MaterialState.selected)) {
|
if (states.contains(MaterialState.selected)) {
|
||||||
return themeData.toggleableActiveColor;
|
return themeData.colorScheme.secondary;
|
||||||
}
|
}
|
||||||
return themeData.unselectedWidgetColor;
|
return themeData.unselectedWidgetColor;
|
||||||
});
|
});
|
||||||
|
@ -5,8 +5,10 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
import 'checkbox.dart';
|
import 'checkbox.dart';
|
||||||
|
import 'checkbox_theme.dart';
|
||||||
import 'list_tile.dart';
|
import 'list_tile.dart';
|
||||||
import 'list_tile_theme.dart';
|
import 'list_tile_theme.dart';
|
||||||
|
import 'material_state.dart';
|
||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
import 'theme_data.dart';
|
import 'theme_data.dart';
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ import 'theme_data.dart';
|
|||||||
///
|
///
|
||||||
/// The [selected] property on this widget is similar to the [ListTile.selected]
|
/// The [selected] property on this widget is similar to the [ListTile.selected]
|
||||||
/// property. This tile's [activeColor] is used for the selected item's text color, or
|
/// property. This tile's [activeColor] is used for the selected item's text color, or
|
||||||
/// the theme's [ThemeData.toggleableActiveColor] if [activeColor] is null.
|
/// the theme's [CheckboxThemeData.overlayColor] if [activeColor] is null.
|
||||||
///
|
///
|
||||||
/// This widget does not coordinate the [selected] state and the [value] state; to have the list tile
|
/// This widget does not coordinate the [selected] state and the [value] state; to have the list tile
|
||||||
/// appear selected when the checkbox is checked, pass the same value to both.
|
/// appear selected when the checkbox is checked, pass the same value to both.
|
||||||
@ -372,10 +374,17 @@ class CheckboxListTile extends StatelessWidget {
|
|||||||
trailing = control;
|
trailing = control;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
final ThemeData theme = Theme.of(context);
|
||||||
|
final CheckboxThemeData checkboxTheme = CheckboxTheme.of(context);
|
||||||
|
final Set<MaterialState> states = <MaterialState>{
|
||||||
|
if (selected) MaterialState.selected,
|
||||||
|
};
|
||||||
|
final Color effectiveActiveColor = activeColor
|
||||||
|
?? checkboxTheme.fillColor?.resolve(states)
|
||||||
|
?? theme.colorScheme.secondary;
|
||||||
return MergeSemantics(
|
return MergeSemantics(
|
||||||
child: ListTileTheme.merge(
|
|
||||||
selectedColor: activeColor ?? Theme.of(context).toggleableActiveColor,
|
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
selectedColor: effectiveActiveColor,
|
||||||
leading: leading,
|
leading: leading,
|
||||||
title: title,
|
title: title,
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
@ -394,7 +403,6 @@ class CheckboxListTile extends StatelessWidget {
|
|||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
enableFeedback: enableFeedback,
|
enableFeedback: enableFeedback,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ class Radio<T> extends StatefulWidget {
|
|||||||
|
|
||||||
/// The color to use when this radio button is selected.
|
/// The color to use when this radio button is selected.
|
||||||
///
|
///
|
||||||
/// Defaults to [ThemeData.toggleableActiveColor].
|
/// Defaults to [ColorScheme.secondary].
|
||||||
///
|
///
|
||||||
/// If [fillColor] returns a non-null color in the [MaterialState.selected]
|
/// If [fillColor] returns a non-null color in the [MaterialState.selected]
|
||||||
/// state, it will be used instead of this color.
|
/// state, it will be used instead of this color.
|
||||||
@ -214,7 +214,7 @@ class Radio<T> extends StatefulWidget {
|
|||||||
/// If null, then the value of [activeColor] is used in the selected state. If
|
/// If null, then the value of [activeColor] is used in the selected state. If
|
||||||
/// that is also null, then the value of [RadioThemeData.fillColor] is used.
|
/// that is also null, then the value of [RadioThemeData.fillColor] is used.
|
||||||
/// If that is also null, then [ThemeData.disabledColor] is used in
|
/// If that is also null, then [ThemeData.disabledColor] is used in
|
||||||
/// the disabled state, [ThemeData.toggleableActiveColor] is used in the
|
/// the disabled state, [ColorScheme.secondary] is used in the
|
||||||
/// selected state, and [ThemeData.unselectedWidgetColor] is used in the
|
/// selected state, and [ThemeData.unselectedWidgetColor] is used in the
|
||||||
/// default state.
|
/// default state.
|
||||||
final MaterialStateProperty<Color?>? fillColor;
|
final MaterialStateProperty<Color?>? fillColor;
|
||||||
@ -281,7 +281,7 @@ class Radio<T> extends StatefulWidget {
|
|||||||
/// [kRadialReactionAlpha], [focusColor] and [hoverColor] is used in the
|
/// [kRadialReactionAlpha], [focusColor] and [hoverColor] is used in the
|
||||||
/// pressed, focused and hovered state. If that is also null,
|
/// pressed, focused and hovered state. If that is also null,
|
||||||
/// the value of [RadioThemeData.overlayColor] is used. If that is also null,
|
/// the value of [RadioThemeData.overlayColor] is used. If that is also null,
|
||||||
/// then the value of [ThemeData.toggleableActiveColor] with alpha
|
/// then the value of [ColorScheme.secondary] with alpha
|
||||||
/// [kRadialReactionAlpha], [ThemeData.focusColor] and [ThemeData.hoverColor]
|
/// [kRadialReactionAlpha], [ThemeData.focusColor] and [ThemeData.hoverColor]
|
||||||
/// is used in the pressed, focused and hovered state.
|
/// is used in the pressed, focused and hovered state.
|
||||||
final MaterialStateProperty<Color?>? overlayColor;
|
final MaterialStateProperty<Color?>? overlayColor;
|
||||||
@ -361,7 +361,7 @@ class _RadioState<T> extends State<Radio<T>> with TickerProviderStateMixin, Togg
|
|||||||
return themeData.disabledColor;
|
return themeData.disabledColor;
|
||||||
}
|
}
|
||||||
if (states.contains(MaterialState.selected)) {
|
if (states.contains(MaterialState.selected)) {
|
||||||
return themeData.toggleableActiveColor;
|
return themeData.colorScheme.secondary;
|
||||||
}
|
}
|
||||||
return themeData.unselectedWidgetColor;
|
return themeData.unselectedWidgetColor;
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,9 @@ import 'package:flutter/widgets.dart';
|
|||||||
|
|
||||||
import 'list_tile.dart';
|
import 'list_tile.dart';
|
||||||
import 'list_tile_theme.dart';
|
import 'list_tile_theme.dart';
|
||||||
|
import 'material_state.dart';
|
||||||
import 'radio.dart';
|
import 'radio.dart';
|
||||||
|
import 'radio_theme.dart';
|
||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
import 'theme_data.dart';
|
import 'theme_data.dart';
|
||||||
|
|
||||||
@ -346,10 +348,17 @@ class RadioListTile<T> extends StatelessWidget {
|
|||||||
trailing = control;
|
trailing = control;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
final ThemeData theme = Theme.of(context);
|
||||||
|
final RadioThemeData radioThemeData = RadioTheme.of(context);
|
||||||
|
final Set<MaterialState> states = <MaterialState>{
|
||||||
|
if (selected) MaterialState.selected,
|
||||||
|
};
|
||||||
|
final Color effectiveActiveColor = activeColor
|
||||||
|
?? radioThemeData.fillColor?.resolve(states)
|
||||||
|
?? theme.colorScheme.secondary;
|
||||||
return MergeSemantics(
|
return MergeSemantics(
|
||||||
child: ListTileTheme.merge(
|
|
||||||
selectedColor: activeColor ?? Theme.of(context).toggleableActiveColor,
|
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
selectedColor: effectiveActiveColor,
|
||||||
leading: leading,
|
leading: leading,
|
||||||
title: title,
|
title: title,
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
@ -376,7 +385,6 @@ class RadioListTile<T> extends StatelessWidget {
|
|||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
enableFeedback: enableFeedback,
|
enableFeedback: enableFeedback,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ class Switch extends StatelessWidget {
|
|||||||
|
|
||||||
/// The color to use when this switch is on.
|
/// The color to use when this switch is on.
|
||||||
///
|
///
|
||||||
/// Defaults to [ThemeData.toggleableActiveColor].
|
/// Defaults to [ColorScheme.secondary].
|
||||||
///
|
///
|
||||||
/// If [thumbColor] returns a non-null color in the [MaterialState.selected]
|
/// If [thumbColor] returns a non-null color in the [MaterialState.selected]
|
||||||
/// state, it will be used instead of this color.
|
/// state, it will be used instead of this color.
|
||||||
@ -190,7 +190,7 @@ class Switch extends StatelessWidget {
|
|||||||
|
|
||||||
/// The color to use on the track when this switch is on.
|
/// The color to use on the track when this switch is on.
|
||||||
///
|
///
|
||||||
/// Defaults to [ThemeData.toggleableActiveColor] with the opacity set at 50%.
|
/// Defaults to [ColorScheme.secondary] with the opacity set at 50%.
|
||||||
///
|
///
|
||||||
/// Ignored if this switch is created with [Switch.adaptive].
|
/// Ignored if this switch is created with [Switch.adaptive].
|
||||||
///
|
///
|
||||||
@ -273,7 +273,7 @@ class Switch extends StatelessWidget {
|
|||||||
/// | State | Light theme | Dark theme |
|
/// | State | Light theme | Dark theme |
|
||||||
/// |----------|-----------------------------------|-----------------------------------|
|
/// |----------|-----------------------------------|-----------------------------------|
|
||||||
/// | Default | `Colors.grey.shade50` | `Colors.grey.shade400` |
|
/// | Default | `Colors.grey.shade50` | `Colors.grey.shade400` |
|
||||||
/// | Selected | [ThemeData.toggleableActiveColor] | [ThemeData.toggleableActiveColor] |
|
/// | Selected | [ColorScheme.secondary] | [ColorScheme.secondary] |
|
||||||
/// | Disabled | `Colors.grey.shade400` | `Colors.grey.shade800` |
|
/// | Disabled | `Colors.grey.shade400` | `Colors.grey.shade800` |
|
||||||
final MaterialStateProperty<Color?>? thumbColor;
|
final MaterialStateProperty<Color?>? thumbColor;
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ class Switch extends StatelessWidget {
|
|||||||
/// [kRadialReactionAlpha], [focusColor] and [hoverColor] is used in the
|
/// [kRadialReactionAlpha], [focusColor] and [hoverColor] is used in the
|
||||||
/// pressed, focused and hovered state. If that is also null,
|
/// pressed, focused and hovered state. If that is also null,
|
||||||
/// the value of [SwitchThemeData.overlayColor] is used. If that is
|
/// the value of [SwitchThemeData.overlayColor] is used. If that is
|
||||||
/// also null, then the value of [ThemeData.toggleableActiveColor] with alpha
|
/// also null, then the value of [ColorScheme.secondary] with alpha
|
||||||
/// [kRadialReactionAlpha], [ThemeData.focusColor] and [ThemeData.hoverColor]
|
/// [kRadialReactionAlpha], [ThemeData.focusColor] and [ThemeData.hoverColor]
|
||||||
/// is used in the pressed, focused and hovered state.
|
/// is used in the pressed, focused and hovered state.
|
||||||
final MaterialStateProperty<Color?>? overlayColor;
|
final MaterialStateProperty<Color?>? overlayColor;
|
||||||
@ -614,7 +614,7 @@ class _MaterialSwitchState extends State<_MaterialSwitch> with TickerProviderSta
|
|||||||
return isDark ? Colors.grey.shade800 : Colors.grey.shade400;
|
return isDark ? Colors.grey.shade800 : Colors.grey.shade400;
|
||||||
}
|
}
|
||||||
if (states.contains(MaterialState.selected)) {
|
if (states.contains(MaterialState.selected)) {
|
||||||
return theme.toggleableActiveColor;
|
return theme.colorScheme.secondary;
|
||||||
}
|
}
|
||||||
return isDark ? Colors.grey.shade400 : Colors.grey.shade50;
|
return isDark ? Colors.grey.shade400 : Colors.grey.shade50;
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,9 @@ import 'package:flutter/widgets.dart';
|
|||||||
|
|
||||||
import 'list_tile.dart';
|
import 'list_tile.dart';
|
||||||
import 'list_tile_theme.dart';
|
import 'list_tile_theme.dart';
|
||||||
|
import 'material_state.dart';
|
||||||
import 'switch.dart';
|
import 'switch.dart';
|
||||||
|
import 'switch_theme.dart';
|
||||||
import 'theme.dart';
|
import 'theme.dart';
|
||||||
import 'theme_data.dart';
|
import 'theme_data.dart';
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ enum _SwitchListTileType { material, adaptive }
|
|||||||
///
|
///
|
||||||
/// The [selected] property on this widget is similar to the [ListTile.selected]
|
/// The [selected] property on this widget is similar to the [ListTile.selected]
|
||||||
/// property. This tile's [activeColor] is used for the selected item's text color, or
|
/// property. This tile's [activeColor] is used for the selected item's text color, or
|
||||||
/// the theme's [ThemeData.toggleableActiveColor] if [activeColor] is null.
|
/// the theme's [SwitchThemeData.overlayColor] if [activeColor] is null.
|
||||||
///
|
///
|
||||||
/// This widget does not coordinate the [selected] state and the
|
/// This widget does not coordinate the [selected] state and the
|
||||||
/// [value]; to have the list tile appear selected when the
|
/// [value]; to have the list tile appear selected when the
|
||||||
@ -423,10 +425,17 @@ class SwitchListTile extends StatelessWidget {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final ThemeData theme = Theme.of(context);
|
||||||
|
final SwitchThemeData switchTheme = SwitchTheme.of(context);
|
||||||
|
final Set<MaterialState> states = <MaterialState>{
|
||||||
|
if (selected) MaterialState.selected,
|
||||||
|
};
|
||||||
|
final Color effectiveActiveColor = activeColor
|
||||||
|
?? switchTheme.thumbColor?.resolve(states)
|
||||||
|
?? theme.colorScheme.secondary;
|
||||||
return MergeSemantics(
|
return MergeSemantics(
|
||||||
child: ListTileTheme.merge(
|
|
||||||
selectedColor: activeColor ?? Theme.of(context).toggleableActiveColor,
|
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
selectedColor: effectiveActiveColor,
|
||||||
leading: leading,
|
leading: leading,
|
||||||
title: title,
|
title: title,
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
@ -446,7 +455,6 @@ class SwitchListTile extends StatelessWidget {
|
|||||||
enableFeedback: enableFeedback,
|
enableFeedback: enableFeedback,
|
||||||
hoverColor: hoverColor,
|
hoverColor: hoverColor,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,6 @@ class ThemeData with Diagnosticable {
|
|||||||
Color? selectedRowColor,
|
Color? selectedRowColor,
|
||||||
Color? shadowColor,
|
Color? shadowColor,
|
||||||
Color? splashColor,
|
Color? splashColor,
|
||||||
Color? toggleableActiveColor,
|
|
||||||
Color? unselectedWidgetColor,
|
Color? unselectedWidgetColor,
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
String? fontFamily,
|
String? fontFamily,
|
||||||
@ -405,6 +404,13 @@ class ThemeData with Diagnosticable {
|
|||||||
'This feature was deprecated after v2.13.0-0.0.pre.'
|
'This feature was deprecated after v2.13.0-0.0.pre.'
|
||||||
)
|
)
|
||||||
AndroidOverscrollIndicator? androidOverscrollIndicator,
|
AndroidOverscrollIndicator? androidOverscrollIndicator,
|
||||||
|
@Deprecated(
|
||||||
|
'No longer used by the framework, please remove any reference to it. '
|
||||||
|
'For more information, consult the migration guide at '
|
||||||
|
'https://flutter.dev/docs/release/breaking-changes/toggleable-active-color#migration-guide. '
|
||||||
|
'This feature was deprecated after v2.13.0-0.4.pre.',
|
||||||
|
)
|
||||||
|
Color? toggleableActiveColor,
|
||||||
}) {
|
}) {
|
||||||
// GENERAL CONFIGURATION
|
// GENERAL CONFIGURATION
|
||||||
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
|
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
|
||||||
@ -614,7 +620,6 @@ class ThemeData with Diagnosticable {
|
|||||||
selectedRowColor: selectedRowColor,
|
selectedRowColor: selectedRowColor,
|
||||||
shadowColor: shadowColor,
|
shadowColor: shadowColor,
|
||||||
splashColor: splashColor,
|
splashColor: splashColor,
|
||||||
toggleableActiveColor: toggleableActiveColor,
|
|
||||||
unselectedWidgetColor: unselectedWidgetColor,
|
unselectedWidgetColor: unselectedWidgetColor,
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
iconTheme: iconTheme,
|
iconTheme: iconTheme,
|
||||||
@ -665,6 +670,7 @@ class ThemeData with Diagnosticable {
|
|||||||
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
|
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel,
|
||||||
primaryColorBrightness: primaryColorBrightness,
|
primaryColorBrightness: primaryColorBrightness,
|
||||||
androidOverscrollIndicator: androidOverscrollIndicator,
|
androidOverscrollIndicator: androidOverscrollIndicator,
|
||||||
|
toggleableActiveColor: toggleableActiveColor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,7 +725,6 @@ class ThemeData with Diagnosticable {
|
|||||||
required this.selectedRowColor,
|
required this.selectedRowColor,
|
||||||
required this.shadowColor,
|
required this.shadowColor,
|
||||||
required this.splashColor,
|
required this.splashColor,
|
||||||
required this.toggleableActiveColor,
|
|
||||||
required this.unselectedWidgetColor,
|
required this.unselectedWidgetColor,
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
required this.iconTheme,
|
required this.iconTheme,
|
||||||
@ -810,6 +815,13 @@ class ThemeData with Diagnosticable {
|
|||||||
'This feature was deprecated after v2.13.0-0.0.pre.'
|
'This feature was deprecated after v2.13.0-0.0.pre.'
|
||||||
)
|
)
|
||||||
this.androidOverscrollIndicator,
|
this.androidOverscrollIndicator,
|
||||||
|
@Deprecated(
|
||||||
|
'No longer used by the framework, please remove any reference to it. '
|
||||||
|
'For more information, consult the migration guide at '
|
||||||
|
'https://flutter.dev/docs/release/breaking-changes/toggleable-active-color#migration-guide. '
|
||||||
|
'This feature was deprecated after v2.13.0-0.4.pre.',
|
||||||
|
)
|
||||||
|
Color? toggleableActiveColor,
|
||||||
}) : // DEPRECATED (newest deprecations at the bottom)
|
}) : // DEPRECATED (newest deprecations at the bottom)
|
||||||
// should not be `required`, use getter pattern to avoid breakages.
|
// should not be `required`, use getter pattern to avoid breakages.
|
||||||
_accentColor = accentColor,
|
_accentColor = accentColor,
|
||||||
@ -819,6 +831,7 @@ class ThemeData with Diagnosticable {
|
|||||||
_buttonColor = buttonColor,
|
_buttonColor = buttonColor,
|
||||||
_fixTextFieldOutlineLabel = fixTextFieldOutlineLabel,
|
_fixTextFieldOutlineLabel = fixTextFieldOutlineLabel,
|
||||||
_primaryColorBrightness = primaryColorBrightness,
|
_primaryColorBrightness = primaryColorBrightness,
|
||||||
|
_toggleableActiveColor = toggleableActiveColor,
|
||||||
// GENERAL CONFIGURATION
|
// GENERAL CONFIGURATION
|
||||||
assert(applyElevationOverlayColor != null),
|
assert(applyElevationOverlayColor != null),
|
||||||
assert(extensions != null),
|
assert(extensions != null),
|
||||||
@ -1341,7 +1354,8 @@ class ThemeData with Diagnosticable {
|
|||||||
|
|
||||||
/// The color used to highlight the active states of toggleable widgets like
|
/// The color used to highlight the active states of toggleable widgets like
|
||||||
/// [Switch], [Radio], and [Checkbox].
|
/// [Switch], [Radio], and [Checkbox].
|
||||||
final Color toggleableActiveColor;
|
Color get toggleableActiveColor => _toggleableActiveColor!;
|
||||||
|
final Color? _toggleableActiveColor;
|
||||||
|
|
||||||
/// The color used for widgets in their inactive (but enabled)
|
/// The color used for widgets in their inactive (but enabled)
|
||||||
/// state. For example, an unchecked checkbox. See also [disabledColor].
|
/// state. For example, an unchecked checkbox. See also [disabledColor].
|
||||||
@ -1673,7 +1687,6 @@ class ThemeData with Diagnosticable {
|
|||||||
Color? selectedRowColor,
|
Color? selectedRowColor,
|
||||||
Color? shadowColor,
|
Color? shadowColor,
|
||||||
Color? splashColor,
|
Color? splashColor,
|
||||||
Color? toggleableActiveColor,
|
|
||||||
Color? unselectedWidgetColor,
|
Color? unselectedWidgetColor,
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
IconThemeData? iconTheme,
|
IconThemeData? iconTheme,
|
||||||
@ -1764,6 +1777,13 @@ class ThemeData with Diagnosticable {
|
|||||||
'This feature was deprecated after v2.13.0-0.0.pre.'
|
'This feature was deprecated after v2.13.0-0.0.pre.'
|
||||||
)
|
)
|
||||||
AndroidOverscrollIndicator? androidOverscrollIndicator,
|
AndroidOverscrollIndicator? androidOverscrollIndicator,
|
||||||
|
@Deprecated(
|
||||||
|
'No longer used by the framework, please remove any reference to it. '
|
||||||
|
'For more information, consult the migration guide at '
|
||||||
|
'https://flutter.dev/docs/release/breaking-changes/toggleable-active-color#migration-guide. '
|
||||||
|
'This feature was deprecated after v2.13.0-0.4.pre.',
|
||||||
|
)
|
||||||
|
Color? toggleableActiveColor,
|
||||||
}) {
|
}) {
|
||||||
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
|
cupertinoOverrideTheme = cupertinoOverrideTheme?.noDefault();
|
||||||
return ThemeData.raw(
|
return ThemeData.raw(
|
||||||
@ -1807,7 +1827,6 @@ class ThemeData with Diagnosticable {
|
|||||||
selectedRowColor: selectedRowColor ?? this.selectedRowColor,
|
selectedRowColor: selectedRowColor ?? this.selectedRowColor,
|
||||||
shadowColor: shadowColor ?? this.shadowColor,
|
shadowColor: shadowColor ?? this.shadowColor,
|
||||||
splashColor: splashColor ?? this.splashColor,
|
splashColor: splashColor ?? this.splashColor,
|
||||||
toggleableActiveColor: toggleableActiveColor ?? this.toggleableActiveColor,
|
|
||||||
unselectedWidgetColor: unselectedWidgetColor ?? this.unselectedWidgetColor,
|
unselectedWidgetColor: unselectedWidgetColor ?? this.unselectedWidgetColor,
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
iconTheme: iconTheme ?? this.iconTheme,
|
iconTheme: iconTheme ?? this.iconTheme,
|
||||||
@ -1858,6 +1877,7 @@ class ThemeData with Diagnosticable {
|
|||||||
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? this.fixTextFieldOutlineLabel,
|
fixTextFieldOutlineLabel: fixTextFieldOutlineLabel ?? this.fixTextFieldOutlineLabel,
|
||||||
primaryColorBrightness: primaryColorBrightness ?? this.primaryColorBrightness,
|
primaryColorBrightness: primaryColorBrightness ?? this.primaryColorBrightness,
|
||||||
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
|
androidOverscrollIndicator: androidOverscrollIndicator ?? this.androidOverscrollIndicator,
|
||||||
|
toggleableActiveColor: toggleableActiveColor ?? this.toggleableActiveColor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2005,7 +2025,6 @@ class ThemeData with Diagnosticable {
|
|||||||
selectedRowColor: Color.lerp(a.selectedRowColor, b.selectedRowColor, t)!,
|
selectedRowColor: Color.lerp(a.selectedRowColor, b.selectedRowColor, t)!,
|
||||||
shadowColor: Color.lerp(a.shadowColor, b.shadowColor, t)!,
|
shadowColor: Color.lerp(a.shadowColor, b.shadowColor, t)!,
|
||||||
splashColor: Color.lerp(a.splashColor, b.splashColor, t)!,
|
splashColor: Color.lerp(a.splashColor, b.splashColor, t)!,
|
||||||
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t)!,
|
|
||||||
unselectedWidgetColor: Color.lerp(a.unselectedWidgetColor, b.unselectedWidgetColor, t)!,
|
unselectedWidgetColor: Color.lerp(a.unselectedWidgetColor, b.unselectedWidgetColor, t)!,
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
iconTheme: IconThemeData.lerp(a.iconTheme, b.iconTheme, t),
|
iconTheme: IconThemeData.lerp(a.iconTheme, b.iconTheme, t),
|
||||||
@ -2056,6 +2075,7 @@ class ThemeData with Diagnosticable {
|
|||||||
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
|
fixTextFieldOutlineLabel: t < 0.5 ? a.fixTextFieldOutlineLabel : b.fixTextFieldOutlineLabel,
|
||||||
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
|
primaryColorBrightness: t < 0.5 ? a.primaryColorBrightness : b.primaryColorBrightness,
|
||||||
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
|
androidOverscrollIndicator:t < 0.5 ? a.androidOverscrollIndicator : b.androidOverscrollIndicator,
|
||||||
|
toggleableActiveColor: Color.lerp(a.toggleableActiveColor, b.toggleableActiveColor, t),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2105,7 +2125,6 @@ class ThemeData with Diagnosticable {
|
|||||||
other.selectedRowColor == selectedRowColor &&
|
other.selectedRowColor == selectedRowColor &&
|
||||||
other.shadowColor == shadowColor &&
|
other.shadowColor == shadowColor &&
|
||||||
other.splashColor == splashColor &&
|
other.splashColor == splashColor &&
|
||||||
other.toggleableActiveColor == toggleableActiveColor &&
|
|
||||||
other.unselectedWidgetColor == unselectedWidgetColor &&
|
other.unselectedWidgetColor == unselectedWidgetColor &&
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
other.iconTheme == iconTheme &&
|
other.iconTheme == iconTheme &&
|
||||||
@ -2155,7 +2174,8 @@ class ThemeData with Diagnosticable {
|
|||||||
other.buttonColor == buttonColor &&
|
other.buttonColor == buttonColor &&
|
||||||
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
|
other.fixTextFieldOutlineLabel == fixTextFieldOutlineLabel &&
|
||||||
other.primaryColorBrightness == primaryColorBrightness &&
|
other.primaryColorBrightness == primaryColorBrightness &&
|
||||||
other.androidOverscrollIndicator == androidOverscrollIndicator;
|
other.androidOverscrollIndicator == androidOverscrollIndicator &&
|
||||||
|
other.toggleableActiveColor == toggleableActiveColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -2202,7 +2222,6 @@ class ThemeData with Diagnosticable {
|
|||||||
selectedRowColor,
|
selectedRowColor,
|
||||||
shadowColor,
|
shadowColor,
|
||||||
splashColor,
|
splashColor,
|
||||||
toggleableActiveColor,
|
|
||||||
unselectedWidgetColor,
|
unselectedWidgetColor,
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
iconTheme,
|
iconTheme,
|
||||||
@ -2253,6 +2272,7 @@ class ThemeData with Diagnosticable {
|
|||||||
fixTextFieldOutlineLabel,
|
fixTextFieldOutlineLabel,
|
||||||
primaryColorBrightness,
|
primaryColorBrightness,
|
||||||
androidOverscrollIndicator,
|
androidOverscrollIndicator,
|
||||||
|
toggleableActiveColor,
|
||||||
];
|
];
|
||||||
return Object.hashAll(values);
|
return Object.hashAll(values);
|
||||||
}
|
}
|
||||||
@ -2301,7 +2321,6 @@ class ThemeData with Diagnosticable {
|
|||||||
properties.add(ColorProperty('selectedRowColor', selectedRowColor, defaultValue: defaultData.selectedRowColor, level: DiagnosticLevel.debug));
|
properties.add(ColorProperty('selectedRowColor', selectedRowColor, defaultValue: defaultData.selectedRowColor, level: DiagnosticLevel.debug));
|
||||||
properties.add(ColorProperty('shadowColor', shadowColor, defaultValue: defaultData.shadowColor, level: DiagnosticLevel.debug));
|
properties.add(ColorProperty('shadowColor', shadowColor, defaultValue: defaultData.shadowColor, level: DiagnosticLevel.debug));
|
||||||
properties.add(ColorProperty('splashColor', splashColor, defaultValue: defaultData.splashColor, level: DiagnosticLevel.debug));
|
properties.add(ColorProperty('splashColor', splashColor, defaultValue: defaultData.splashColor, level: DiagnosticLevel.debug));
|
||||||
properties.add(ColorProperty('toggleableActiveColor', toggleableActiveColor, defaultValue: defaultData.toggleableActiveColor, level: DiagnosticLevel.debug));
|
|
||||||
properties.add(ColorProperty('unselectedWidgetColor', unselectedWidgetColor, defaultValue: defaultData.unselectedWidgetColor, level: DiagnosticLevel.debug));
|
properties.add(ColorProperty('unselectedWidgetColor', unselectedWidgetColor, defaultValue: defaultData.unselectedWidgetColor, level: DiagnosticLevel.debug));
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
properties.add(DiagnosticsProperty<IconThemeData>('iconTheme', iconTheme, level: DiagnosticLevel.debug));
|
properties.add(DiagnosticsProperty<IconThemeData>('iconTheme', iconTheme, level: DiagnosticLevel.debug));
|
||||||
@ -2352,6 +2371,7 @@ class ThemeData with Diagnosticable {
|
|||||||
properties.add(DiagnosticsProperty<bool>('fixTextFieldOutlineLabel', fixTextFieldOutlineLabel, level: DiagnosticLevel.debug));
|
properties.add(DiagnosticsProperty<bool>('fixTextFieldOutlineLabel', fixTextFieldOutlineLabel, level: DiagnosticLevel.debug));
|
||||||
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, level: DiagnosticLevel.debug));
|
properties.add(EnumProperty<Brightness>('primaryColorBrightness', primaryColorBrightness, defaultValue: defaultData.primaryColorBrightness, level: DiagnosticLevel.debug));
|
||||||
properties.add(EnumProperty<AndroidOverscrollIndicator>('androidOverscrollIndicator', androidOverscrollIndicator, defaultValue: null, level: DiagnosticLevel.debug));
|
properties.add(EnumProperty<AndroidOverscrollIndicator>('androidOverscrollIndicator', androidOverscrollIndicator, defaultValue: null, level: DiagnosticLevel.debug));
|
||||||
|
properties.add(ColorProperty('toggleableActiveColor', toggleableActiveColor, defaultValue: defaultData.toggleableActiveColor, level: DiagnosticLevel.debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('CheckboxListTile checkColor test', (WidgetTester tester) async {
|
testWidgets('CheckboxListTile checkColor test', (WidgetTester tester) async {
|
||||||
const Color checkBoxBorderColor = Color(0xff1e88e5);
|
const Color checkBoxBorderColor = Color(0xff2196f3);
|
||||||
Color checkBoxCheckColor = const Color(0xffFFFFFF);
|
Color checkBoxCheckColor = const Color(0xffFFFFFF);
|
||||||
|
|
||||||
Widget buildFrame(Color? color) {
|
Widget buildFrame(Color? color) {
|
||||||
@ -68,7 +68,13 @@ void main() {
|
|||||||
Widget buildFrame(Color? themeColor, Color? activeColor) {
|
Widget buildFrame(Color? themeColor, Color? activeColor) {
|
||||||
return wrap(
|
return wrap(
|
||||||
child: Theme(
|
child: Theme(
|
||||||
data: ThemeData(toggleableActiveColor: themeColor),
|
data: ThemeData(
|
||||||
|
checkboxTheme: CheckboxThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
return states.contains(MaterialState.selected) ? themeColor : null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
child: CheckboxListTile(
|
child: CheckboxListTile(
|
||||||
value: true,
|
value: true,
|
||||||
activeColor: activeColor,
|
activeColor: activeColor,
|
||||||
@ -291,10 +297,14 @@ void main() {
|
|||||||
|
|
||||||
const Color activeColor = Color(0xff00ff00);
|
const Color activeColor = Color(0xff00ff00);
|
||||||
|
|
||||||
Widget buildFrame({ Color? activeColor, Color? toggleableActiveColor }) {
|
Widget buildFrame({ Color? activeColor, Color? fillColor }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light().copyWith(
|
||||||
toggleableActiveColor: toggleableActiveColor,
|
checkboxTheme: CheckboxThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
return states.contains(MaterialState.selected) ? fillColor : null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
@ -314,7 +324,7 @@ void main() {
|
|||||||
return tester.renderObject<RenderParagraph>(find.text(text)).text.style?.color;
|
return tester.renderObject<RenderParagraph>(find.text(text)).text.style?.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(buildFrame(toggleableActiveColor: activeColor));
|
await tester.pumpWidget(buildFrame(fillColor: activeColor));
|
||||||
expect(textColor('title'), activeColor);
|
expect(textColor('title'), activeColor);
|
||||||
|
|
||||||
await tester.pumpWidget(buildFrame(activeColor: activeColor));
|
await tester.pumpWidget(buildFrame(activeColor: activeColor));
|
||||||
|
@ -353,7 +353,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('CheckBox color rendering', (WidgetTester tester) async {
|
testWidgets('CheckBox color rendering', (WidgetTester tester) async {
|
||||||
const Color borderColor = Color(0xff1e88e5);
|
const Color borderColor = Color(0xff2196f3);
|
||||||
Color checkColor = const Color(0xffFFFFFF);
|
Color checkColor = const Color(0xffFFFFFF);
|
||||||
Color activeColor;
|
Color activeColor;
|
||||||
|
|
||||||
@ -391,7 +391,11 @@ void main() {
|
|||||||
|
|
||||||
activeColor = const Color(0xFF00FF00);
|
activeColor = const Color(0xFF00FF00);
|
||||||
|
|
||||||
await tester.pumpWidget(buildFrame(themeData: ThemeData(toggleableActiveColor: activeColor)));
|
await tester.pumpWidget(buildFrame(
|
||||||
|
themeData: ThemeData(
|
||||||
|
colorScheme: const ColorScheme.light()
|
||||||
|
.copyWith(secondary: activeColor))),
|
||||||
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(getCheckboxRenderer(), paints..path(color: activeColor)); // paints's color is 0xFF00FF00 (theme)
|
expect(getCheckboxRenderer(), paints..path(color: activeColor)); // paints's color is 0xFF00FF00 (theme)
|
||||||
|
|
||||||
@ -435,7 +439,7 @@ void main() {
|
|||||||
Material.of(tester.element(find.byType(Checkbox))),
|
Material.of(tester.element(find.byType(Checkbox))),
|
||||||
paints
|
paints
|
||||||
..circle(color: Colors.orange[500])
|
..circle(color: Colors.orange[500])
|
||||||
..path(color: const Color(0xff1e88e5))
|
..path(color: const Color(0xff2196f3))
|
||||||
..path(color: Colors.white),
|
..path(color: Colors.white),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -526,7 +530,7 @@ void main() {
|
|||||||
expect(
|
expect(
|
||||||
Material.of(tester.element(find.byType(Checkbox))),
|
Material.of(tester.element(find.byType(Checkbox))),
|
||||||
paints
|
paints
|
||||||
..path(color: const Color(0xff1e88e5))
|
..path(color: const Color(0xff2196f3))
|
||||||
..path(color: const Color(0xffffffff),style: PaintingStyle.stroke, strokeWidth: 2.0),
|
..path(color: const Color(0xffffffff),style: PaintingStyle.stroke, strokeWidth: 2.0),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -539,7 +543,7 @@ void main() {
|
|||||||
expect(
|
expect(
|
||||||
Material.of(tester.element(find.byType(Checkbox))),
|
Material.of(tester.element(find.byType(Checkbox))),
|
||||||
paints
|
paints
|
||||||
..path(color: const Color(0xff1e88e5))
|
..path(color: const Color(0xff2196f3))
|
||||||
..path(color: const Color(0xffffffff), style: PaintingStyle.stroke, strokeWidth: 2.0),
|
..path(color: const Color(0xffffffff), style: PaintingStyle.stroke, strokeWidth: 2.0),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -710,10 +710,14 @@ void main() {
|
|||||||
|
|
||||||
const Color activeColor = Color(0xff00ff00);
|
const Color activeColor = Color(0xff00ff00);
|
||||||
|
|
||||||
Widget buildFrame({ Color? activeColor, Color? toggleableActiveColor }) {
|
Widget buildFrame({ Color? activeColor, Color? fillColor }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light().copyWith(
|
||||||
toggleableActiveColor: toggleableActiveColor,
|
radioTheme: RadioThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
return states.contains(MaterialState.selected) ? fillColor : null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
@ -734,7 +738,7 @@ void main() {
|
|||||||
return tester.renderObject<RenderParagraph>(find.text(text)).text.style?.color;
|
return tester.renderObject<RenderParagraph>(find.text(text)).text.style?.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(buildFrame(toggleableActiveColor: activeColor));
|
await tester.pumpWidget(buildFrame(fillColor: activeColor));
|
||||||
expect(textColor('title'), activeColor);
|
expect(textColor('title'), activeColor);
|
||||||
|
|
||||||
await tester.pumpWidget(buildFrame(activeColor: activeColor));
|
await tester.pumpWidget(buildFrame(activeColor: activeColor));
|
||||||
|
@ -441,8 +441,8 @@ void main() {
|
|||||||
rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0),
|
rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0),
|
||||||
)
|
)
|
||||||
..circle(color: Colors.orange[500])
|
..circle(color: Colors.orange[500])
|
||||||
..circle(color: const Color(0xff1e88e5))
|
..circle(color: const Color(0xff2196f3))
|
||||||
..circle(color: const Color(0xff1e88e5)),
|
..circle(color: const Color(0xff2196f3)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check when the radio isn't selected.
|
// Check when the radio isn't selected.
|
||||||
@ -519,8 +519,8 @@ void main() {
|
|||||||
color: const Color(0xffffffff),
|
color: const Color(0xffffffff),
|
||||||
rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0),
|
rect: const Rect.fromLTRB(350.0, 250.0, 450.0, 350.0),
|
||||||
)
|
)
|
||||||
..circle(color: const Color(0xff1e88e5))
|
..circle(color: const Color(0xff2196f3))
|
||||||
..circle(color: const Color(0xff1e88e5)),
|
..circle(color: const Color(0xff2196f3)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Start hovering
|
// Start hovering
|
||||||
|
@ -400,10 +400,14 @@ void main() {
|
|||||||
|
|
||||||
const Color activeColor = Color(0xff00ff00);
|
const Color activeColor = Color(0xff00ff00);
|
||||||
|
|
||||||
Widget buildFrame({ Color? activeColor, Color? toggleableActiveColor }) {
|
Widget buildFrame({ Color? activeColor, Color? thumbColor }) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData.light().copyWith(
|
theme: ThemeData.light().copyWith(
|
||||||
toggleableActiveColor: toggleableActiveColor,
|
switchTheme: SwitchThemeData(
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
return states.contains(MaterialState.selected) ? thumbColor : null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
@ -423,7 +427,7 @@ void main() {
|
|||||||
return tester.renderObject<RenderParagraph>(find.text(text)).text.style?.color;
|
return tester.renderObject<RenderParagraph>(find.text(text)).text.style?.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
await tester.pumpWidget(buildFrame(toggleableActiveColor: activeColor));
|
await tester.pumpWidget(buildFrame(activeColor: activeColor));
|
||||||
expect(textColor('title'), activeColor);
|
expect(textColor('title'), activeColor);
|
||||||
|
|
||||||
await tester.pumpWidget(buildFrame(activeColor: activeColor));
|
await tester.pumpWidget(buildFrame(activeColor: activeColor));
|
||||||
|
@ -373,13 +373,13 @@ void main() {
|
|||||||
Material.of(tester.element(find.byType(Switch))),
|
Material.of(tester.element(find.byType(Switch))),
|
||||||
paints
|
paints
|
||||||
..rrect(
|
..rrect(
|
||||||
color: Colors.blue[600]!.withAlpha(0x80),
|
color: const Color(0x802196f3),
|
||||||
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
||||||
)
|
)
|
||||||
..circle(color: const Color(0x33000000))
|
..circle(color: const Color(0x33000000))
|
||||||
..circle(color: const Color(0x24000000))
|
..circle(color: const Color(0x24000000))
|
||||||
..circle(color: const Color(0x1f000000))
|
..circle(color: const Color(0x1f000000))
|
||||||
..circle(color: Colors.blue[600]),
|
..circle(color: const Color(0xff2196f3)),
|
||||||
reason: 'Active enabled switch should match these colors',
|
reason: 'Active enabled switch should match these colors',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -806,14 +806,14 @@ void main() {
|
|||||||
Material.of(tester.element(find.byType(Switch))),
|
Material.of(tester.element(find.byType(Switch))),
|
||||||
paints
|
paints
|
||||||
..rrect(
|
..rrect(
|
||||||
color: const Color(0x801e88e5),
|
color: const Color(0x802196f3),
|
||||||
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
||||||
)
|
)
|
||||||
..circle(color: Colors.orange[500])
|
..circle(color: Colors.orange[500])
|
||||||
..circle(color: const Color(0x33000000))
|
..circle(color: const Color(0x33000000))
|
||||||
..circle(color: const Color(0x24000000))
|
..circle(color: const Color(0x24000000))
|
||||||
..circle(color: const Color(0x1f000000))
|
..circle(color: const Color(0x1f000000))
|
||||||
..circle(color: const Color(0xff1e88e5)),
|
..circle(color: const Color(0xff2196f3)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check the false value.
|
// Check the false value.
|
||||||
@ -910,13 +910,13 @@ void main() {
|
|||||||
Material.of(tester.element(find.byType(Switch))),
|
Material.of(tester.element(find.byType(Switch))),
|
||||||
paints
|
paints
|
||||||
..rrect(
|
..rrect(
|
||||||
color: const Color(0x801e88e5),
|
color: const Color(0x802196f3),
|
||||||
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
||||||
)
|
)
|
||||||
..circle(color: const Color(0x33000000))
|
..circle(color: const Color(0x33000000))
|
||||||
..circle(color: const Color(0x24000000))
|
..circle(color: const Color(0x24000000))
|
||||||
..circle(color: const Color(0x1f000000))
|
..circle(color: const Color(0x1f000000))
|
||||||
..circle(color: const Color(0xff1e88e5)),
|
..circle(color: const Color(0xff2196f3)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Start hovering
|
// Start hovering
|
||||||
@ -930,14 +930,14 @@ void main() {
|
|||||||
Material.of(tester.element(find.byType(Switch))),
|
Material.of(tester.element(find.byType(Switch))),
|
||||||
paints
|
paints
|
||||||
..rrect(
|
..rrect(
|
||||||
color: const Color(0x801e88e5),
|
color: const Color(0x802196f3),
|
||||||
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
||||||
)
|
)
|
||||||
..circle(color: Colors.orange[500])
|
..circle(color: Colors.orange[500])
|
||||||
..circle(color: const Color(0x33000000))
|
..circle(color: const Color(0x33000000))
|
||||||
..circle(color: const Color(0x24000000))
|
..circle(color: const Color(0x24000000))
|
||||||
..circle(color: const Color(0x1f000000))
|
..circle(color: const Color(0x1f000000))
|
||||||
..circle(color: const Color(0xff1e88e5)),
|
..circle(color: const Color(0xff2196f3)),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check what happens when disabled.
|
// Check what happens when disabled.
|
||||||
@ -1297,7 +1297,7 @@ void main() {
|
|||||||
Material.of(tester.element(find.byType(Switch))),
|
Material.of(tester.element(find.byType(Switch))),
|
||||||
paints
|
paints
|
||||||
..rrect(
|
..rrect(
|
||||||
color: const Color(0x801e88e5),
|
color: const Color(0x802196f3),
|
||||||
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
||||||
)
|
)
|
||||||
..circle(color: const Color(0x1f000000))
|
..circle(color: const Color(0x1f000000))
|
||||||
@ -1318,7 +1318,7 @@ void main() {
|
|||||||
Material.of(tester.element(find.byType(Switch))),
|
Material.of(tester.element(find.byType(Switch))),
|
||||||
paints
|
paints
|
||||||
..rrect(
|
..rrect(
|
||||||
color: const Color(0x801e88e5),
|
color: const Color(0x802196f3),
|
||||||
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
rrect: RRect.fromLTRBR(13.0, 17.0, 46.0, 31.0, const Radius.circular(7.0)),
|
||||||
)
|
)
|
||||||
..circle(color: const Color(0x1f000000))
|
..circle(color: const Color(0x1f000000))
|
||||||
|
@ -672,7 +672,6 @@ void main() {
|
|||||||
selectedRowColor: Colors.black,
|
selectedRowColor: Colors.black,
|
||||||
shadowColor: Colors.black,
|
shadowColor: Colors.black,
|
||||||
splashColor: Colors.black,
|
splashColor: Colors.black,
|
||||||
toggleableActiveColor: Colors.black,
|
|
||||||
unselectedWidgetColor: Colors.black,
|
unselectedWidgetColor: Colors.black,
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
iconTheme: ThemeData.dark().iconTheme,
|
iconTheme: ThemeData.dark().iconTheme,
|
||||||
@ -723,6 +722,7 @@ void main() {
|
|||||||
fixTextFieldOutlineLabel: false,
|
fixTextFieldOutlineLabel: false,
|
||||||
primaryColorBrightness: Brightness.dark,
|
primaryColorBrightness: Brightness.dark,
|
||||||
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
|
androidOverscrollIndicator: AndroidOverscrollIndicator.glow,
|
||||||
|
toggleableActiveColor: Colors.black,
|
||||||
);
|
);
|
||||||
|
|
||||||
final SliderThemeData otherSliderTheme = SliderThemeData.fromPrimaryColors(
|
final SliderThemeData otherSliderTheme = SliderThemeData.fromPrimaryColors(
|
||||||
@ -782,7 +782,6 @@ void main() {
|
|||||||
selectedRowColor: Colors.white,
|
selectedRowColor: Colors.white,
|
||||||
shadowColor: Colors.white,
|
shadowColor: Colors.white,
|
||||||
splashColor: Colors.white,
|
splashColor: Colors.white,
|
||||||
toggleableActiveColor: Colors.white,
|
|
||||||
unselectedWidgetColor: Colors.white,
|
unselectedWidgetColor: Colors.white,
|
||||||
|
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
@ -836,6 +835,7 @@ void main() {
|
|||||||
fixTextFieldOutlineLabel: true,
|
fixTextFieldOutlineLabel: true,
|
||||||
primaryColorBrightness: Brightness.light,
|
primaryColorBrightness: Brightness.light,
|
||||||
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
|
androidOverscrollIndicator: AndroidOverscrollIndicator.stretch,
|
||||||
|
toggleableActiveColor: Colors.white,
|
||||||
);
|
);
|
||||||
|
|
||||||
final ThemeData themeDataCopy = theme.copyWith(
|
final ThemeData themeDataCopy = theme.copyWith(
|
||||||
@ -880,7 +880,6 @@ void main() {
|
|||||||
selectedRowColor: otherTheme.selectedRowColor,
|
selectedRowColor: otherTheme.selectedRowColor,
|
||||||
shadowColor: otherTheme.shadowColor,
|
shadowColor: otherTheme.shadowColor,
|
||||||
splashColor: otherTheme.splashColor,
|
splashColor: otherTheme.splashColor,
|
||||||
toggleableActiveColor: otherTheme.toggleableActiveColor,
|
|
||||||
unselectedWidgetColor: otherTheme.unselectedWidgetColor,
|
unselectedWidgetColor: otherTheme.unselectedWidgetColor,
|
||||||
|
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
@ -934,6 +933,7 @@ void main() {
|
|||||||
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
|
fixTextFieldOutlineLabel: otherTheme.fixTextFieldOutlineLabel,
|
||||||
primaryColorBrightness: otherTheme.primaryColorBrightness,
|
primaryColorBrightness: otherTheme.primaryColorBrightness,
|
||||||
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
|
androidOverscrollIndicator: otherTheme.androidOverscrollIndicator,
|
||||||
|
toggleableActiveColor: otherTheme.toggleableActiveColor,
|
||||||
);
|
);
|
||||||
|
|
||||||
// For the sanity of the reader, make sure these properties are in the same
|
// For the sanity of the reader, make sure these properties are in the same
|
||||||
@ -977,7 +977,6 @@ void main() {
|
|||||||
expect(themeDataCopy.selectedRowColor, equals(otherTheme.selectedRowColor));
|
expect(themeDataCopy.selectedRowColor, equals(otherTheme.selectedRowColor));
|
||||||
expect(themeDataCopy.shadowColor, equals(otherTheme.shadowColor));
|
expect(themeDataCopy.shadowColor, equals(otherTheme.shadowColor));
|
||||||
expect(themeDataCopy.splashColor, equals(otherTheme.splashColor));
|
expect(themeDataCopy.splashColor, equals(otherTheme.splashColor));
|
||||||
expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor));
|
|
||||||
expect(themeDataCopy.unselectedWidgetColor, equals(otherTheme.unselectedWidgetColor));
|
expect(themeDataCopy.unselectedWidgetColor, equals(otherTheme.unselectedWidgetColor));
|
||||||
|
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
@ -1036,6 +1035,7 @@ void main() {
|
|||||||
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
|
expect(themeDataCopy.fixTextFieldOutlineLabel, equals(otherTheme.fixTextFieldOutlineLabel));
|
||||||
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
|
expect(themeDataCopy.primaryColorBrightness, equals(otherTheme.primaryColorBrightness));
|
||||||
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
|
expect(themeDataCopy.androidOverscrollIndicator, equals(otherTheme.androidOverscrollIndicator));
|
||||||
|
expect(themeDataCopy.toggleableActiveColor, equals(otherTheme.toggleableActiveColor));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('ThemeData.toString has less than 200 characters output', (WidgetTester tester) async {
|
testWidgets('ThemeData.toString has less than 200 characters output', (WidgetTester tester) async {
|
||||||
@ -1115,7 +1115,6 @@ void main() {
|
|||||||
'indicatorColor',
|
'indicatorColor',
|
||||||
'hintColor',
|
'hintColor',
|
||||||
'errorColor',
|
'errorColor',
|
||||||
'toggleableActiveColor',
|
|
||||||
// TYPOGRAPHY & ICONOGRAPHY
|
// TYPOGRAPHY & ICONOGRAPHY
|
||||||
'typography',
|
'typography',
|
||||||
'textTheme',
|
'textTheme',
|
||||||
@ -1165,6 +1164,7 @@ void main() {
|
|||||||
'fixTextFieldOutlineLabel',
|
'fixTextFieldOutlineLabel',
|
||||||
'primaryColorBrightness',
|
'primaryColorBrightness',
|
||||||
'androidOverscrollIndicator',
|
'androidOverscrollIndicator',
|
||||||
|
'toggleableActiveColor',
|
||||||
};
|
};
|
||||||
|
|
||||||
final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder();
|
final DiagnosticPropertiesBuilder properties = DiagnosticPropertiesBuilder();
|
||||||
|
@ -569,4 +569,20 @@ void main() {
|
|||||||
primary: Colors.blue,
|
primary: Colors.blue,
|
||||||
onSurface: Colors.grey,
|
onSurface: Colors.grey,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Changes made in https://github.com/flutter/flutter/pull/97972
|
||||||
|
ThemeData themeData = ThemeData();
|
||||||
|
themeData = ThemeData(toggleableActiveColor: Colors.black);
|
||||||
|
themeData = ThemeData(
|
||||||
|
toggleableActiveColor: Colors.black,
|
||||||
|
);
|
||||||
|
themeData = ThemeData.raw(toggleableActiveColor: Colors.black);
|
||||||
|
themeData = ThemeData.raw(
|
||||||
|
toggleableActiveColor: Colors.black,
|
||||||
|
);
|
||||||
|
themeData = themeData.copyWith(toggleableActiveColor: Colors.black);
|
||||||
|
themeData = themeData.copyWith(
|
||||||
|
toggleableActiveColor: Colors.black,
|
||||||
|
);
|
||||||
|
themeData.toggleableActiveColor; // Removing field reference not supported.
|
||||||
}
|
}
|
||||||
|
@ -538,4 +538,254 @@ void main() {
|
|||||||
ButtonStyle textButtonStyle = TextButton.styleFrom(
|
ButtonStyle textButtonStyle = TextButton.styleFrom(
|
||||||
foregroundColor: Colors.blue, disabledForegroundColor: Colors.grey.withOpacity(0.38),
|
foregroundColor: Colors.blue, disabledForegroundColor: Colors.grey.withOpacity(0.38),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Changes made in https://github.com/flutter/flutter/pull/97972
|
||||||
|
ThemeData themeData = ThemeData();
|
||||||
|
themeData = ThemeData(checkboxTheme: CheckboxThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), radioTheme: RadioThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), switchTheme: SwitchThemeData(
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
));
|
||||||
|
themeData = ThemeData(
|
||||||
|
checkboxTheme: CheckboxThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), radioTheme: RadioThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), switchTheme: SwitchThemeData(
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
themeData = ThemeData.raw(checkboxTheme: CheckboxThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), radioTheme: RadioThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), switchTheme: SwitchThemeData(
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
));
|
||||||
|
themeData = ThemeData.raw(
|
||||||
|
checkboxTheme: CheckboxThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), radioTheme: RadioThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), switchTheme: SwitchThemeData(
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
themeData = themeData.copyWith(checkboxTheme: CheckboxThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), radioTheme: RadioThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), switchTheme: SwitchThemeData(
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
));
|
||||||
|
themeData = themeData.copyWith(
|
||||||
|
checkboxTheme: CheckboxThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), radioTheme: RadioThemeData(
|
||||||
|
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
), switchTheme: SwitchThemeData(
|
||||||
|
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
|
||||||
|
if (states.contains(MaterialState.disabled)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (states.contains(MaterialState.selected)) {
|
||||||
|
return Colors.black;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
themeData.toggleableActiveColor; // Removing field reference not supported.
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user