Skip to content

Commit ce6188b

Browse files
authored
Revert "Update ListTile font (flutter#101900)" (flutter#102152)
This reverts commit 9f0bcfb.
1 parent e5beafa commit ce6188b

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

packages/flutter/lib/src/material/list_tile.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import 'theme_data.dart';
2020

2121
/// Defines the title font used for [ListTile] descendants of a [ListTileTheme].
2222
///
23-
/// List tiles that appear in a [Drawer] use the theme's [TextTheme.bodyMedium]
24-
/// text style, which is a little smaller than the theme's [TextTheme.titleMedium]
23+
/// List tiles that appear in a [Drawer] use the theme's [TextTheme.bodyText1]
24+
/// text style, which is a little smaller than the theme's [TextTheme.subtitle1]
2525
/// text style, which is used by default.
2626
enum ListTileStyle {
2727
/// Use a title font that's appropriate for a [ListTile] in a list.
@@ -356,14 +356,14 @@ class ListTile extends StatelessWidget {
356356
/// two lines. For example, you can use [Text.maxLines] to enforce the number
357357
/// of lines.
358358
///
359-
/// The subtitle's default [TextStyle] depends on [TextTheme.bodyMedium] except
359+
/// The subtitle's default [TextStyle] depends on [TextTheme.bodyText2] except
360360
/// [TextStyle.color]. The [TextStyle.color] depends on the value of [enabled]
361361
/// and [selected].
362362
///
363363
/// When [enabled] is false, the text color is set to [ThemeData.disabledColor].
364364
///
365365
/// When [selected] is false, the text color is set to [ListTileTheme.textColor]
366-
/// if it's not null and to [TextTheme.bodySmall]'s color if [ListTileTheme.textColor]
366+
/// if it's not null and to [TextTheme.caption]'s color if [ListTileTheme.textColor]
367367
/// is null.
368368
final Widget? subtitle;
369369

@@ -654,10 +654,10 @@ class ListTile extends StatelessWidget {
654654
final TextStyle textStyle;
655655
switch(style ?? tileTheme.style ?? theme.listTileTheme.style ?? ListTileStyle.list) {
656656
case ListTileStyle.drawer:
657-
textStyle = theme.textTheme.bodyMedium!;
657+
textStyle = theme.textTheme.bodyText1!;
658658
break;
659659
case ListTileStyle.list:
660-
textStyle = theme.textTheme.titleMedium!;
660+
textStyle = theme.textTheme.subtitle1!;
661661
break;
662662
}
663663
final Color? color = _textColor(theme, tileTheme, textStyle.color);
@@ -667,15 +667,15 @@ class ListTile extends StatelessWidget {
667667
}
668668

669669
TextStyle _subtitleTextStyle(ThemeData theme, ListTileThemeData tileTheme) {
670-
final TextStyle textStyle = theme.textTheme.bodyMedium!;
671-
final Color? color = _textColor(theme, tileTheme, theme.textTheme.bodySmall!.color);
670+
final TextStyle textStyle = theme.textTheme.bodyText2!;
671+
final Color? color = _textColor(theme, tileTheme, theme.textTheme.caption!.color);
672672
return _isDenseLayout(theme, tileTheme)
673673
? textStyle.copyWith(color: color, fontSize: 12.0)
674674
: textStyle.copyWith(color: color);
675675
}
676676

677677
TextStyle _trailingAndLeadingTextStyle(ThemeData theme, ListTileThemeData tileTheme) {
678-
final TextStyle textStyle = theme.textTheme.bodyMedium!;
678+
final TextStyle textStyle = theme.textTheme.bodyText2!;
679679
final Color? color = _textColor(theme, tileTheme, textStyle.color);
680680
return textStyle.copyWith(color: color);
681681
}

packages/flutter/test/material/list_tile_test.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,25 +2208,25 @@ void main() {
22082208
// ListTile - ListTileStyle.list (default).
22092209
await tester.pumpWidget(buildFrame());
22102210
RenderParagraph leading = _getTextRenderObject(tester, 'leading');
2211-
expect(leading.text.style!.color, theme.textTheme.bodyMedium!.color);
2211+
expect(leading.text.style!.color, theme.textTheme.bodyText2!.color);
22122212
RenderParagraph title = _getTextRenderObject(tester, 'title');
2213-
expect(title.text.style!.color, theme.textTheme.titleMedium!.color);
2213+
expect(title.text.style!.color, theme.textTheme.subtitle1!.color);
22142214
RenderParagraph subtitle = _getTextRenderObject(tester, 'subtitle');
2215-
expect(subtitle.text.style!.color, theme.textTheme.bodySmall!.color);
2215+
expect(subtitle.text.style!.color, theme.textTheme.caption!.color);
22162216
RenderParagraph trailing = _getTextRenderObject(tester, 'trailing');
2217-
expect(trailing.text.style!.color, theme.textTheme.bodyMedium!.color);
2217+
expect(trailing.text.style!.color, theme.textTheme.bodyText2!.color);
22182218

22192219
// ListTile - ListTileStyle.drawer.
22202220
await tester.pumpWidget(buildFrame(style: ListTileStyle.drawer));
22212221
await tester.pumpAndSettle();
22222222
leading = _getTextRenderObject(tester, 'leading');
2223-
expect(leading.text.style!.color, theme.textTheme.bodyMedium!.color);
2223+
expect(leading.text.style!.color, theme.textTheme.bodyText2!.color);
22242224
title = _getTextRenderObject(tester, 'title');
2225-
expect(title.text.style!.color, theme.textTheme.bodyLarge!.color);
2225+
expect(title.text.style!.color, theme.textTheme.bodyText1!.color);
22262226
subtitle = _getTextRenderObject(tester, 'subtitle');
2227-
expect(subtitle.text.style!.color, theme.textTheme.bodySmall!.color);
2227+
expect(subtitle.text.style!.color, theme.textTheme.caption!.color);
22282228
trailing = _getTextRenderObject(tester, 'trailing');
2229-
expect(trailing.text.style!.color, theme.textTheme.bodyMedium!.color);
2229+
expect(trailing.text.style!.color, theme.textTheme.bodyText2!.color);
22302230
});
22312231

22322232
testWidgets('Default ListTile debugFillProperties', (WidgetTester tester) async {

0 commit comments

Comments
 (0)