Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
52829523
Unverified
Commit
52829523
authored
Aug 02, 2022
by
Taha Tesser
Committed by
GitHub
Aug 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate `toggleableActiveColor` (#97972)
parent
c6bb9cc0
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
897 additions
and
135 deletions
+897
-135
themes.dart
...integration_tests/flutter_gallery/lib/gallery/themes.dart
+0
-2
fix_data.yaml
packages/flutter/lib/fix_data.yaml
+432
-0
checkbox.dart
packages/flutter/lib/src/material/checkbox.dart
+4
-4
checkbox_list_tile.dart
packages/flutter/lib/src/material/checkbox_list_tile.dart
+30
-22
radio.dart
packages/flutter/lib/src/material/radio.dart
+4
-4
radio_list_tile.dart
packages/flutter/lib/src/material/radio_list_tile.dart
+37
-29
switch.dart
packages/flutter/lib/src/material/switch.dart
+5
-5
switch_list_tile.dart
packages/flutter/lib/src/material/switch_list_tile.dart
+31
-23
theme_data.dart
packages/flutter/lib/src/material/theme_data.dart
+31
-11
checkbox_list_tile_test.dart
packages/flutter/test/material/checkbox_list_tile_test.dart
+15
-5
checkbox_test.dart
packages/flutter/test/material/checkbox_test.dart
+9
-5
radio_list_tile_test.dart
packages/flutter/test/material/radio_list_tile_test.dart
+7
-3
radio_test.dart
packages/flutter/test/material/radio_test.dart
+4
-4
switch_list_tile_test.dart
packages/flutter/test/material/switch_list_tile_test.dart
+7
-3
switch_test.dart
packages/flutter/test/material/switch_test.dart
+10
-10
theme_data_test.dart
packages/flutter/test/material/theme_data_test.dart
+5
-5
material.dart
packages/flutter/test_fixes/material.dart
+16
-0
material.dart.expect
packages/flutter/test_fixes/material.dart.expect
+250
-0
No files found.
dev/integration_tests/flutter_gallery/lib/gallery/themes.dart
View file @
52829523
...
@@ -30,7 +30,6 @@ ThemeData _buildDarkTheme() {
...
@@ -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() {
...
@@ -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
,
...
...
packages/flutter/lib/fix_data.yaml
View file @
52829523
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/checkbox.dart
View file @
52829523
...
@@ -147,7 +147,7 @@ class Checkbox extends StatefulWidget {
...
@@ -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 {
...
@@ -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 {
...
@@ -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
...
@@ -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
;
});
});
...
...
packages/flutter/lib/src/material/checkbox_list_tile.dart
View file @
52829523
...
@@ -5,8 +5,10 @@
...
@@ -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';
...
@@ -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.toggleableActive
Color] if [activeColor] is null.
/// the theme's [
CheckboxThemeData.overlay
Color] 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,28 +374,34 @@ class CheckboxListTile extends StatelessWidget {
...
@@ -372,28 +374,34 @@ 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
(
child:
ListTile
(
selectedColor:
activeColor
??
Theme
.
of
(
context
).
toggleableActiveColor
,
selectedColor:
effectiveActiveColor
,
child:
ListTile
(
leading:
leading
,
leading:
leading
,
title:
title
,
title:
title
,
subtitle:
subtitle
,
subtitle:
subtitle
,
trailing:
trailing
,
trailing:
trailing
,
isThreeLine:
isThreeLine
,
isThreeLine:
isThreeLine
,
dense:
dense
,
dense:
dense
,
enabled:
enabled
??
onChanged
!=
null
,
enabled:
enabled
??
onChanged
!=
null
,
onTap:
onChanged
!=
null
?
_handleValueChange
:
null
,
onTap:
onChanged
!=
null
?
_handleValueChange
:
null
,
selected:
selected
,
selected:
selected
,
autofocus:
autofocus
,
autofocus:
autofocus
,
contentPadding:
contentPadding
,
contentPadding:
contentPadding
,
shape:
shape
,
shape:
shape
,
selectedTileColor:
selectedTileColor
,
selectedTileColor:
selectedTileColor
,
tileColor:
tileColor
,
tileColor:
tileColor
,
visualDensity:
visualDensity
,
visualDensity:
visualDensity
,
focusNode:
focusNode
,
focusNode:
focusNode
,
enableFeedback:
enableFeedback
,
enableFeedback:
enableFeedback
,
),
),
),
);
);
}
}
...
...
packages/flutter/lib/src/material/radio.dart
View file @
52829523
...
@@ -175,7 +175,7 @@ class Radio<T> extends StatefulWidget {
...
@@ -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 {
...
@@ -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 {
...
@@ -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
...
@@ -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
;
});
});
...
...
packages/flutter/lib/src/material/radio_list_tile.dart
View file @
52829523
...
@@ -6,7 +6,9 @@ import 'package:flutter/widgets.dart';
...
@@ -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,36 +348,42 @@ class RadioListTile<T> extends StatelessWidget {
...
@@ -346,36 +348,42 @@ 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
(
child:
ListTile
(
selectedColor:
activeColor
??
Theme
.
of
(
context
).
toggleableActiveColor
,
selectedColor:
effectiveActiveColor
,
child:
ListTile
(
leading:
leading
,
leading:
leading
,
title:
title
,
title:
title
,
subtitle:
subtitle
,
subtitle:
subtitle
,
trailing:
trailing
,
trailing:
trailing
,
isThreeLine:
isThreeLine
,
isThreeLine:
isThreeLine
,
dense:
dense
,
dense:
dense
,
enabled:
onChanged
!=
null
,
enabled:
onChanged
!=
null
,
shape:
shape
,
shape:
shape
,
tileColor:
tileColor
,
tileColor:
tileColor
,
selectedTileColor:
selectedTileColor
,
selectedTileColor:
selectedTileColor
,
onTap:
onChanged
!=
null
?
()
{
onTap:
onChanged
!=
null
?
()
{
if
(
toggleable
&&
checked
)
{
if
(
toggleable
&&
checked
)
{
onChanged
!(
null
);
onChanged
!(
null
);
return
;
return
;
}
}
if
(!
checked
)
{
if
(!
checked
)
{
onChanged
!(
value
);
onChanged
!(
value
);
}
}
}
:
null
,
}
:
null
,
selected:
selected
,
selected:
selected
,
autofocus:
autofocus
,
autofocus:
autofocus
,
contentPadding:
contentPadding
,
contentPadding:
contentPadding
,
visualDensity:
visualDensity
,
visualDensity:
visualDensity
,
focusNode:
focusNode
,
focusNode:
focusNode
,
enableFeedback:
enableFeedback
,
enableFeedback:
enableFeedback
,
),
),
),
);
);
}
}
...
...
packages/flutter/lib/src/material/switch.dart
View file @
52829523
...
@@ -182,7 +182,7 @@ class Switch extends StatelessWidget {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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
...
@@ -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
;
});
});
...
...
packages/flutter/lib/src/material/switch_list_tile.dart
View file @
52829523
...
@@ -6,7 +6,9 @@ import 'package:flutter/widgets.dart';
...
@@ -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 }
...
@@ -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.toggleableActive
Color] if [activeColor] is null.
/// the theme's [
SwitchThemeData.overlay
Color] 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,29 +425,35 @@ class SwitchListTile extends StatelessWidget {
...
@@ -423,29 +425,35 @@ 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
(
child:
ListTile
(
selectedColor:
activeColor
??
Theme
.
of
(
context
).
toggleableActiveColor
,
selectedColor:
effectiveActiveColor
,
child:
ListTile
(
leading:
leading
,
leading:
leading
,
title:
title
,
title:
title
,
subtitle:
subtitle
,
subtitle:
subtitle
,
trailing:
trailing
,
trailing:
trailing
,
isThreeLine:
isThreeLine
,
isThreeLine:
isThreeLine
,
dense:
dense
,
dense:
dense
,
contentPadding:
contentPadding
,
contentPadding:
contentPadding
,
enabled:
onChanged
!=
null
,
enabled:
onChanged
!=
null
,
onTap:
onChanged
!=
null
?
()
{
onChanged
!(!
value
);
}
:
null
,
onTap:
onChanged
!=
null
?
()
{
onChanged
!(!
value
);
}
:
null
,
selected:
selected
,
selected:
selected
,
selectedTileColor:
selectedTileColor
,
selectedTileColor:
selectedTileColor
,
autofocus:
autofocus
,
autofocus:
autofocus
,
shape:
shape
,
shape:
shape
,
tileColor:
tileColor
,
tileColor:
tileColor
,
visualDensity:
visualDensity
,
visualDensity:
visualDensity
,
focusNode:
focusNode
,
focusNode:
focusNode
,
enableFeedback:
enableFeedback
,
enableFeedback:
enableFeedback
,
hoverColor:
hoverColor
,
hoverColor:
hoverColor
,
),
),
),
);
);
}
}
...
...
packages/flutter/lib/src/material/theme_data.dart
View file @
52829523
...
@@ -313,7 +313,6 @@ class ThemeData with Diagnosticable {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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 {
...
@@ -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
));
}
}
}
}
...
...
packages/flutter/test/material/checkbox_list_tile_test.dart
View file @
52829523
...
@@ -36,7 +36,7 @@ void main() {
...
@@ -36,7 +36,7 @@ void main() {
});
});
testWidgets
(
'CheckboxListTile checkColor test'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'CheckboxListTile checkColor test'
,
(
WidgetTester
tester
)
async
{
const
Color
checkBoxBorderColor
=
Color
(
0xff
1e88e5
);
const
Color
checkBoxBorderColor
=
Color
(
0xff
2196f3
);
Color
checkBoxCheckColor
=
const
Color
(
0xffFFFFFF
);
Color
checkBoxCheckColor
=
const
Color
(
0xffFFFFFF
);
Widget
buildFrame
(
Color
?
color
)
{
Widget
buildFrame
(
Color
?
color
)
{
...
@@ -68,7 +68,13 @@ void main() {
...
@@ -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() {
...
@@ -291,10 +297,14 @@ void main() {
const
Color
activeColor
=
Color
(
0xff00ff00
);
const
Color
activeColor
=
Color
(
0xff00ff00
);
Widget
buildFrame
({
Color
?
activeColor
,
Color
?
toggleableActive
Color
})
{
Widget
buildFrame
({
Color
?
activeColor
,
Color
?
fill
Color
})
{
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() {
...
@@ -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
(
toggleableActive
Color:
activeColor
));
await
tester
.
pumpWidget
(
buildFrame
(
fill
Color:
activeColor
));
expect
(
textColor
(
'title'
),
activeColor
);
expect
(
textColor
(
'title'
),
activeColor
);
await
tester
.
pumpWidget
(
buildFrame
(
activeColor:
activeColor
));
await
tester
.
pumpWidget
(
buildFrame
(
activeColor:
activeColor
));
...
...
packages/flutter/test/material/checkbox_test.dart
View file @
52829523
...
@@ -353,7 +353,7 @@ void main() {
...
@@ -353,7 +353,7 @@ void main() {
});
});
testWidgets
(
'CheckBox color rendering'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'CheckBox color rendering'
,
(
WidgetTester
tester
)
async
{
const
Color
borderColor
=
Color
(
0xff
1e88e5
);
const
Color
borderColor
=
Color
(
0xff
2196f3
);
Color
checkColor
=
const
Color
(
0xffFFFFFF
);
Color
checkColor
=
const
Color
(
0xffFFFFFF
);
Color
activeColor
;
Color
activeColor
;
...
@@ -391,7 +391,11 @@ void main() {
...
@@ -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() {
...
@@ -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
(
0xff
1e88e5
))
..
path
(
color:
const
Color
(
0xff
2196f3
))
..
path
(
color:
Colors
.
white
),
..
path
(
color:
Colors
.
white
),
);
);
...
@@ -526,7 +530,7 @@ void main() {
...
@@ -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
(
0xff
1e88e5
))
..
path
(
color:
const
Color
(
0xff
2196f3
))
..
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() {
...
@@ -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
(
0xff
1e88e5
))
..
path
(
color:
const
Color
(
0xff
2196f3
))
..
path
(
color:
const
Color
(
0xffffffff
),
style:
PaintingStyle
.
stroke
,
strokeWidth:
2.0
),
..
path
(
color:
const
Color
(
0xffffffff
),
style:
PaintingStyle
.
stroke
,
strokeWidth:
2.0
),
);
);
...
...
packages/flutter/test/material/radio_list_tile_test.dart
View file @
52829523
...
@@ -710,10 +710,14 @@ void main() {
...
@@ -710,10 +710,14 @@ void main() {
const
Color
activeColor
=
Color
(
0xff00ff00
);
const
Color
activeColor
=
Color
(
0xff00ff00
);
Widget
buildFrame
({
Color
?
activeColor
,
Color
?
toggleableActive
Color
})
{
Widget
buildFrame
({
Color
?
activeColor
,
Color
?
fill
Color
})
{
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() {
...
@@ -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
(
toggleableActive
Color:
activeColor
));
await
tester
.
pumpWidget
(
buildFrame
(
fill
Color:
activeColor
));
expect
(
textColor
(
'title'
),
activeColor
);
expect
(
textColor
(
'title'
),
activeColor
);
await
tester
.
pumpWidget
(
buildFrame
(
activeColor:
activeColor
));
await
tester
.
pumpWidget
(
buildFrame
(
activeColor:
activeColor
));
...
...
packages/flutter/test/material/radio_test.dart
View file @
52829523
...
@@ -441,8 +441,8 @@ void main() {
...
@@ -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
(
0xff
1e88e5
))
..
circle
(
color:
const
Color
(
0xff
2196f3
))
..
circle
(
color:
const
Color
(
0xff
1e88e5
)),
..
circle
(
color:
const
Color
(
0xff
2196f3
)),
);
);
// Check when the radio isn't selected.
// Check when the radio isn't selected.
...
@@ -519,8 +519,8 @@ void main() {
...
@@ -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
(
0xff
1e88e5
))
..
circle
(
color:
const
Color
(
0xff
2196f3
))
..
circle
(
color:
const
Color
(
0xff
1e88e5
)),
..
circle
(
color:
const
Color
(
0xff
2196f3
)),
);
);
// Start hovering
// Start hovering
...
...
packages/flutter/test/material/switch_list_tile_test.dart
View file @
52829523
...
@@ -400,10 +400,14 @@ void main() {
...
@@ -400,10 +400,14 @@ void main() {
const
Color
activeColor
=
Color
(
0xff00ff00
);
const
Color
activeColor
=
Color
(
0xff00ff00
);
Widget
buildFrame
({
Color
?
activeColor
,
Color
?
t
oggleableActive
Color
})
{
Widget
buildFrame
({
Color
?
activeColor
,
Color
?
t
humb
Color
})
{
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() {
...
@@ -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
(
toggleableA
ctiveColor:
activeColor
));
await
tester
.
pumpWidget
(
buildFrame
(
a
ctiveColor:
activeColor
));
expect
(
textColor
(
'title'
),
activeColor
);
expect
(
textColor
(
'title'
),
activeColor
);
await
tester
.
pumpWidget
(
buildFrame
(
activeColor:
activeColor
));
await
tester
.
pumpWidget
(
buildFrame
(
activeColor:
activeColor
));
...
...
packages/flutter/test/material/switch_test.dart
View file @
52829523
...
@@ -373,13 +373,13 @@ void main() {
...
@@ -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() {
...
@@ -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
(
0x80
1e88e5
),
color:
const
Color
(
0x80
2196f3
),
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
(
0xff
1e88e5
)),
..
circle
(
color:
const
Color
(
0xff
2196f3
)),
);
);
// Check the false value.
// Check the false value.
...
@@ -910,13 +910,13 @@ void main() {
...
@@ -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
(
0x80
1e88e5
),
color:
const
Color
(
0x80
2196f3
),
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
(
0xff
1e88e5
)),
..
circle
(
color:
const
Color
(
0xff
2196f3
)),
);
);
// Start hovering
// Start hovering
...
@@ -930,14 +930,14 @@ void main() {
...
@@ -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
(
0x80
1e88e5
),
color:
const
Color
(
0x80
2196f3
),
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
(
0xff
1e88e5
)),
..
circle
(
color:
const
Color
(
0xff
2196f3
)),
);
);
// Check what happens when disabled.
// Check what happens when disabled.
...
@@ -1297,7 +1297,7 @@ void main() {
...
@@ -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
(
0x80
1e88e5
),
color:
const
Color
(
0x80
2196f3
),
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() {
...
@@ -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
(
0x80
1e88e5
),
color:
const
Color
(
0x80
2196f3
),
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
))
...
...
packages/flutter/test/material/theme_data_test.dart
View file @
52829523
...
@@ -672,7 +672,6 @@ void main() {
...
@@ -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() {
...
@@ -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() {
...
@@ -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() {
...
@@ -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() {
...
@@ -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() {
...
@@ -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() {
...
@@ -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() {
...
@@ -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() {
...
@@ -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() {
...
@@ -1165,6 +1164,7 @@ void main() {
'fixTextFieldOutlineLabel'
,
'fixTextFieldOutlineLabel'
,
'primaryColorBrightness'
,
'primaryColorBrightness'
,
'androidOverscrollIndicator'
,
'androidOverscrollIndicator'
,
'toggleableActiveColor'
,
};
};
final
DiagnosticPropertiesBuilder
properties
=
DiagnosticPropertiesBuilder
();
final
DiagnosticPropertiesBuilder
properties
=
DiagnosticPropertiesBuilder
();
...
...
packages/flutter/test_fixes/material.dart
View file @
52829523
...
@@ -569,4 +569,20 @@ void main() {
...
@@ -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.
}
}
packages/flutter/test_fixes/material.dart.expect
View file @
52829523
...
@@ -538,4 +538,254 @@ void main() {
...
@@ -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.
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment