forked from firka/flutter
Fix ListTile's default iconColor token used & update examples (#120444)
This commit is contained in:
@@ -42,7 +42,7 @@ class _${blockName}DefaultsM3 extends ListTileThemeData {
|
||||
Color? get selectedColor => ${componentColor('md.comp.list.list-item.selected.trailing-icon')};
|
||||
|
||||
@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 {
|
||||
theme: ThemeData(
|
||||
listTileTheme: const ListTileThemeData(
|
||||
textColor: Colors.white,
|
||||
)
|
||||
),
|
||||
useMaterial3: true,
|
||||
),
|
||||
home: const LisTileExample(),
|
||||
);
|
||||
|
||||
@@ -13,8 +13,9 @@ class ListTileApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: LisTileExample(),
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const LisTileExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class ListTileApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const ListTileExample(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class ListTileApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const ListTileExample(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@ class ListTileApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: LisTileExample(),
|
||||
return MaterialApp(
|
||||
theme: ThemeData(useMaterial3: true),
|
||||
home: const LisTileExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ class ListTile extends StatelessWidget {
|
||||
/// Defines the default color for [leading] and [trailing] icons.
|
||||
///
|
||||
/// 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,
|
||||
/// and if [ThemeData.brightness] is [Brightness.dark], the value is null.
|
||||
///
|
||||
@@ -1593,7 +1593,7 @@ class _LisTileDefaultsM3 extends ListTileThemeData {
|
||||
Color? get selectedColor => _colors.primary;
|
||||
|
||||
@override
|
||||
Color? get iconColor => _colors.onSurface;
|
||||
Color? get iconColor => _colors.onSurfaceVariant;
|
||||
}
|
||||
|
||||
// END GENERATED TOKEN PROPERTIES - LisTile
|
||||
|
||||
@@ -1882,10 +1882,10 @@ void main() {
|
||||
expect(iconColor(trailingKey), colorScheme.primary);
|
||||
|
||||
await tester.pumpWidget(buildFrame(selected: false));
|
||||
expect(iconColor(leadingKey), colorScheme.onSurface);
|
||||
expect(iconColor(titleKey), colorScheme.onSurface);
|
||||
expect(iconColor(subtitleKey), colorScheme.onSurface);
|
||||
expect(iconColor(trailingKey), colorScheme.onSurface);
|
||||
expect(iconColor(leadingKey), colorScheme.onSurfaceVariant);
|
||||
expect(iconColor(titleKey), colorScheme.onSurfaceVariant);
|
||||
expect(iconColor(subtitleKey), colorScheme.onSurfaceVariant);
|
||||
expect(iconColor(trailingKey), colorScheme.onSurfaceVariant);
|
||||
});
|
||||
|
||||
testWidgets('ListTile font size', (WidgetTester tester) async {
|
||||
|
||||
Reference in New Issue
Block a user