Unverified Commit 402caec2 authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

Fix `ListTile`'s default `iconColor` token used & update examples (#120444)

parent f4495f5d
...@@ -42,7 +42,7 @@ class _${blockName}DefaultsM3 extends ListTileThemeData { ...@@ -42,7 +42,7 @@ class _${blockName}DefaultsM3 extends ListTileThemeData {
Color? get selectedColor => ${componentColor('md.comp.list.list-item.selected.trailing-icon')}; Color? get selectedColor => ${componentColor('md.comp.list.list-item.selected.trailing-icon')};
@override @override
Color? get iconColor => ${componentColor('md.comp.list.list-item.unselected.trailing-icon')}; Color? get iconColor => ${componentColor('md.comp.list.list-item.trailing-icon')};
} }
'''; ''';
} }
...@@ -17,7 +17,8 @@ class ListTileApp extends StatelessWidget { ...@@ -17,7 +17,8 @@ class ListTileApp extends StatelessWidget {
theme: ThemeData( theme: ThemeData(
listTileTheme: const ListTileThemeData( listTileTheme: const ListTileThemeData(
textColor: Colors.white, textColor: Colors.white,
) ),
useMaterial3: true,
), ),
home: const LisTileExample(), home: const LisTileExample(),
); );
......
...@@ -13,8 +13,9 @@ class ListTileApp extends StatelessWidget { ...@@ -13,8 +13,9 @@ class ListTileApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const MaterialApp( return MaterialApp(
home: LisTileExample(), theme: ThemeData(useMaterial3: true),
home: const LisTileExample(),
); );
} }
} }
......
...@@ -14,7 +14,7 @@ class ListTileApp extends StatelessWidget { ...@@ -14,7 +14,7 @@ class ListTileApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true), theme: ThemeData(useMaterial3: true),
home: const ListTileExample(), home: const ListTileExample(),
); );
} }
......
...@@ -14,7 +14,7 @@ class ListTileApp extends StatelessWidget { ...@@ -14,7 +14,7 @@ class ListTileApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true), theme: ThemeData(useMaterial3: true),
home: const ListTileExample(), home: const ListTileExample(),
); );
} }
......
...@@ -13,8 +13,9 @@ class ListTileApp extends StatelessWidget { ...@@ -13,8 +13,9 @@ class ListTileApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return const MaterialApp( return MaterialApp(
home: LisTileExample(), theme: ThemeData(useMaterial3: true),
home: const LisTileExample(),
); );
} }
} }
......
...@@ -474,7 +474,7 @@ class ListTile extends StatelessWidget { ...@@ -474,7 +474,7 @@ class ListTile extends StatelessWidget {
/// Defines the default color for [leading] and [trailing] icons. /// Defines the default color for [leading] and [trailing] icons.
/// ///
/// If this property is null and [selected] is false then [ListTileThemeData.iconColor] /// If this property is null and [selected] is false then [ListTileThemeData.iconColor]
/// is used. If that is also null and [ThemeData.useMaterial3] is true, [ColorScheme.onSurface] /// is used. If that is also null and [ThemeData.useMaterial3] is true, [ColorScheme.onSurfaceVariant]
/// is used, otherwise if [ThemeData.brightness] is [Brightness.light], [Colors.black54] is used, /// is used, otherwise if [ThemeData.brightness] is [Brightness.light], [Colors.black54] is used,
/// and if [ThemeData.brightness] is [Brightness.dark], the value is null. /// and if [ThemeData.brightness] is [Brightness.dark], the value is null.
/// ///
...@@ -1593,7 +1593,7 @@ class _LisTileDefaultsM3 extends ListTileThemeData { ...@@ -1593,7 +1593,7 @@ class _LisTileDefaultsM3 extends ListTileThemeData {
Color? get selectedColor => _colors.primary; Color? get selectedColor => _colors.primary;
@override @override
Color? get iconColor => _colors.onSurface; Color? get iconColor => _colors.onSurfaceVariant;
} }
// END GENERATED TOKEN PROPERTIES - LisTile // END GENERATED TOKEN PROPERTIES - LisTile
...@@ -1882,10 +1882,10 @@ void main() { ...@@ -1882,10 +1882,10 @@ void main() {
expect(iconColor(trailingKey), colorScheme.primary); expect(iconColor(trailingKey), colorScheme.primary);
await tester.pumpWidget(buildFrame(selected: false)); await tester.pumpWidget(buildFrame(selected: false));
expect(iconColor(leadingKey), colorScheme.onSurface); expect(iconColor(leadingKey), colorScheme.onSurfaceVariant);
expect(iconColor(titleKey), colorScheme.onSurface); expect(iconColor(titleKey), colorScheme.onSurfaceVariant);
expect(iconColor(subtitleKey), colorScheme.onSurface); expect(iconColor(subtitleKey), colorScheme.onSurfaceVariant);
expect(iconColor(trailingKey), colorScheme.onSurface); expect(iconColor(trailingKey), colorScheme.onSurfaceVariant);
}); });
testWidgets('ListTile font size', (WidgetTester tester) async { testWidgets('ListTile font size', (WidgetTester tester) async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment