Unverified Commit 9f0bcfb8 authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

Update `ListTile` font (#101900)

parent d0d816c9
...@@ -20,8 +20,8 @@ import 'theme_data.dart'; ...@@ -20,8 +20,8 @@ import 'theme_data.dart';
/// Defines the title font used for [ListTile] descendants of a [ListTileTheme]. /// Defines the title font used for [ListTile] descendants of a [ListTileTheme].
/// ///
/// List tiles that appear in a [Drawer] use the theme's [TextTheme.bodyText1] /// List tiles that appear in a [Drawer] use the theme's [TextTheme.bodyMedium]
/// text style, which is a little smaller than the theme's [TextTheme.subtitle1] /// text style, which is a little smaller than the theme's [TextTheme.titleMedium]
/// text style, which is used by default. /// text style, which is used by default.
enum ListTileStyle { enum ListTileStyle {
/// Use a title font that's appropriate for a [ListTile] in a list. /// Use a title font that's appropriate for a [ListTile] in a list.
...@@ -356,14 +356,14 @@ class ListTile extends StatelessWidget { ...@@ -356,14 +356,14 @@ class ListTile extends StatelessWidget {
/// two lines. For example, you can use [Text.maxLines] to enforce the number /// two lines. For example, you can use [Text.maxLines] to enforce the number
/// of lines. /// of lines.
/// ///
/// The subtitle's default [TextStyle] depends on [TextTheme.bodyText2] except /// The subtitle's default [TextStyle] depends on [TextTheme.bodyMedium] except
/// [TextStyle.color]. The [TextStyle.color] depends on the value of [enabled] /// [TextStyle.color]. The [TextStyle.color] depends on the value of [enabled]
/// and [selected]. /// and [selected].
/// ///
/// When [enabled] is false, the text color is set to [ThemeData.disabledColor]. /// When [enabled] is false, the text color is set to [ThemeData.disabledColor].
/// ///
/// When [selected] is false, the text color is set to [ListTileTheme.textColor] /// When [selected] is false, the text color is set to [ListTileTheme.textColor]
/// if it's not null and to [TextTheme.caption]'s color if [ListTileTheme.textColor] /// if it's not null and to [TextTheme.bodySmall]'s color if [ListTileTheme.textColor]
/// is null. /// is null.
final Widget? subtitle; final Widget? subtitle;
...@@ -654,10 +654,10 @@ class ListTile extends StatelessWidget { ...@@ -654,10 +654,10 @@ class ListTile extends StatelessWidget {
final TextStyle textStyle; final TextStyle textStyle;
switch(style ?? tileTheme.style ?? theme.listTileTheme.style ?? ListTileStyle.list) { switch(style ?? tileTheme.style ?? theme.listTileTheme.style ?? ListTileStyle.list) {
case ListTileStyle.drawer: case ListTileStyle.drawer:
textStyle = theme.textTheme.bodyText1!; textStyle = theme.textTheme.bodyMedium!;
break; break;
case ListTileStyle.list: case ListTileStyle.list:
textStyle = theme.textTheme.subtitle1!; textStyle = theme.textTheme.titleMedium!;
break; break;
} }
final Color? color = _textColor(theme, tileTheme, textStyle.color); final Color? color = _textColor(theme, tileTheme, textStyle.color);
...@@ -667,15 +667,15 @@ class ListTile extends StatelessWidget { ...@@ -667,15 +667,15 @@ class ListTile extends StatelessWidget {
} }
TextStyle _subtitleTextStyle(ThemeData theme, ListTileThemeData tileTheme) { TextStyle _subtitleTextStyle(ThemeData theme, ListTileThemeData tileTheme) {
final TextStyle textStyle = theme.textTheme.bodyText2!; final TextStyle textStyle = theme.textTheme.bodyMedium!;
final Color? color = _textColor(theme, tileTheme, theme.textTheme.caption!.color); final Color? color = _textColor(theme, tileTheme, theme.textTheme.bodySmall!.color);
return _isDenseLayout(theme, tileTheme) return _isDenseLayout(theme, tileTheme)
? textStyle.copyWith(color: color, fontSize: 12.0) ? textStyle.copyWith(color: color, fontSize: 12.0)
: textStyle.copyWith(color: color); : textStyle.copyWith(color: color);
} }
TextStyle _trailingAndLeadingTextStyle(ThemeData theme, ListTileThemeData tileTheme) { TextStyle _trailingAndLeadingTextStyle(ThemeData theme, ListTileThemeData tileTheme) {
final TextStyle textStyle = theme.textTheme.bodyText2!; final TextStyle textStyle = theme.textTheme.bodyMedium!;
final Color? color = _textColor(theme, tileTheme, textStyle.color); final Color? color = _textColor(theme, tileTheme, textStyle.color);
return textStyle.copyWith(color: color); return textStyle.copyWith(color: color);
} }
......
...@@ -2208,25 +2208,25 @@ void main() { ...@@ -2208,25 +2208,25 @@ void main() {
// ListTile - ListTileStyle.list (default). // ListTile - ListTileStyle.list (default).
await tester.pumpWidget(buildFrame()); await tester.pumpWidget(buildFrame());
RenderParagraph leading = _getTextRenderObject(tester, 'leading'); RenderParagraph leading = _getTextRenderObject(tester, 'leading');
expect(leading.text.style!.color, theme.textTheme.bodyText2!.color); expect(leading.text.style!.color, theme.textTheme.bodyMedium!.color);
RenderParagraph title = _getTextRenderObject(tester, 'title'); RenderParagraph title = _getTextRenderObject(tester, 'title');
expect(title.text.style!.color, theme.textTheme.subtitle1!.color); expect(title.text.style!.color, theme.textTheme.titleMedium!.color);
RenderParagraph subtitle = _getTextRenderObject(tester, 'subtitle'); RenderParagraph subtitle = _getTextRenderObject(tester, 'subtitle');
expect(subtitle.text.style!.color, theme.textTheme.caption!.color); expect(subtitle.text.style!.color, theme.textTheme.bodySmall!.color);
RenderParagraph trailing = _getTextRenderObject(tester, 'trailing'); RenderParagraph trailing = _getTextRenderObject(tester, 'trailing');
expect(trailing.text.style!.color, theme.textTheme.bodyText2!.color); expect(trailing.text.style!.color, theme.textTheme.bodyMedium!.color);
// ListTile - ListTileStyle.drawer. // ListTile - ListTileStyle.drawer.
await tester.pumpWidget(buildFrame(style: ListTileStyle.drawer)); await tester.pumpWidget(buildFrame(style: ListTileStyle.drawer));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
leading = _getTextRenderObject(tester, 'leading'); leading = _getTextRenderObject(tester, 'leading');
expect(leading.text.style!.color, theme.textTheme.bodyText2!.color); expect(leading.text.style!.color, theme.textTheme.bodyMedium!.color);
title = _getTextRenderObject(tester, 'title'); title = _getTextRenderObject(tester, 'title');
expect(title.text.style!.color, theme.textTheme.bodyText1!.color); expect(title.text.style!.color, theme.textTheme.bodyLarge!.color);
subtitle = _getTextRenderObject(tester, 'subtitle'); subtitle = _getTextRenderObject(tester, 'subtitle');
expect(subtitle.text.style!.color, theme.textTheme.caption!.color); expect(subtitle.text.style!.color, theme.textTheme.bodySmall!.color);
trailing = _getTextRenderObject(tester, 'trailing'); trailing = _getTextRenderObject(tester, 'trailing');
expect(trailing.text.style!.color, theme.textTheme.bodyText2!.color); expect(trailing.text.style!.color, theme.textTheme.bodyMedium!.color);
}); });
testWidgets('Default ListTile debugFillProperties', (WidgetTester tester) async { testWidgets('Default ListTile debugFillProperties', (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