diff --git a/dev/benchmarks/complex_layout/lib/main.dart b/dev/benchmarks/complex_layout/lib/main.dart index c99261e199..9d61d63672 100644 --- a/dev/benchmarks/complex_layout/lib/main.dart +++ b/dev/benchmarks/complex_layout/lib/main.dart @@ -198,7 +198,7 @@ class MenuItemWithIcon extends StatelessWidget { padding: const EdgeInsets.only(left: 8.0, right: 8.0), child: Text(title), ), - Text(subtitle, style: Theme.of(context).textTheme.caption), + Text(subtitle, style: Theme.of(context).textTheme.bodySmall), ], ); } @@ -261,7 +261,7 @@ class InfoBar extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ const MiniIconWithText(Icons.thumb_up, '42'), - Text('3 Comments', style: Theme.of(context).textTheme.caption), + Text('3 Comments', style: Theme.of(context).textTheme.bodySmall), ], ), ); @@ -331,7 +331,7 @@ class MiniIconWithText extends StatelessWidget { child: Icon(icon, color: Colors.white, size: 12.0), ), ), - Text(title, style: Theme.of(context).textTheme.caption), + Text(title, style: Theme.of(context).textTheme.bodySmall), ], ); } @@ -374,7 +374,7 @@ class UserHeader extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ RichText(text: TextSpan( - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, children: [ TextSpan(text: userName, style: const TextStyle(fontWeight: FontWeight.bold)), const TextSpan(text: ' shared a new '), @@ -383,8 +383,8 @@ class UserHeader extends StatelessWidget { )), Row( children: [ - Text('Yesterday at 11:55 • ', style: Theme.of(context).textTheme.caption), - Icon(Icons.people, size: 16.0, color: Theme.of(context).textTheme.caption!.color), + Text('Yesterday at 11:55 • ', style: Theme.of(context).textTheme.bodySmall), + Icon(Icons.people, size: 16.0, color: Theme.of(context).textTheme.bodySmall!.color), ], ), ], @@ -477,9 +477,9 @@ class ItemImageBox extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Text('Artisans of Southern India', style: Theme.of(context).textTheme.bodyText1), - Text('Silk Spinners', style: Theme.of(context).textTheme.bodyText2), - Text('Sivaganga, Tamil Nadu', style: Theme.of(context).textTheme.caption), + Text('Artisans of Southern India', style: Theme.of(context).textTheme.bodyLarge), + Text('Silk Spinners', style: Theme.of(context).textTheme.bodyMedium), + Text('Sivaganga, Tamil Nadu', style: Theme.of(context).textTheme.bodySmall), ], ), ), @@ -521,7 +521,7 @@ class ItemGalleryBox extends StatelessWidget { child: Container( color: Theme.of(context).primaryColor, child: Center( - child: Text(tabName, style: Theme.of(context).textTheme.headline5!.copyWith(color: Colors.white)), + child: Text(tabName, style: Theme.of(context).textTheme.headlineSmall!.copyWith(color: Colors.white)), ), ), ), @@ -602,7 +602,7 @@ class BottomBarButton extends StatelessWidget { icon: Icon(icon), onPressed: () { print('Pressed: $title'); }, ), - Text(title, style: Theme.of(context).textTheme.caption), + Text(title, style: Theme.of(context).textTheme.bodySmall), ], ), ); diff --git a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart index 7a1cf7363b..0d07241dfd 100644 --- a/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart +++ b/dev/benchmarks/macrobenchmarks/lib/src/web/bench_text_layout.dart @@ -401,9 +401,9 @@ class PaletteTabView extends StatelessWidget { Widget build(BuildContext context) { final TextTheme textTheme = Theme.of(context).textTheme; final TextStyle whiteTextStyle = - textTheme.bodyText2!.copyWith(color: Colors.white); + textTheme.bodyMedium!.copyWith(color: Colors.white); final TextStyle blackTextStyle = - textTheme.bodyText2!.copyWith(color: Colors.black); + textTheme.bodyMedium!.copyWith(color: Colors.black); return Scrollbar( child: ListView( itemExtent: kColorItemHeight, diff --git a/dev/benchmarks/multiple_flutters/module/lib/main.dart b/dev/benchmarks/multiple_flutters/module/lib/main.dart index 0036703d84..48f340a175 100644 --- a/dev/benchmarks/multiple_flutters/module/lib/main.dart +++ b/dev/benchmarks/multiple_flutters/module/lib/main.dart @@ -106,7 +106,7 @@ class _MyHomePageState extends State { ), Text( '0', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), TextButton( onPressed: () {}, diff --git a/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart b/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart index 3291f4d417..16fb2f56cb 100644 --- a/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart +++ b/dev/benchmarks/test_apps/stocks/lib/stock_symbol_viewer.dart @@ -25,7 +25,7 @@ class _StockSymbolView extends StatelessWidget { changeInPrice = '+$changeInPrice'; } - final TextStyle headings = Theme.of(context).textTheme.bodyText1!; + final TextStyle headings = Theme.of(context).textTheme.bodyLarge!; return Container( padding: const EdgeInsets.all(20.0), child: Column( @@ -37,7 +37,7 @@ class _StockSymbolView extends StatelessWidget { Text( stock.symbol, key: ValueKey('${stock.symbol}_symbol_name'), - style: Theme.of(context).textTheme.headline3, + style: Theme.of(context).textTheme.displaySmall, ), arrow, ], diff --git a/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart index 9c19a1750f..65bc6901e7 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/colors_demo.dart @@ -92,8 +92,8 @@ class PaletteTabView extends StatelessWidget { @override Widget build(BuildContext context) { final TextTheme textTheme = Theme.of(context).textTheme; - final TextStyle whiteTextStyle = textTheme.bodyText2!.copyWith(color: Colors.white); - final TextStyle blackTextStyle = textTheme.bodyText2!.copyWith(color: Colors.black); + final TextStyle whiteTextStyle = textTheme.bodyMedium!.copyWith(color: Colors.white); + final TextStyle blackTextStyle = textTheme.bodyMedium!.copyWith(color: Colors.black); return Scrollbar( child: ListView( primary: true, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/contacts_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/contacts_demo.dart index c9307a78c3..5890676555 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/contacts_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/contacts_demo.dart @@ -20,7 +20,7 @@ class _ContactCategory extends StatelessWidget { border: Border(bottom: BorderSide(color: themeData.dividerColor)) ), child: DefaultTextStyle( - style: Theme.of(context).textTheme.subtitle1!, + style: Theme.of(context).textTheme.titleMedium!, child: SafeArea( top: false, bottom: false, @@ -64,7 +64,7 @@ class _ContactItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ ...lines.sublist(0, lines.length - 1).map((String line) => Text(line)), - Text(lines.last, style: themeData.textTheme.caption), + Text(lines.last, style: themeData.textTheme.bodySmall), ], ), ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/fortnightly/fortnightly.dart b/dev/integration_tests/flutter_gallery/lib/demo/fortnightly/fortnightly.dart index 7892bfa9b1..789b6f6556 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/fortnightly/fortnightly.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/fortnightly/fortnightly.dart @@ -117,29 +117,29 @@ over water meant for the whole central valley of California? The story will shoc children: [ Text( 'US', - style: textTheme.overline, + style: textTheme.labelSmall, ), Text( ' ¬ ', // TODO(larche): Replace textTheme.headline2.color with a ColorScheme value when known. - style: textTheme.overline!.apply(color: textTheme.headline2!.color), + style: textTheme.labelSmall!.apply(color: textTheme.displayMedium!.color), ), Text( 'CULTURE', - style: textTheme.overline, + style: textTheme.labelSmall, ), ], ), const SizedBox(height: 10), Text( 'Quince for Wisdom, Persimmon for Luck, Pomegranate for Love', - style: textTheme.headline4, + style: textTheme.headlineMedium, ), const SizedBox(height: 10), Text( 'How these crazy fruits sweetened our hearts, relationships, ' 'and puffed pastries', - style: textTheme.bodyText2, + style: textTheme.bodyMedium, ), Padding( padding: const EdgeInsets.symmetric(vertical: 16), @@ -155,7 +155,7 @@ over water meant for the whole central valley of California? The story will shoc const SizedBox(width: 12), Text( 'by', - style: textTheme.headline2, + style: textTheme.displayMedium, ), const SizedBox(width: 4), const Text( @@ -172,7 +172,7 @@ over water meant for the whole central valley of California? The story will shoc ), Text( '$paragraph1\n\n$paragraph2', - style: textTheme.bodyText1, + style: textTheme.bodyLarge, ), ], ), @@ -200,7 +200,7 @@ TextTheme _buildTextTheme(TextTheme base) { theme = theme.apply(displayColor: Colors.black); theme = theme.copyWith( - headline4: base.headline4!.copyWith( + headlineMedium: base.headlineMedium!.copyWith( fontFamily: 'Merriweather', fontStyle: FontStyle.italic, fontSize: 28, @@ -208,21 +208,21 @@ TextTheme _buildTextTheme(TextTheme base) { color: Colors.black, height: .88, ), - headline2: base.headline2!.copyWith( + displayMedium: base.displayMedium!.copyWith( fontFamily: 'LibreFranklin', fontSize: 18, fontWeight: FontWeight.w500, color: Colors.black.withAlpha(153), ), - headline5: base.headline5!.copyWith(fontWeight: FontWeight.w500), - bodyText2: base.bodyText2!.copyWith( + headlineSmall: base.headlineSmall!.copyWith(fontWeight: FontWeight.w500), + bodyMedium: base.bodyMedium!.copyWith( fontFamily: 'Merriweather', fontSize: 14, fontWeight: FontWeight.w300, color: const Color(0xFF666666), height: 1.11, ), - bodyText1: base.bodyText1!.copyWith( + bodyLarge: base.bodyLarge!.copyWith( fontFamily: 'Merriweather', fontSize: 16, fontWeight: FontWeight.w300, @@ -230,7 +230,7 @@ TextTheme _buildTextTheme(TextTheme base) { height: 1.4, letterSpacing: .25, ), - overline: const TextStyle( + labelSmall: const TextStyle( fontFamily: 'LibreFranklin', fontSize: 10, fontWeight: FontWeight.w700, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/backdrop_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/backdrop_demo.dart index 060d21c013..5623ab1729 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/backdrop_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/backdrop_demo.dart @@ -130,7 +130,7 @@ class CategoryView extends StatelessWidget { alignment: AlignmentDirectional.center, child: Text( asset, - style: theme.textTheme.caption, + style: theme.textTheme.bodySmall, ), ), ], @@ -186,7 +186,7 @@ class BackdropPanel extends StatelessWidget { padding: const EdgeInsetsDirectional.only(start: 16.0), alignment: AlignmentDirectional.centerStart, child: DefaultTextStyle( - style: theme.textTheme.subtitle1!, + style: theme.textTheme.titleMedium!, child: Tooltip( message: 'Tap to dismiss', child: title, @@ -213,7 +213,7 @@ class BackdropTitle extends AnimatedWidget { Widget build(BuildContext context) { final Animation animation = listenable as Animation; return DefaultTextStyle( - style: Theme.of(context).primaryTextTheme.headline6!, + style: Theme.of(context).primaryTextTheme.titleLarge!, softWrap: false, overflow: TextOverflow.ellipsis, child: Stack( @@ -365,8 +365,8 @@ class _BackdropDemoState extends State with SingleTickerProviderSt children: [ ListTileTheme( iconColor: theme.primaryIconTheme.color, - textColor: theme.primaryTextTheme.headline6!.color!.withOpacity(0.6), - selectedColor: theme.primaryTextTheme.headline6!.color, + textColor: theme.primaryTextTheme.titleLarge!.color!.withOpacity(0.6), + selectedColor: theme.primaryTextTheme.titleLarge!.color, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Column( diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart index 81ec130797..bc36265ada 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart @@ -262,7 +262,7 @@ class _RadioItem extends StatelessWidget { }, child: Text( value.title!, - style: theme.textTheme.subtitle1, + style: theme.textTheme.titleMedium, ), ), ), @@ -332,7 +332,7 @@ class _Heading extends StatelessWidget { alignment: AlignmentDirectional.centerStart, child: Text( text, - style: theme.textTheme.bodyText1, + style: theme.textTheme.bodyLarge, ), ); } diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/cards_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/cards_demo.dart index 8746949cf9..105c385af4 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/cards_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/cards_demo.dart @@ -231,7 +231,7 @@ class SectionTitle extends StatelessWidget { padding: const EdgeInsets.fromLTRB(4.0, 4.0, 4.0, 12.0), child: Align( alignment: Alignment.centerLeft, - child: Text(title!, style: Theme.of(context).textTheme.subtitle1), + child: Text(title!, style: Theme.of(context).textTheme.titleMedium), ), ); } @@ -245,8 +245,8 @@ class TravelDestinationContent extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle titleStyle = theme.textTheme.headline5!.copyWith(color: Colors.white); - final TextStyle descriptionStyle = theme.textTheme.subtitle1!; + final TextStyle titleStyle = theme.textTheme.headlineSmall!.copyWith(color: Colors.white); + final TextStyle descriptionStyle = theme.textTheme.titleMedium!; final ButtonStyle textButtonStyle = TextButton.styleFrom(foregroundColor: Colors.amber.shade500); return Column( diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart index 1c522837d6..cb45f173e9 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/chip_demo.dart @@ -124,7 +124,7 @@ class _ChipsTile extends StatelessWidget { alignment: Alignment.center, constraints: const BoxConstraints(minWidth: 48.0, minHeight: 48.0), padding: const EdgeInsets.all(8.0), - child: Text('None', style: Theme.of(context).textTheme.caption!.copyWith(fontStyle: FontStyle.italic)), + child: Text('None', style: Theme.of(context).textTheme.bodySmall!.copyWith(fontStyle: FontStyle.italic)), ), ), ], @@ -318,7 +318,7 @@ class _ChipDemoState extends State { child: Center( child: Text( _createResult(), - style: theme.textTheme.headline6, + style: theme.textTheme.titleLarge, ), ), ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart index 6349bdf160..fa7554e27a 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/date_and_time_picker_demo.dart @@ -83,7 +83,7 @@ class _DateTimePicker extends StatelessWidget { @override Widget build(BuildContext context) { - final TextStyle? valueStyle = Theme.of(context).textTheme.headline6; + final TextStyle? valueStyle = Theme.of(context).textTheme.titleLarge; return Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ @@ -147,13 +147,13 @@ class _DateAndTimePickerDemoState extends State { labelText: 'Event name', border: OutlineInputBorder(), ), - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), TextField( decoration: const InputDecoration( labelText: 'Location', ), - style: Theme.of(context).textTheme.headline4!.copyWith(fontSize: 20.0), + style: Theme.of(context).textTheme.headlineMedium!.copyWith(fontSize: 20.0), ), _DateTimePicker( labelText: 'From', diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart index e5fb743bfd..04a2c13b5f 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart @@ -82,7 +82,7 @@ class DialogDemoState extends State { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle dialogTextStyle = theme.textTheme.subtitle1!.copyWith(color: theme.textTheme.caption!.color); + final TextStyle dialogTextStyle = theme.textTheme.titleMedium!.copyWith(color: theme.textTheme.bodySmall!.color); return Scaffold( appBar: AppBar( diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/drawer_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/drawer_demo.dart index 695d164da7..bf1291f9b8 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/drawer_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/drawer_demo.dart @@ -237,7 +237,7 @@ class _DrawerDemoState extends State with TickerProviderStateMixin { Padding( padding: const EdgeInsets.only(top: 8.0), child: Text('Tap here to open the drawer', - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, ), ), ], diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart index cad7f3b6e9..1fbe805ea0 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/expansion_panels_demo.dart @@ -58,7 +58,7 @@ class DualHeaderWithHint extends StatelessWidget { alignment: Alignment.centerLeft, child: Text( name!, - style: textTheme.bodyText2!.copyWith(fontSize: 15.0), + style: textTheme.bodyMedium!.copyWith(fontSize: 15.0), ), ), ), @@ -68,8 +68,8 @@ class DualHeaderWithHint extends StatelessWidget { child: Container( margin: const EdgeInsets.only(left: 24.0), child: _crossFade( - Text(value!, style: textTheme.caption!.copyWith(fontSize: 15.0)), - Text(hint!, style: textTheme.caption!.copyWith(fontSize: 15.0)), + Text(value!, style: textTheme.bodySmall!.copyWith(fontSize: 15.0)), + Text(hint!, style: textTheme.bodySmall!.copyWith(fontSize: 15.0)), showHint!, ), ), @@ -108,7 +108,7 @@ class CollapsibleBody extends StatelessWidget { ) - margin, child: Center( child: DefaultTextStyle( - style: textTheme.caption!.copyWith(fontSize: 15.0), + style: textTheme.bodySmall!.copyWith(fontSize: 15.0), child: child!, ), ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart index 8918dfb668..b6f7bbe6b6 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart @@ -28,7 +28,7 @@ class DateTimeItem extends StatelessWidget { final ThemeData theme = Theme.of(context); return DefaultTextStyle( - style: theme.textTheme.subtitle1!, + style: theme.textTheme.titleMedium!, child: Row( children: [ Expanded( @@ -116,7 +116,7 @@ class FullScreenDialogDemoState extends State { } final ThemeData theme = Theme.of(context); - final TextStyle dialogTextStyle = theme.textTheme.subtitle1!.copyWith(color: theme.textTheme.caption!.color); + final TextStyle dialogTextStyle = theme.textTheme.titleMedium!.copyWith(color: theme.textTheme.bodySmall!.color); return showDialog( context: context, @@ -154,7 +154,7 @@ class FullScreenDialogDemoState extends State { title: Text(_hasName ? _eventName : 'Event Name TBD'), actions: [ TextButton( - child: Text('SAVE', style: theme.textTheme.bodyText2!.copyWith(color: Colors.white)), + child: Text('SAVE', style: theme.textTheme.bodyMedium!.copyWith(color: Colors.white)), onPressed: () { Navigator.pop(context, DismissDialogAction.save); }, @@ -176,7 +176,7 @@ class FullScreenDialogDemoState extends State { labelText: 'Event name', filled: true, ), - style: theme.textTheme.headline5, + style: theme.textTheme.headlineSmall, onChanged: (String value) { setState(() { _hasName = value.isNotEmpty; @@ -206,7 +206,7 @@ class FullScreenDialogDemoState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('From', style: theme.textTheme.caption), + Text('From', style: theme.textTheme.bodySmall), DateTimeItem( dateTime: _fromDateTime, onChanged: (DateTime value) { @@ -221,7 +221,7 @@ class FullScreenDialogDemoState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text('To', style: theme.textTheme.caption), + Text('To', style: theme.textTheme.bodySmall), DateTimeItem( dateTime: _toDateTime, onChanged: (DateTime value) { diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/icons_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/icons_demo.dart index 9ce90a4518..ec81fd7fff 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/icons_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/icons_demo.dart @@ -112,7 +112,7 @@ class _IconsDemoCard extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle textStyle = theme.textTheme.subtitle1!.copyWith(color: theme.textTheme.caption!.color); + final TextStyle textStyle = theme.textTheme.titleMedium!.copyWith(color: theme.textTheme.bodySmall!.color); return Card( child: DefaultTextStyle( style: textStyle, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/progress_indicator_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/progress_indicator_demo.dart index c4788786c9..37cd0062cb 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/progress_indicator_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/progress_indicator_demo.dart @@ -115,7 +115,7 @@ class _ProgressIndicatorDemoState extends State with Sing body: Center( child: SingleChildScrollView( child: DefaultTextStyle( - style: Theme.of(context).textTheme.headline6!, + style: Theme.of(context).textTheme.titleLarge!, child: GestureDetector( onTap: _handleTap, behavior: HitTestBehavior.opaque, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/reorderable_list_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/reorderable_list_demo.dart index ee74a5bcc8..460d376e26 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/reorderable_list_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/reorderable_list_demo.dart @@ -212,7 +212,7 @@ class _ListDemoState extends State { header: _itemType != _ReorderableListType.threeLine ? Padding( padding: const EdgeInsets.all(8.0), - child: Text('Header of the list', style: Theme.of(context).textTheme.headline5)) + child: Text('Header of the list', style: Theme.of(context).textTheme.headlineSmall)) : null, onReorder: _onReorder, reverse: _reverse!, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/search_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/search_demo.dart index 8b3c09f6f0..bb50d425ab 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/search_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/search_demo.dart @@ -255,7 +255,7 @@ class _ResultCard extends StatelessWidget { Text(title!), Text( '$integer', - style: theme.textTheme.headline5!.copyWith(fontSize: 72.0), + style: theme.textTheme.headlineSmall!.copyWith(fontSize: 72.0), ), ], ), @@ -284,11 +284,11 @@ class _SuggestionList extends StatelessWidget { title: RichText( text: TextSpan( text: suggestion.substring(0, query!.length), - style: theme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.bold), + style: theme.textTheme.titleMedium!.copyWith(fontWeight: FontWeight.bold), children: [ TextSpan( text: suggestion.substring(query!.length), - style: theme.textTheme.subtitle1, + style: theme.textTheme.titleMedium, ), ], ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart index 5494761668..03215720f7 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/slider_demo.dart @@ -334,7 +334,7 @@ class _SlidersState extends State<_Sliders> { valueIndicatorColor: Colors.deepPurpleAccent, thumbShape: _CustomThumbShape(), valueIndicatorShape: _CustomValueIndicatorShape(), - valueIndicatorTextStyle: theme.textTheme.bodyText1!.copyWith(color: theme.colorScheme.onSurface), + valueIndicatorTextStyle: theme.textTheme.bodyLarge!.copyWith(color: theme.colorScheme.onSurface), ), child: Slider( value: _discreteCustomValue, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_demo.dart index e461e37a98..428ce27208 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_demo.dart @@ -126,7 +126,7 @@ class _CardDataItem extends StatelessWidget { Center( child: Text( data!.title!, - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), ), ], diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_fab_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_fab_demo.dart index 582651d81c..a9887ece89 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_fab_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/tabs_fab_demo.dart @@ -78,7 +78,7 @@ class _TabsFabDemoState extends State with SingleTickerProviderStat ), child: Padding( padding: const EdgeInsets.all(32.0), - child: Text(_explanatoryText, style: Theme.of(context).textTheme.subtitle1), + child: Text(_explanatoryText, style: Theme.of(context).textTheme.titleMedium), ), ); }); diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart index bcf5288a4a..5d3fee8d60 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/text_form_field_demo.dart @@ -293,7 +293,7 @@ class TextFormFieldDemoState extends State { const SizedBox(height: 24.0), Text( '* indicates required field', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, ), const SizedBox(height: 24.0), ], diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/tooltip_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/tooltip_demo.dart index af66b74de7..69fa9629b5 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/tooltip_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/tooltip_demo.dart @@ -31,10 +31,10 @@ class TooltipDemo extends StatelessWidget { bottom: false, child: ListView( children: [ - Text(_introText, style: theme.textTheme.subtitle1), + Text(_introText, style: theme.textTheme.titleMedium), Row( children: [ - Text('Long press the ', style: theme.textTheme.subtitle1), + Text('Long press the ', style: theme.textTheme.titleMedium), Tooltip( message: 'call icon', child: Icon( @@ -43,7 +43,7 @@ class TooltipDemo extends StatelessWidget { color: theme.iconTheme.color, ), ), - Text(' icon.', style: theme.textTheme.subtitle1), + Text(' icon.', style: theme.textTheme.titleMedium), ], ), Center( diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/app.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/app.dart index cf62ff50a8..81e56f4ade 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/app.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/app.dart @@ -98,11 +98,11 @@ ThemeData _buildShrineTheme() { TextTheme _buildShrineTextTheme(TextTheme base) { return base.copyWith( - headline5: base.headline5!.copyWith(fontWeight: FontWeight.w500), - headline6: base.headline6!.copyWith(fontSize: 18.0), - caption: base.caption!.copyWith(fontWeight: FontWeight.w400, fontSize: 14.0), - bodyText1: base.bodyText1!.copyWith(fontWeight: FontWeight.w500, fontSize: 16.0), - button: base.button!.copyWith(fontWeight: FontWeight.w500, fontSize: 14.0), + headlineSmall: base.headlineSmall!.copyWith(fontWeight: FontWeight.w500), + titleLarge: base.titleLarge!.copyWith(fontSize: 18.0), + bodySmall: base.bodySmall!.copyWith(fontWeight: FontWeight.w400, fontSize: 14.0), + bodyLarge: base.bodyLarge!.copyWith(fontWeight: FontWeight.w500, fontSize: 16.0), + labelLarge: base.labelLarge!.copyWith(fontWeight: FontWeight.w500, fontSize: 14.0), ).apply( fontFamily: 'Raleway', displayColor: kShrineBrown900, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart index c4d77ba62f..94f5766389 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/backdrop.dart @@ -125,7 +125,7 @@ class _BackdropTitle extends AnimatedWidget { ); return DefaultTextStyle( - style: Theme.of(context).primaryTextTheme.headline6!, + style: Theme.of(context).primaryTextTheme.titleLarge!, softWrap: false, overflow: TextOverflow.ellipsis, child: Row(children: [ diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/category_menu_page.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/category_menu_page.dart index 7d31212dd7..b822b054da 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/category_menu_page.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/category_menu_page.dart @@ -33,7 +33,7 @@ class CategoryMenuPage extends StatelessWidget { const SizedBox(height: 16.0), Text( categoryString, - style: theme.textTheme.bodyText1, + style: theme.textTheme.bodyLarge, textAlign: TextAlign.center, ), const SizedBox(height: 14.0), @@ -48,7 +48,7 @@ class CategoryMenuPage extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: 16.0), child: Text( categoryString, - style: theme.textTheme.bodyText1!.copyWith( + style: theme.textTheme.bodyLarge!.copyWith( color: kShrineBrown900.withAlpha(153) ), textAlign: TextAlign.center, diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart index 34eede5e5c..0391ef95be 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/expanding_bottom_sheet.dart @@ -542,7 +542,7 @@ class ExtraProductsNumber extends StatelessWidget { final int displayedOverflowProducts = numOverflowProducts <= 99 ? numOverflowProducts : 99; return Text( '+$displayedOverflowProducts', - style: Theme.of(context).primaryTextTheme.button, + style: Theme.of(context).primaryTextTheme.labelLarge, ); } diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart index e098319ae2..ba11ceaa0b 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/login.dart @@ -51,7 +51,7 @@ class _LoginPageState extends State { const SizedBox(height: 16.0), Text( 'SHRINE', - style: Theme.of(context).textTheme.headline5, + style: Theme.of(context).textTheme.headlineSmall, ), ], ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart index 56aeb0a109..8d2ec6f46d 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/shopping_cart.dart @@ -58,7 +58,7 @@ class _ShoppingCartPageState extends State { ), Text( 'CART', - style: localTheme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.w600), + style: localTheme.textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w600), ), const SizedBox(width: 16.0), Text('${model.totalCartQuantity} ITEMS'), @@ -109,8 +109,8 @@ class ShoppingCartSummary extends StatelessWidget { @override Widget build(BuildContext context) { - final TextStyle smallAmountStyle = Theme.of(context).textTheme.bodyText2!.copyWith(color: kShrineBrown600); - final TextStyle? largeAmountStyle = Theme.of(context).textTheme.headline4; + final TextStyle smallAmountStyle = Theme.of(context).textTheme.bodyMedium!.copyWith(color: kShrineBrown600); + final TextStyle? largeAmountStyle = Theme.of(context).textTheme.headlineMedium; final NumberFormat formatter = NumberFormat.simpleCurrency( decimalDigits: 2, locale: Localizations.localeOf(context).toString(), @@ -243,7 +243,7 @@ class ShoppingCartRow extends StatelessWidget { ), Text( product.name, - style: localTheme.textTheme.subtitle1!.copyWith(fontWeight: FontWeight.w600), + style: localTheme.textTheme.titleMedium!.copyWith(fontWeight: FontWeight.w600), ), ], ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/shrine/supplemental/product_card.dart b/dev/integration_tests/flutter_gallery/lib/demo/shrine/supplemental/product_card.dart index 17ff0fe0f7..b5d4083d9c 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/shrine/supplemental/product_card.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/shrine/supplemental/product_card.dart @@ -59,7 +59,7 @@ class ProductCard extends StatelessWidget { children: [ Text( product == null ? '' : product!.name, - style: theme.textTheme.button, + style: theme.textTheme.labelLarge, softWrap: false, overflow: TextOverflow.ellipsis, maxLines: 1, @@ -67,7 +67,7 @@ class ProductCard extends StatelessWidget { const SizedBox(height: 4.0), Text( product == null ? '' : formatter.format(product!.price), - style: theme.textTheme.caption, + style: theme.textTheme.bodySmall, ), ], ), diff --git a/dev/integration_tests/flutter_gallery/lib/demo/typography_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/typography_demo.dart index 1ff1c460e4..4047e4ecc6 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/typography_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/typography_demo.dart @@ -19,7 +19,7 @@ class TextStyleItem extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle nameStyle = theme.textTheme.caption!.copyWith(color: theme.textTheme.caption!.color); + final TextStyle nameStyle = theme.textTheme.bodySmall!.copyWith(color: theme.textTheme.bodySmall!.color); return Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0), child: Row( @@ -47,18 +47,21 @@ class TypographyDemo extends StatelessWidget { Widget build(BuildContext context) { final TextTheme textTheme = Theme.of(context).textTheme; final List styleItems = [ - if (MediaQuery.of(context).size.width > 500.0) - TextStyleItem(name: 'Headline 1', style: textTheme.headline1!, text: 'Light 112sp'), - TextStyleItem(name: 'Headline 2', style: textTheme.headline2!, text: 'Regular 56sp'), - TextStyleItem(name: 'Headline 3', style: textTheme.headline3!, text: 'Regular 45sp'), - TextStyleItem(name: 'Headline 4', style: textTheme.headline4!, text: 'Regular 34sp'), - TextStyleItem(name: 'Headline 5', style: textTheme.headline5!, text: 'Regular 24sp'), - TextStyleItem(name: 'Headline 6', style: textTheme.headline6!, text: 'Medium 20sp'), - TextStyleItem(name: 'Subtitle 1', style: textTheme.subtitle1!, text: 'Regular 16sp'), - TextStyleItem(name: 'Body 1', style: textTheme.bodyText1!, text: 'Medium 14sp'), - TextStyleItem(name: 'Body 2', style: textTheme.bodyText2!, text: 'Regular 14sp'), - TextStyleItem(name: 'Caption', style: textTheme.caption!, text: 'Regular 12sp'), - TextStyleItem(name: 'Button', style: textTheme.button!, text: 'MEDIUM (ALL CAPS) 14sp'), + TextStyleItem(name: 'Display Large', style: textTheme.displayLarge!, text: 'Regular 57/64 +0'), + TextStyleItem(name: 'Display Medium', style: textTheme.displayMedium!, text: 'Regular 45/52 +0'), + TextStyleItem(name: 'Display Small', style: textTheme.displaySmall!, text: 'Regular 36/44 +0'), + TextStyleItem(name: 'Headline Large', style: textTheme.headlineLarge!, text: 'Regular 32/40 +0'), + TextStyleItem(name: 'Headline Medium', style: textTheme.headlineMedium!, text: 'Regular 28/36 +0'), + TextStyleItem(name: 'Headline Small', style: textTheme.headlineSmall!, text: 'Regular 24/32 +0'), + TextStyleItem(name: 'Title Large', style: textTheme.titleLarge!, text: 'Medium 22/28 +0'), + TextStyleItem(name: 'Title Medium', style: textTheme.titleMedium!, text: 'Medium 16/24 +0.15'), + TextStyleItem(name: 'Title Small', style: textTheme.titleSmall!, text: 'Medium 14/20 +0.1'), + TextStyleItem(name: 'Body Large', style: textTheme.bodyLarge!, text: 'Regular 16/24 +0.5'), + TextStyleItem(name: 'Body Medium', style: textTheme.bodyMedium!, text: 'Regular 14/20 +0.25'), + TextStyleItem(name: 'Body Small', style: textTheme.bodySmall!, text: 'Regular 12/16 +0.4'), + TextStyleItem(name: 'Label Large', style: textTheme.labelLarge!, text: 'Medium 14/20 +0.1'), + TextStyleItem(name: 'Label Medium', style: textTheme.labelMedium!, text: 'Medium 12/16 +0.5'), + TextStyleItem(name: 'Label Small', style: textTheme.labelSmall!, text: 'Medium 11/16 +0.5'), ]; return Scaffold( diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/about.dart b/dev/integration_tests/flutter_gallery/lib/gallery/about.dart index 43ffd5c754..fb28d9b665 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/about.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/about.dart @@ -32,8 +32,8 @@ class _LinkTextSpan extends TextSpan { void showGalleryAboutDialog(BuildContext context) { final ThemeData themeData = Theme.of(context); - final TextStyle? aboutTextStyle = themeData.textTheme.bodyText1; - final TextStyle linkStyle = themeData.textTheme.bodyText1!.copyWith(color: themeData.colorScheme.primary); + final TextStyle? aboutTextStyle = themeData.textTheme.bodyLarge; + final TextStyle linkStyle = themeData.textTheme.bodyLarge!.copyWith(color: themeData.colorScheme.primary); showAboutDialog( context: context, diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/backdrop.dart b/dev/integration_tests/flutter_gallery/lib/gallery/backdrop.dart index 6c1e296155..7f6a56303d 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/backdrop.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/backdrop.dart @@ -147,7 +147,7 @@ class _BackAppBar extends StatelessWidget { return IconTheme.merge( data: theme.primaryIconTheme, child: DefaultTextStyle( - style: theme.primaryTextTheme.headline6!, + style: theme.primaryTextTheme.titleLarge!, child: SizedBox( height: _kBackAppBarHeight, child: Row( diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart b/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart index 9c9d115238..c01ac5d157 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/demo.dart @@ -136,7 +136,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget { Padding( padding: const EdgeInsets.all(16.0), child: Text(demo.description!, - style: Theme.of(context).textTheme.subtitle1, + style: Theme.of(context).textTheme.titleMedium, ), ), Expanded(child: demo.demoWidget!), diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/home.dart b/dev/integration_tests/flutter_gallery/lib/gallery/home.dart index 9b1208684f..ebbce5404e 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/home.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/home.dart @@ -79,7 +79,7 @@ class _CategoryItem extends StatelessWidget { child: Text( category!.name, textAlign: TextAlign.center, - style: theme.textTheme.subtitle1!.copyWith( + style: theme.textTheme.titleMedium!.copyWith( fontFamily: 'GoogleSans', color: isDark ? Colors.white : _kFlutterBlue, ), @@ -206,14 +206,14 @@ class _DemoItem extends StatelessWidget { children: [ Text( demo!.title, - style: theme.textTheme.subtitle1!.copyWith( + style: theme.textTheme.titleMedium!.copyWith( color: isDark ? Colors.white : const Color(0xFF202124), ), ), if (demo!.subtitle != null) Text( demo!.subtitle!, - style: theme.textTheme.bodyText2!.copyWith( + style: theme.textTheme.bodyMedium!.copyWith( color: isDark ? Colors.white : const Color(0xFF60646B) ), ), diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/options.dart b/dev/integration_tests/flutter_gallery/lib/gallery/options.dart index 7c408f2199..c1c4b8314e 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/options.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/options.dart @@ -179,7 +179,7 @@ class _TextButton extends StatelessWidget { return TextButton( style: TextButton.styleFrom( foregroundColor: theme.colorScheme.onPrimary, - textStyle: theme.textTheme.subtitle1, + textStyle: theme.textTheme.titleMedium, padding: EdgeInsets.zero, ), onPressed: onPressed, @@ -198,7 +198,7 @@ class _Heading extends StatelessWidget { final ThemeData theme = Theme.of(context); return _OptionsItem( child: DefaultTextStyle( - style: theme.textTheme.headline6!.copyWith( + style: theme.textTheme.titleLarge!.copyWith( fontFamily: 'GoogleSans', color: theme.colorScheme.onPrimary, fontWeight: FontWeight.w700, @@ -236,7 +236,7 @@ class _ThemeModeItem extends StatelessWidget { const Text('Theme'), Text( modeLabels[options!.themeMode!]!, - style: Theme.of(context).primaryTextTheme.bodyText2, + style: Theme.of(context).primaryTextTheme.bodyMedium, ), ], ), @@ -283,7 +283,7 @@ class _TextScaleFactorItem extends StatelessWidget { const Text('Text size'), Text( options!.textScaleFactor!.label, - style: Theme.of(context).primaryTextTheme.bodyText2, + style: Theme.of(context).primaryTextTheme.bodyMedium, ), ], ), @@ -329,7 +329,7 @@ class _VisualDensityItem extends StatelessWidget { const Text('Visual density'), Text( options!.visualDensity!.label, - style: Theme.of(context).primaryTextTheme.bodyText2, + style: Theme.of(context).primaryTextTheme.bodyMedium, ), ], ), @@ -438,7 +438,7 @@ class _PlatformItem extends StatelessWidget { const Text('Platform mechanics'), Text( _platformLabel(options!.platform!), - style: Theme.of(context).primaryTextTheme.bodyText2, + style: Theme.of(context).primaryTextTheme.bodyMedium, ), ], ), @@ -517,7 +517,7 @@ class GalleryOptionsPage extends StatelessWidget { final ThemeData theme = Theme.of(context); return DefaultTextStyle( - style: theme.primaryTextTheme.subtitle1!, + style: theme.primaryTextTheme.titleMedium!, child: ListView( padding: const EdgeInsets.only(bottom: 124.0), children: [ diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/themes.dart b/dev/integration_tests/flutter_gallery/lib/gallery/themes.dart index f12de0cce1..f51622127b 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/themes.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/themes.dart @@ -9,7 +9,7 @@ final ThemeData kDarkGalleryTheme = _buildDarkTheme(); TextTheme _buildTextTheme(TextTheme base) { return base.copyWith( - headline6: base.headline6!.copyWith( + titleLarge: base.titleLarge!.copyWith( fontFamily: 'GoogleSans', ), ); diff --git a/dev/integration_tests/flutter_gallery/lib/gallery/updater.dart b/dev/integration_tests/flutter_gallery/lib/gallery/updater.dart index befb271e73..b9cb37c3f7 100644 --- a/dev/integration_tests/flutter_gallery/lib/gallery/updater.dart +++ b/dev/integration_tests/flutter_gallery/lib/gallery/updater.dart @@ -44,7 +44,7 @@ class UpdaterState extends State { Widget _buildDialog(BuildContext context) { final ThemeData theme = Theme.of(context); final TextStyle dialogTextStyle = - theme.textTheme.subtitle1!.copyWith(color: theme.textTheme.caption!.color); + theme.textTheme.titleMedium!.copyWith(color: theme.textTheme.bodySmall!.color); return AlertDialog( title: const Text('Update Flutter Gallery?'), content: Text('A newer version is available.', style: dialogTextStyle), diff --git a/dev/integration_tests/ios_app_with_extensions/lib/main.dart b/dev/integration_tests/ios_app_with_extensions/lib/main.dart index 0936e3b159..319889e207 100644 --- a/dev/integration_tests/ios_app_with_extensions/lib/main.dart +++ b/dev/integration_tests/ios_app_with_extensions/lib/main.dart @@ -102,7 +102,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), diff --git a/dev/manual_tests/lib/actions.dart b/dev/manual_tests/lib/actions.dart index 385cace542..07fdc83fa9 100644 --- a/dev/manual_tests/lib/actions.dart +++ b/dev/manual_tests/lib/actions.dart @@ -425,7 +425,7 @@ class _FocusDemoState extends State { debugLabel: 'Scope', autofocus: true, child: DefaultTextStyle( - style: textTheme.headline4!, + style: textTheme.headlineMedium!, child: Scaffold( appBar: AppBar( title: const Text('Actions Demo'), diff --git a/dev/manual_tests/lib/card_collection.dart b/dev/manual_tests/lib/card_collection.dart index 89378491de..39e05c628f 100644 --- a/dev/manual_tests/lib/card_collection.dart +++ b/dev/manual_tests/lib/card_collection.dart @@ -243,7 +243,7 @@ class CardCollectionState extends State { padding: const EdgeInsets.only(left: 72.0), height: 128.0, alignment: const Alignment(-1.0, 0.5), - child: Text('Swipe Away: ${_cardModels.length}', style: Theme.of(context).primaryTextTheme.headline6), + child: Text('Swipe Away: ${_cardModels.length}', style: Theme.of(context).primaryTextTheme.titleLarge), ), ); } @@ -314,7 +314,7 @@ class CardCollectionState extends State { } final ThemeData theme = Theme.of(context); - final TextStyle? backgroundTextStyle = theme.primaryTextTheme.headline6; + final TextStyle? backgroundTextStyle = theme.primaryTextTheme.titleLarge; // The background Widget appears behind the Dismissible card when the card // moves to the left or right. The Positioned widget ensures that the diff --git a/dev/manual_tests/lib/drag_and_drop.dart b/dev/manual_tests/lib/drag_and_drop.dart index e54ab87c1c..f897cdf838 100644 --- a/dev/manual_tests/lib/drag_and_drop.dart +++ b/dev/manual_tests/lib/drag_and_drop.dart @@ -101,7 +101,7 @@ class ExampleDragSource extends StatelessWidget { } final Widget contents = DefaultTextStyle( - style: Theme.of(context).textTheme.bodyText2!, + style: Theme.of(context).textTheme.bodyMedium!, textAlign: TextAlign.center, child: Dot( color: color, @@ -190,7 +190,7 @@ class MovableBall extends StatelessWidget { @override Widget build(BuildContext context) { final Widget ball = DefaultTextStyle( - style: Theme.of(context).primaryTextTheme.bodyText2!, + style: Theme.of(context).primaryTextTheme.bodyMedium!, textAlign: TextAlign.center, child: Dot( key: kBallKey, diff --git a/dev/manual_tests/lib/focus.dart b/dev/manual_tests/lib/focus.dart index 0b281526a6..3b7d23e8b1 100644 --- a/dev/manual_tests/lib/focus.dart +++ b/dev/manual_tests/lib/focus.dart @@ -138,7 +138,7 @@ class _FocusDemoState extends State { onKey: _handleKeyPress, autofocus: true, child: DefaultTextStyle( - style: textTheme.headline4!, + style: textTheme.headlineMedium!, child: Scaffold( appBar: AppBar( title: const Text('Focus Demo'), diff --git a/dev/manual_tests/lib/hover.dart b/dev/manual_tests/lib/hover.dart index d88c42fc88..9992914c31 100644 --- a/dev/manual_tests/lib/hover.dart +++ b/dev/manual_tests/lib/hover.dart @@ -29,7 +29,7 @@ class _HoverDemoState extends State { ); return DefaultTextStyle( - style: textTheme.headline4!, + style: textTheme.headlineMedium!, child: Scaffold( appBar: AppBar( title: const Text('Hover Demo'), diff --git a/dev/manual_tests/lib/material_arc.dart b/dev/manual_tests/lib/material_arc.dart index 3c1e4b8b4c..ccffb75294 100644 --- a/dev/manual_tests/lib/material_arc.dart +++ b/dev/manual_tests/lib/material_arc.dart @@ -214,7 +214,7 @@ class _PointDemoState extends State<_PointDemo> { child: Text( 'Tap the refresh button to run the animation. Drag the green ' "and red points to change the animation's path.", - style: Theme.of(context).textTheme.caption?.copyWith(fontSize: 16.0), + style: Theme.of(context).textTheme.bodySmall?.copyWith(fontSize: 16.0), ), ), ), @@ -382,7 +382,7 @@ class _RectangleDemoState extends State<_RectangleDemo> { child: Text( 'Tap the refresh button to run the animation. Drag the rectangles ' "to change the animation's path.", - style: Theme.of(context).textTheme.caption!.copyWith(fontSize: 16.0), + style: Theme.of(context).textTheme.bodySmall!.copyWith(fontSize: 16.0), ), ), ), diff --git a/dev/manual_tests/lib/raw_keyboard.dart b/dev/manual_tests/lib/raw_keyboard.dart index 52c94dab91..1fbb68f76b 100644 --- a/dev/manual_tests/lib/raw_keyboard.dart +++ b/dev/manual_tests/lib/raw_keyboard.dart @@ -66,12 +66,12 @@ class _HardwareKeyDemoState extends State { onTap: () { _focusNode.requestFocus(); }, - child: Text('Tap to focus', style: textTheme.headline4), + child: Text('Tap to focus', style: textTheme.headlineMedium), ); } if (_event == null) { - return Text('Press a key', style: textTheme.headline4); + return Text('Press a key', style: textTheme.headlineMedium); } final RawKeyEventData? data = _event?.data; @@ -139,7 +139,7 @@ class _HardwareKeyDemoState extends State { } dataText.add(Text(pressed.join(' '))); return DefaultTextStyle( - style: textTheme.subtitle1!, + style: textTheme.titleMedium!, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: dataText, diff --git a/dev/tools/gen_defaults/lib/app_bar_template.dart b/dev/tools/gen_defaults/lib/app_bar_template.dart index f426430df7..6df3f5dbeb 100644 --- a/dev/tools/gen_defaults/lib/app_bar_template.dart +++ b/dev/tools/gen_defaults/lib/app_bar_template.dart @@ -49,7 +49,7 @@ class _${blockName}DefaultsM3 extends AppBarTheme { ); @override - TextStyle? get toolbarTextStyle => _textTheme.bodyText2; + TextStyle? get toolbarTextStyle => _textTheme.bodyMedium; @override TextStyle? get titleTextStyle => ${textStyle('md.comp.top-app-bar.small.headline')}; diff --git a/examples/api/lib/animation/curves/curve2_d.0.dart b/examples/api/lib/animation/curves/curve2_d.0.dart index 98b89dc5c9..d6357d93a6 100644 --- a/examples/api/lib/animation/curves/curve2_d.0.dart +++ b/examples/api/lib/animation/curves/curve2_d.0.dart @@ -110,7 +110,7 @@ class MyStatelessWidget extends StatelessWidget { child: CircleAvatar( backgroundColor: Colors.yellow, child: DefaultTextStyle( - style: Theme.of(context).textTheme.headline6!, + style: Theme.of(context).textTheme.titleLarge!, child: const Text('B'), // Buzz, buzz! ), ), diff --git a/examples/api/lib/material/about/about_list_tile.0.dart b/examples/api/lib/material/about/about_list_tile.0.dart index 5c21fd0011..15859f2c60 100644 --- a/examples/api/lib/material/about/about_list_tile.0.dart +++ b/examples/api/lib/material/about/about_list_tile.0.dart @@ -28,7 +28,7 @@ class MyStatelessWidget extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle textStyle = theme.textTheme.bodyText2!; + final TextStyle textStyle = theme.textTheme.bodyMedium!; final List aboutBoxChildren = [ const SizedBox(height: 24), RichText( diff --git a/examples/api/lib/material/divider/divider.0.dart b/examples/api/lib/material/divider/divider.0.dart index 3c76370288..604b0d7c24 100644 --- a/examples/api/lib/material/divider/divider.0.dart +++ b/examples/api/lib/material/divider/divider.0.dart @@ -56,7 +56,7 @@ class MyStatelessWidget extends StatelessWidget { alignment: AlignmentDirectional.centerStart, child: Text( 'Subheader', - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, textAlign: TextAlign.start, ), ), diff --git a/examples/api/lib/material/navigation_bar/navigation_bar.0.dart b/examples/api/lib/material/navigation_bar/navigation_bar.0.dart index 865ce7984e..568301b363 100644 --- a/examples/api/lib/material/navigation_bar/navigation_bar.0.dart +++ b/examples/api/lib/material/navigation_bar/navigation_bar.0.dart @@ -33,12 +33,12 @@ class RootPage extends StatelessWidget { @override Widget build(BuildContext context) { - final TextStyle headline5 = Theme.of(context).textTheme.headline5!; + final TextStyle headlineSmall = Theme.of(context).textTheme.headlineSmall!; final ButtonStyle buttonStyle = ElevatedButton.styleFrom( backgroundColor: destination.color, visualDensity: VisualDensity.comfortable, padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), - textStyle: headline5, + textStyle: headlineSmall, ); return Scaffold( @@ -97,7 +97,7 @@ class RootPage extends StatelessWidget { child: Text( '${destination.title} BottomSheet\n' 'Tap the back button to dismiss', - style: headline5, + style: headlineSmall, softWrap: true, textAlign: TextAlign.center, ), @@ -127,7 +127,7 @@ class ListPage extends StatelessWidget { final ButtonStyle buttonStyle = OutlinedButton.styleFrom( foregroundColor: destination.color, fixedSize: const Size.fromHeight(128), - textStyle: Theme.of(context).textTheme.headline5, + textStyle: Theme.of(context).textTheme.headlineSmall, ); return Scaffold( appBar: AppBar( @@ -198,7 +198,7 @@ class _TextPageState extends State { alignment: Alignment.center, child: TextField( controller: textController, - style: theme.primaryTextTheme.headline4?.copyWith( + style: theme.primaryTextTheme.headlineMedium?.copyWith( color: widget.destination.color, ), decoration: InputDecoration( diff --git a/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart b/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart index ba9211bc96..b5946406f5 100644 --- a/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart +++ b/examples/api/lib/material/progress_indicator/circular_progress_indicator.0.dart @@ -62,7 +62,7 @@ class _MyStatefulWidgetState extends State children: [ Text( 'Circular progress indicator with a fixed color', - style: Theme.of(context).textTheme.headline6, + style: Theme.of(context).textTheme.titleLarge, ), CircularProgressIndicator( value: controller.value, diff --git a/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart b/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart index b0bd2901d1..dd3afca934 100644 --- a/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart +++ b/examples/api/lib/material/scaffold/scaffold_messenger.of.1.dart @@ -46,7 +46,7 @@ class _MyAppState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), diff --git a/examples/api/lib/material/tab_controller/tab_controller.1.dart b/examples/api/lib/material/tab_controller/tab_controller.1.dart index 894f39029d..2828af5c8b 100644 --- a/examples/api/lib/material/tab_controller/tab_controller.1.dart +++ b/examples/api/lib/material/tab_controller/tab_controller.1.dart @@ -56,7 +56,7 @@ class MyStatelessWidget extends StatelessWidget { return Center( child: Text( '${tab.text!} Tab', - style: Theme.of(context).textTheme.headline5, + style: Theme.of(context).textTheme.headlineSmall, ), ); }).toList(), diff --git a/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart b/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart index ed595b3c9f..c7ebf2c3db 100644 --- a/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart +++ b/examples/api/lib/material/toggle_buttons/toggle_buttons.0.dart @@ -68,7 +68,7 @@ class _ToggleButtonsSampleState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ // ToggleButtons with a single selection. - Text('Single-select', style: theme.textTheme.subtitle2), + Text('Single-select', style: theme.textTheme.titleSmall), const SizedBox(height: 5), ToggleButtons( direction: vertical ? Axis.vertical : Axis.horizontal, @@ -94,7 +94,7 @@ class _ToggleButtonsSampleState extends State { ), const SizedBox(height: 20), // ToggleButtons with a multiple selection. - Text('Multi-select', style: theme.textTheme.subtitle2), + Text('Multi-select', style: theme.textTheme.titleSmall), const SizedBox(height: 5), ToggleButtons( direction: vertical ? Axis.vertical : Axis.horizontal, @@ -119,7 +119,7 @@ class _ToggleButtonsSampleState extends State { ), const SizedBox(height: 20), // ToggleButtons with icons only. - Text('Icon-only', style: theme.textTheme.subtitle2), + Text('Icon-only', style: theme.textTheme.titleSmall), const SizedBox(height: 5), ToggleButtons( direction: vertical ? Axis.vertical : Axis.horizontal, diff --git a/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart b/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart index b20b00240b..7f83e75134 100644 --- a/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart +++ b/examples/api/lib/services/keyboard_key/logical_keyboard_key.0.dart @@ -70,7 +70,7 @@ class _MyKeyExampleState extends State { color: Colors.white, alignment: Alignment.center, child: DefaultTextStyle( - style: textTheme.headline4!, + style: textTheme.headlineMedium!, child: Focus( focusNode: _focusNode, onKey: _handleKeyEvent, diff --git a/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart b/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart index 282e413e8e..f5dc0d6199 100644 --- a/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart +++ b/examples/api/lib/services/keyboard_key/physical_keyboard_key.0.dart @@ -70,7 +70,7 @@ class _MyPhysicalKeyExampleState extends State { color: Colors.white, alignment: Alignment.center, child: DefaultTextStyle( - style: textTheme.headline4!, + style: textTheme.headlineMedium!, child: Focus( focusNode: _focusNode, onKey: _handleKeyEvent, diff --git a/examples/api/lib/widgets/actions/actions.0.dart b/examples/api/lib/widgets/actions/actions.0.dart index 34636f3268..080ec03324 100644 --- a/examples/api/lib/widgets/actions/actions.0.dart +++ b/examples/api/lib/widgets/actions/actions.0.dart @@ -155,7 +155,7 @@ class _MyStatefulWidgetState extends State { return Padding( padding: const EdgeInsets.all(8.0), child: Text('${model.data.value}', - style: Theme.of(context).textTheme.headline4), + style: Theme.of(context).textTheme.headlineMedium), ); }), IconButton( diff --git a/examples/api/lib/widgets/animated_list/animated_list.0.dart b/examples/api/lib/widgets/animated_list/animated_list.0.dart index 3869322a3c..b6ca9ad40e 100644 --- a/examples/api/lib/widgets/animated_list/animated_list.0.dart +++ b/examples/api/lib/widgets/animated_list/animated_list.0.dart @@ -186,7 +186,7 @@ class CardItem extends StatelessWidget { @override Widget build(BuildContext context) { - TextStyle textStyle = Theme.of(context).textTheme.headline4!; + TextStyle textStyle = Theme.of(context).textTheme.headlineMedium!; if (selected) { textStyle = textStyle.copyWith(color: Colors.lightGreenAccent[400]); } diff --git a/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart b/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart index f29698aa87..9ccf020dbc 100644 --- a/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart +++ b/examples/api/lib/widgets/animated_list/sliver_animated_list.0.dart @@ -224,7 +224,7 @@ class CardItem extends StatelessWidget { child: Center( child: Text( 'Item $item', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ), ), diff --git a/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart b/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart index d0704f81a8..7f563c88a1 100644 --- a/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart +++ b/examples/api/lib/widgets/animated_switcher/animated_switcher.0.dart @@ -50,7 +50,7 @@ class _MyStatefulWidgetState extends State { // child each time the count changes, so that it will begin its animation // when the count changes. key: ValueKey(_count), - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ), ElevatedButton( diff --git a/examples/api/lib/widgets/async/future_builder.0.dart b/examples/api/lib/widgets/async/future_builder.0.dart index f93ae2608b..8c5c1d08ba 100644 --- a/examples/api/lib/widgets/async/future_builder.0.dart +++ b/examples/api/lib/widgets/async/future_builder.0.dart @@ -38,7 +38,7 @@ class _MyStatefulWidgetState extends State { @override Widget build(BuildContext context) { return DefaultTextStyle( - style: Theme.of(context).textTheme.headline2!, + style: Theme.of(context).textTheme.displayMedium!, textAlign: TextAlign.center, child: FutureBuilder( future: _calculation, // a previously-obtained Future or null diff --git a/examples/api/lib/widgets/async/stream_builder.0.dart b/examples/api/lib/widgets/async/stream_builder.0.dart index 4687ec834e..6d1a63262e 100644 --- a/examples/api/lib/widgets/async/stream_builder.0.dart +++ b/examples/api/lib/widgets/async/stream_builder.0.dart @@ -48,7 +48,7 @@ class _MyStatefulWidgetState extends State { @override Widget build(BuildContext context) { return DefaultTextStyle( - style: Theme.of(context).textTheme.headline2!, + style: Theme.of(context).textTheme.displayMedium!, textAlign: TextAlign.center, child: Container( alignment: FractionalOffset.center, diff --git a/examples/api/lib/widgets/basic/listener.0.dart b/examples/api/lib/widgets/basic/listener.0.dart index 403918d9c0..2a3a76e4c9 100644 --- a/examples/api/lib/widgets/basic/listener.0.dart +++ b/examples/api/lib/widgets/basic/listener.0.dart @@ -78,7 +78,7 @@ class _MyStatefulWidgetState extends State { 'You have pressed or released in this area this many times:'), Text( '$_downCounter presses\n$_upCounter releases', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), Text( 'The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})', diff --git a/examples/api/lib/widgets/basic/mouse_region.0.dart b/examples/api/lib/widgets/basic/mouse_region.0.dart index f76d3fb7ee..7fd154985f 100644 --- a/examples/api/lib/widgets/basic/mouse_region.0.dart +++ b/examples/api/lib/widgets/basic/mouse_region.0.dart @@ -76,7 +76,7 @@ class _MyStatefulWidgetState extends State { 'You have entered or exited this box this many times:'), Text( '$_enterCounter Entries\n$_exitCounter Exits', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), Text( 'The cursor is here: (${x.toStringAsFixed(2)}, ${y.toStringAsFixed(2)})', diff --git a/examples/api/lib/widgets/focus_manager/focus_node.0.dart b/examples/api/lib/widgets/focus_manager/focus_node.0.dart index 257f089dd0..699846cad9 100644 --- a/examples/api/lib/widgets/focus_manager/focus_node.0.dart +++ b/examples/api/lib/widgets/focus_manager/focus_node.0.dart @@ -121,7 +121,7 @@ class MyStatelessWidget extends StatelessWidget { Widget build(BuildContext context) { final TextTheme textTheme = Theme.of(context).textTheme; return DefaultTextStyle( - style: textTheme.headline4!, + style: textTheme.headlineMedium!, child: const ColorfulButton(), ); } diff --git a/examples/api/lib/widgets/focus_scope/focus.0.dart b/examples/api/lib/widgets/focus_scope/focus.0.dart index ef8689dcab..9ddba1ffec 100644 --- a/examples/api/lib/widgets/focus_scope/focus.0.dart +++ b/examples/api/lib/widgets/focus_scope/focus.0.dart @@ -69,7 +69,7 @@ class _MyStatefulWidgetState extends State { debugLabel: 'Scope', autofocus: true, child: DefaultTextStyle( - style: textTheme.headline4!, + style: textTheme.headlineMedium!, child: Focus( onKey: _handleKeyPress, debugLabel: 'Button', diff --git a/examples/api/lib/widgets/focus_scope/focus_scope.0.dart b/examples/api/lib/widgets/focus_scope/focus_scope.0.dart index ffbc3825a8..48fe6dcc8d 100644 --- a/examples/api/lib/widgets/focus_scope/focus_scope.0.dart +++ b/examples/api/lib/widgets/focus_scope/focus_scope.0.dart @@ -119,7 +119,7 @@ class _MyStatefulWidgetState extends State { child: const Text('ANOTHER BUTTON TO FOCUS'), ), DefaultTextStyle( - style: Theme.of(context).textTheme.headline2!, + style: Theme.of(context).textTheme.displayMedium!, child: const Text('BACKDROP')), ], ), @@ -148,7 +148,7 @@ class _MyStatefulWidgetState extends State { ? null : () => setState(() => backdropIsVisible = true), child: DefaultTextStyle( - style: Theme.of(context).textTheme.headline2!, + style: Theme.of(context).textTheme.displayMedium!, child: const Text('FOREGROUND')), ), ), diff --git a/examples/api/lib/widgets/navigator/navigator.0.dart b/examples/api/lib/widgets/navigator/navigator.0.dart index 6abd303d55..2baf740a32 100644 --- a/examples/api/lib/widgets/navigator/navigator.0.dart +++ b/examples/api/lib/widgets/navigator/navigator.0.dart @@ -31,7 +31,7 @@ class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return DefaultTextStyle( - style: Theme.of(context).textTheme.headline4!, + style: Theme.of(context).textTheme.headlineMedium!, child: Container( color: Colors.white, alignment: Alignment.center, @@ -47,7 +47,7 @@ class CollectPersonalInfoPage extends StatelessWidget { @override Widget build(BuildContext context) { return DefaultTextStyle( - style: Theme.of(context).textTheme.headline4!, + style: Theme.of(context).textTheme.headlineMedium!, child: GestureDetector( onTap: () { // This moves from the personal info page to the credentials page, @@ -78,7 +78,7 @@ class ChooseCredentialsPage extends StatelessWidget { return GestureDetector( onTap: onSignupComplete, child: DefaultTextStyle( - style: Theme.of(context).textTheme.headline4!, + style: Theme.of(context).textTheme.headlineMedium!, child: Container( color: Colors.pinkAccent, alignment: Alignment.center, diff --git a/examples/api/lib/widgets/restoration/restoration_mixin.0.dart b/examples/api/lib/widgets/restoration/restoration_mixin.0.dart index e7444b2476..e857a8001a 100644 --- a/examples/api/lib/widgets/restoration/restoration_mixin.0.dart +++ b/examples/api/lib/widgets/restoration/restoration_mixin.0.dart @@ -82,7 +82,7 @@ class _RestorableCounterState extends State ), Text( '${_counter.value}', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), diff --git a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart index b51163c16a..7331e5b182 100644 --- a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart +++ b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.0.dart @@ -28,7 +28,7 @@ class MyStatelessWidget extends StatelessWidget { @override Widget build(BuildContext context) { return DefaultTextStyle( - style: Theme.of(context).textTheme.bodyText2!, + style: Theme.of(context).textTheme.bodyMedium!, child: LayoutBuilder( builder: (BuildContext context, BoxConstraints viewportConstraints) { return SingleChildScrollView( diff --git a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart index 07d94ad35c..feb42c3dd1 100644 --- a/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart +++ b/examples/api/lib/widgets/single_child_scroll_view/single_child_scroll_view.1.dart @@ -28,7 +28,7 @@ class MyStatelessWidget extends StatelessWidget { @override Widget build(BuildContext context) { return DefaultTextStyle( - style: Theme.of(context).textTheme.bodyText2!, + style: Theme.of(context).textTheme.bodyMedium!, child: LayoutBuilder( builder: (BuildContext context, BoxConstraints viewportConstraints) { return SingleChildScrollView( diff --git a/examples/image_list/lib/main.dart b/examples/image_list/lib/main.dart index 6f5c76d9e7..408f8f558c 100644 --- a/examples/image_list/lib/main.dart +++ b/examples/image_list/lib/main.dart @@ -210,7 +210,7 @@ class _MyHomePageState extends State with TickerProviderStateMixin { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), diff --git a/packages/flutter/lib/fix_data.yaml b/packages/flutter/lib/fix_data.yaml index 9856e776b0..3bb28c4d5a 100644 --- a/packages/flutter/lib/fix_data.yaml +++ b/packages/flutter/lib/fix_data.yaml @@ -17,6 +17,245 @@ version: 1 transforms: + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'displayLarge'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: headline1 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'displayLarge' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'displayMedium'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: headline2 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'displayMedium' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'displaySmall'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: headline3 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'displaySmall' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'headlineMedium'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: headline4 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'headlineMedium' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'headlineSmall'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: headline5 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'headlineSmall' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'titleLarge'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: headline6 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'titleLarge' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'titleMedium'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: subtitle1 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'titleMedium' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'titleSmall'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: subtitle2 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'titleSmall' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'bodyLarge'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: bodyText1 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'bodyLarge' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'bodyMedium'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: bodyText2 + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'bodyMedium' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'bodySmall'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: caption + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'bodySmall' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'labelLarge'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: button + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'labelLarge' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: "Rename to 'labelSmall'" + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + getter: overline + inClass: 'TextTheme' + changes: + - kind: 'rename' + newName: 'labelSmall' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: 'Rename arguments' + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + constructor: '' + inClass: 'TextTheme' + changes: + - kind: 'renameParameter' + oldName: 'headline1' + newName: 'displayLarge' + - kind: 'renameParameter' + oldName: 'headline2' + newName: 'displayMedium' + - kind: 'renameParameter' + oldName: 'headline3' + newName: 'displaySmall' + - kind: 'renameParameter' + oldName: 'headline4' + newName: 'headlineMedium' + - kind: 'renameParameter' + oldName: 'headline5' + newName: 'headlineSmall' + - kind: 'renameParameter' + oldName: 'headline6' + newName: 'titleLarge' + - kind: 'renameParameter' + oldName: 'subtitle1' + newName: 'titleMedium' + - kind: 'renameParameter' + oldName: 'subtitle2' + newName: 'titleSmall' + - kind: 'renameParameter' + oldName: 'bodyText1' + newName: 'bodyLarge' + - kind: 'renameParameter' + oldName: 'bodyText2' + newName: 'bodyMedium' + - kind: 'renameParameter' + oldName: 'caption' + newName: 'bodySmall' + - kind: 'renameParameter' + oldName: 'button' + newName: 'labelLarge' + - kind: 'renameParameter' + oldName: 'overline' + newName: 'labelSmall' + + # Changes made in https://github.com/flutter/flutter/pull/109817 + - title: 'Rename arguments' + date: 2022-08-18 + element: + uris: [ 'material.dart' ] + method: 'copyWith' + inClass: 'TextTheme' + changes: + - kind: 'renameParameter' + oldName: 'headline1' + newName: 'displayLarge' + - kind: 'renameParameter' + oldName: 'headline2' + newName: 'displayMedium' + - kind: 'renameParameter' + oldName: 'headline3' + newName: 'displaySmall' + - kind: 'renameParameter' + oldName: 'headline4' + newName: 'headlineMedium' + - kind: 'renameParameter' + oldName: 'headline5' + newName: 'headlineSmall' + - kind: 'renameParameter' + oldName: 'headline6' + newName: 'titleLarge' + - kind: 'renameParameter' + oldName: 'subtitle1' + newName: 'titleMedium' + - kind: 'renameParameter' + oldName: 'subtitle2' + newName: 'titleSmall' + - kind: 'renameParameter' + oldName: 'bodyText1' + newName: 'bodyLarge' + - kind: 'renameParameter' + oldName: 'bodyText2' + newName: 'bodyMedium' + - kind: 'renameParameter' + oldName: 'caption' + newName: 'bodySmall' + - kind: 'renameParameter' + oldName: 'button' + newName: 'labelLarge' + - kind: 'renameParameter' + oldName: 'overline' + newName: 'labelSmall' + # Changes made in https://github.com/flutter/flutter/pull/109070 - title: "Remove 'selectedRowColor'" date: 2022-08-05 diff --git a/packages/flutter/lib/src/material/about.dart b/packages/flutter/lib/src/material/about.dart index be7ec03914..a8711a076b 100644 --- a/packages/flutter/lib/src/material/about.dart +++ b/packages/flutter/lib/src/material/about.dart @@ -330,10 +330,10 @@ class AboutDialog extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 24.0), child: ListBody( children: [ - Text(name, style: Theme.of(context).textTheme.headline5), - Text(version, style: Theme.of(context).textTheme.bodyText2), + Text(name, style: Theme.of(context).textTheme.headlineSmall), + Text(version, style: Theme.of(context).textTheme.bodyMedium), const SizedBox(height: _textVerticalSeparation), - Text(applicationLegalese ?? '', style: Theme.of(context).textTheme.caption), + Text(applicationLegalese ?? '', style: Theme.of(context).textTheme.bodySmall), ], ), ), @@ -495,7 +495,7 @@ class _AboutProgram extends StatelessWidget { children: [ Text( name, - style: Theme.of(context).textTheme.headline5, + style: Theme.of(context).textTheme.headlineSmall, textAlign: TextAlign.center, ), if (icon != null) @@ -505,20 +505,20 @@ class _AboutProgram extends StatelessWidget { padding: const EdgeInsets.only(bottom: _textVerticalSeparation), child: Text( version, - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, textAlign: TextAlign.center, ), ), if (legalese != null && legalese != '') Text( legalese!, - style: Theme.of(context).textTheme.caption, + style: Theme.of(context).textTheme.bodySmall, textAlign: TextAlign.center, ), const SizedBox(height: _textVerticalSeparation), Text( 'Powered by Flutter', - style: Theme.of(context).textTheme.bodyText2, + style: Theme.of(context).textTheme.bodyMedium, textAlign: TextAlign.center, ), ], @@ -908,7 +908,7 @@ class _PackageLicensePageState extends State<_PackageLicensePage> { ); } return DefaultTextStyle( - style: theme.textTheme.caption!, + style: theme.textTheme.bodySmall!, child: page, ); } @@ -933,8 +933,8 @@ class _PackageLicensePageTitle extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(title, style: theme.headline6?.copyWith(color: color)), - Text(subtitle, style: theme.subtitle2?.copyWith(color: color)), + Text(title, style: theme.titleLarge?.copyWith(color: color)), + Text(subtitle, style: theme.titleSmall?.copyWith(color: color)), ], ); } diff --git a/packages/flutter/lib/src/material/app_bar.dart b/packages/flutter/lib/src/material/app_bar.dart index b690185115..ed929be7c4 100644 --- a/packages/flutter/lib/src/material/app_bar.dart +++ b/packages/flutter/lib/src/material/app_bar.dart @@ -739,7 +739,7 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget { /// /// If this property is null, then [AppBarTheme.toolbarTextStyle] of /// [ThemeData.appBarTheme] is used. If that is also null, the default - /// value is a copy of the overall theme's [TextTheme.bodyText2] + /// value is a copy of the overall theme's [TextTheme.bodyMedium] /// [TextStyle], with color set to the app bar's [foregroundColor]. /// {@endtemplate} /// @@ -755,7 +755,7 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget { /// /// If this property is null, then [AppBarTheme.titleTextStyle] of /// [ThemeData.appBarTheme] is used. If that is also null, the default - /// value is a copy of the overall theme's [TextTheme.headline6] + /// value is a copy of the overall theme's [TextTheme.titleLarge] /// [TextStyle], with color set to the app bar's [foregroundColor]. /// {@endtemplate} /// @@ -950,17 +950,17 @@ class _AppBarState extends State { ?? overallIconTheme; TextStyle? toolbarTextStyle = backwardsCompatibility - ? widget.textTheme?.bodyText2 - ?? appBarTheme.textTheme?.bodyText2 - ?? theme.primaryTextTheme.bodyText2 + ? widget.textTheme?.bodyMedium + ?? appBarTheme.textTheme?.bodyMedium + ?? theme.primaryTextTheme.bodyMedium : widget.toolbarTextStyle ?? appBarTheme.toolbarTextStyle ?? defaults.toolbarTextStyle?.copyWith(color: foregroundColor); TextStyle? titleTextStyle = backwardsCompatibility - ? widget.textTheme?.headline6 - ?? appBarTheme.textTheme?.headline6 - ?? theme.primaryTextTheme.headline6 + ? widget.textTheme?.titleLarge + ?? appBarTheme.textTheme?.titleLarge + ?? theme.primaryTextTheme.titleLarge : widget.titleTextStyle ?? appBarTheme.titleTextStyle ?? defaults.titleTextStyle?.copyWith(color: foregroundColor); @@ -2324,10 +2324,10 @@ class _AppBarDefaultsM2 extends AppBarTheme { IconThemeData? get iconTheme => _theme.iconTheme; @override - TextStyle? get toolbarTextStyle => _theme.textTheme.bodyText2; + TextStyle? get toolbarTextStyle => _theme.textTheme.bodyMedium; @override - TextStyle? get titleTextStyle => _theme.textTheme.headline6; + TextStyle? get titleTextStyle => _theme.textTheme.titleLarge; } // BEGIN GENERATED TOKEN PROPERTIES - AppBar @@ -2375,7 +2375,7 @@ class _AppBarDefaultsM3 extends AppBarTheme { ); @override - TextStyle? get toolbarTextStyle => _textTheme.bodyText2; + TextStyle? get toolbarTextStyle => _textTheme.bodyMedium; @override TextStyle? get titleTextStyle => _textTheme.titleLarge; diff --git a/packages/flutter/lib/src/material/banner.dart b/packages/flutter/lib/src/material/banner.dart index 15da6e828c..6eede2df7c 100644 --- a/packages/flutter/lib/src/material/banner.dart +++ b/packages/flutter/lib/src/material/banner.dart @@ -121,7 +121,7 @@ class MaterialBanner extends StatefulWidget { /// Style for the text in the [content] of the [MaterialBanner]. /// /// If `null`, [MaterialBannerThemeData.contentTextStyle] is used. If that is - /// also `null`, [TextTheme.bodyText2] of [ThemeData.textTheme] is used. + /// also `null`, [TextTheme.bodyMedium] of [ThemeData.textTheme] is used. final TextStyle? contentTextStyle; /// The set of actions that are displayed at the bottom or trailing side of @@ -299,7 +299,7 @@ class _MaterialBannerState extends State { ?? theme.colorScheme.surface; final TextStyle? textStyle = widget.contentTextStyle ?? bannerTheme.contentTextStyle - ?? theme.textTheme.bodyText2; + ?? theme.textTheme.bodyMedium; Widget materialBanner = Container( margin: EdgeInsets.only(bottom: elevation > 0 ? 10.0 : 0.0), diff --git a/packages/flutter/lib/src/material/calendar_date_picker.dart b/packages/flutter/lib/src/material/calendar_date_picker.dart index 7a146930ee..9b24edd7fe 100644 --- a/packages/flutter/lib/src/material/calendar_date_picker.dart +++ b/packages/flutter/lib/src/material/calendar_date_picker.dart @@ -394,7 +394,7 @@ class _DatePickerModeToggleButtonState extends State<_DatePickerModeToggleButton child: Text( widget.title, overflow: TextOverflow.ellipsis, - style: textTheme.subtitle2?.copyWith( + style: textTheme.titleSmall?.copyWith( color: controlColor, ), ), @@ -937,10 +937,10 @@ class _DayPickerState extends State<_DayPicker> { final ColorScheme colorScheme = Theme.of(context).colorScheme; final MaterialLocalizations localizations = MaterialLocalizations.of(context); final TextTheme textTheme = Theme.of(context).textTheme; - final TextStyle? headerStyle = textTheme.caption?.apply( + final TextStyle? headerStyle = textTheme.bodySmall?.apply( color: colorScheme.onSurface.withOpacity(0.60), ); - final TextStyle dayStyle = textTheme.caption!; + final TextStyle dayStyle = textTheme.bodySmall!; final Color enabledDayColor = colorScheme.onSurface.withOpacity(0.87); final Color disabledDayColor = colorScheme.onSurface.withOpacity(0.38); final Color selectedDayColor = colorScheme.onPrimary; @@ -1185,7 +1185,7 @@ class _YearPickerState extends State { } else { textColor = colorScheme.onSurface.withOpacity(0.87); } - final TextStyle? itemStyle = textTheme.bodyText1?.apply(color: textColor); + final TextStyle? itemStyle = textTheme.bodyLarge?.apply(color: textColor); BoxDecoration? decoration; if (isSelected) { diff --git a/packages/flutter/lib/src/material/chip.dart b/packages/flutter/lib/src/material/chip.dart index 73bd516475..b05bc29434 100644 --- a/packages/flutter/lib/src/material/chip.dart +++ b/packages/flutter/lib/src/material/chip.dart @@ -77,7 +77,7 @@ abstract class ChipAttributes { /// The style to be applied to the chip's label. /// - /// The default label style is [TextTheme.bodyText1] from the overall + /// The default label style is [TextTheme.bodyLarge] from the overall /// theme's [ThemeData.textTheme]. // /// This only has an effect on widgets that respect the [DefaultTextStyle], @@ -1167,7 +1167,7 @@ class _RawChipState extends State with MaterialStateMixin, TickerProvid final ChipThemeData chipDefaults = widget.defaultProperties ?? ChipThemeData.fromDefaults( brightness: brightness, secondaryColor: brightness == Brightness.dark ? Colors.tealAccent[200]! : theme.primaryColor, - labelStyle: theme.textTheme.bodyText1!, + labelStyle: theme.textTheme.bodyLarge!, ); final TextDirection? textDirection = Directionality.maybeOf(context); final OutlinedBorder resolvedShape = _getShape(theme, chipTheme, chipDefaults); diff --git a/packages/flutter/lib/src/material/circle_avatar.dart b/packages/flutter/lib/src/material/circle_avatar.dart index 6029e95ba7..61faac64fd 100644 --- a/packages/flutter/lib/src/material/circle_avatar.dart +++ b/packages/flutter/lib/src/material/circle_avatar.dart @@ -192,7 +192,7 @@ class CircleAvatar extends StatelessWidget { Widget build(BuildContext context) { assert(debugCheckHasMediaQuery(context)); final ThemeData theme = Theme.of(context); - TextStyle textStyle = theme.primaryTextTheme.subtitle1!.copyWith(color: foregroundColor); + TextStyle textStyle = theme.primaryTextTheme.titleMedium!.copyWith(color: foregroundColor); Color? effectiveBackgroundColor = backgroundColor; if (effectiveBackgroundColor == null) { switch (ThemeData.estimateBrightnessForColor(textStyle.color!)) { diff --git a/packages/flutter/lib/src/material/data_table.dart b/packages/flutter/lib/src/material/data_table.dart index 7cea784123..443c20a8b9 100644 --- a/packages/flutter/lib/src/material/data_table.dart +++ b/packages/flutter/lib/src/material/data_table.dart @@ -515,7 +515,7 @@ class DataTable extends StatelessWidget { /// {@endtemplate} /// /// If null, [DataTableThemeData.dataTextStyle] is used. By default, the text - /// style is [TextTheme.bodyText2]. + /// style is [TextTheme.bodyMedium]. final TextStyle? dataTextStyle; /// {@template flutter.material.dataTable.headingRowColor} @@ -565,7 +565,7 @@ class DataTable extends StatelessWidget { /// {@endtemplate} /// /// If null, [DataTableThemeData.headingTextStyle] is used. By default, the - /// text style is [TextTheme.subtitle2]. + /// text style is [TextTheme.titleSmall]. final TextStyle? headingTextStyle; /// {@template flutter.material.dataTable.horizontalMargin} @@ -774,7 +774,7 @@ class DataTable extends StatelessWidget { final TextStyle effectiveHeadingTextStyle = headingTextStyle ?? dataTableTheme.headingTextStyle ?? themeData.dataTableTheme.headingTextStyle - ?? themeData.textTheme.subtitle2!; + ?? themeData.textTheme.titleSmall!; final double effectiveHeadingRowHeight = headingRowHeight ?? dataTableTheme.headingRowHeight ?? themeData.dataTableTheme.headingRowHeight @@ -837,7 +837,7 @@ class DataTable extends StatelessWidget { final TextStyle effectiveDataTextStyle = dataTextStyle ?? dataTableTheme.dataTextStyle ?? themeData.dataTableTheme.dataTextStyle - ?? themeData.textTheme.bodyText2!; + ?? themeData.textTheme.bodyMedium!; final double effectiveDataRowHeight = dataRowHeight ?? dataTableTheme.dataRowHeight ?? themeData.dataTableTheme.dataRowHeight diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index 40881cc81f..d52c7f9693 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -467,8 +467,8 @@ class _DatePickerDialogState extends State with RestorationMix ? colorScheme.onPrimary : colorScheme.onSurface; final TextStyle? dateStyle = orientation == Orientation.landscape - ? textTheme.headline5?.copyWith(color: onPrimarySurface) - : textTheme.headline4?.copyWith(color: onPrimarySurface); + ? textTheme.headlineSmall?.copyWith(color: onPrimarySurface) + : textTheme.headlineMedium?.copyWith(color: onPrimarySurface); final Widget actions = Container( alignment: AlignmentDirectional.centerEnd, @@ -752,7 +752,7 @@ class _DatePickerHeader extends StatelessWidget { final Color primarySurfaceColor = isDark ? colorScheme.surface : colorScheme.primary; final Color onPrimarySurfaceColor = isDark ? colorScheme.onSurface : colorScheme.onPrimary; - final TextStyle? helpStyle = textTheme.overline?.copyWith( + final TextStyle? helpStyle = textTheme.labelSmall?.copyWith( color: onPrimarySurfaceColor, ); @@ -1483,14 +1483,14 @@ class _CalendarRangePickerDialog extends StatelessWidget { final Color headerDisabledForeground = headerForeground.withOpacity(0.38); final String startDateText = _formatRangeStartDate(localizations, selectedStartDate, selectedEndDate); final String endDateText = _formatRangeEndDate(localizations, selectedStartDate, selectedEndDate, DateTime.now()); - final TextStyle? headlineStyle = textTheme.headline5; + final TextStyle? headlineStyle = textTheme.headlineSmall; final TextStyle? startDateStyle = headlineStyle?.apply( color: selectedStartDate != null ? headerForeground : headerDisabledForeground, ); final TextStyle? endDateStyle = headlineStyle?.apply( color: selectedEndDate != null ? headerForeground : headerDisabledForeground, ); - final TextStyle saveButtonStyle = textTheme.button!.apply( + final TextStyle saveButtonStyle = textTheme.labelLarge!.apply( color: onConfirm != null ? headerForeground : headerDisabledForeground, ); @@ -1525,7 +1525,7 @@ class _CalendarRangePickerDialog extends StatelessWidget { children: [ Text( helpText, - style: textTheme.overline!.apply( + style: textTheme.labelSmall!.apply( color: headerForeground, ), ), @@ -1984,7 +1984,7 @@ class _DayHeaders extends StatelessWidget { Widget build(BuildContext context) { final ThemeData themeData = Theme.of(context); final ColorScheme colorScheme = themeData.colorScheme; - final TextStyle textStyle = themeData.textTheme.subtitle2!.apply(color: colorScheme.onSurface); + final TextStyle textStyle = themeData.textTheme.titleSmall!.apply(color: colorScheme.onSurface); final MaterialLocalizations localizations = MaterialLocalizations.of(context); final List labels = _getDayHeaders(textStyle, localizations); @@ -2270,7 +2270,7 @@ class _MonthItemState extends State<_MonthItem> { final bool isDisabled = dayToBuild.isAfter(widget.lastDate) || dayToBuild.isBefore(widget.firstDate); BoxDecoration? decoration; - TextStyle? itemStyle = textTheme.bodyText2; + TextStyle? itemStyle = textTheme.bodyMedium; final bool isRangeSelected = widget.selectedDateStart != null && widget.selectedDateEnd != null; final bool isSelectedDayStart = widget.selectedDateStart != null && dayToBuild.isAtSameMomentAs(widget.selectedDateStart!); @@ -2284,7 +2284,7 @@ class _MonthItemState extends State<_MonthItem> { if (isSelectedDayStart || isSelectedDayEnd) { // The selected start and end dates gets a circle background // highlight, and a contrasting text color. - itemStyle = textTheme.bodyText2?.apply(color: colorScheme.onPrimary); + itemStyle = textTheme.bodyMedium?.apply(color: colorScheme.onPrimary); decoration = BoxDecoration( color: colorScheme.primary, shape: BoxShape.circle, @@ -2308,11 +2308,11 @@ class _MonthItemState extends State<_MonthItem> { textDirection: textDirection, ); } else if (isDisabled) { - itemStyle = textTheme.bodyText2?.apply(color: colorScheme.onSurface.withOpacity(0.38)); + itemStyle = textTheme.bodyMedium?.apply(color: colorScheme.onSurface.withOpacity(0.38)); } else if (DateUtils.isSameDay(widget.currentDate, dayToBuild)) { // The current day gets a different text color and a circle stroke // border. - itemStyle = textTheme.bodyText2?.apply(color: colorScheme.primary); + itemStyle = textTheme.bodyMedium?.apply(color: colorScheme.primary); decoration = BoxDecoration( border: Border.all(color: colorScheme.primary), shape: BoxShape.circle, @@ -2458,7 +2458,7 @@ class _MonthItemState extends State<_MonthItem> { child: ExcludeSemantics( child: Text( localizations.formatMonthYear(widget.displayedMonth), - style: textTheme.bodyText2!.apply(color: themeData.colorScheme.onSurface), + style: textTheme.bodyMedium!.apply(color: themeData.colorScheme.onSurface), ), ), ), @@ -2606,8 +2606,8 @@ class _InputDateRangePickerDialog extends StatelessWidget { ? colorScheme.onPrimary : colorScheme.onSurface; final TextStyle? dateStyle = orientation == Orientation.landscape - ? textTheme.headline5?.apply(color: onPrimarySurfaceColor) - : textTheme.headline4?.apply(color: onPrimarySurfaceColor); + ? textTheme.headlineSmall?.apply(color: onPrimarySurfaceColor) + : textTheme.headlineMedium?.apply(color: onPrimarySurfaceColor); final String dateText = _formatDateRange(context, selectedStartDate, selectedEndDate, currentDate!); final String semanticDateText = selectedStartDate != null && selectedEndDate != null ? '${localizations.formatMediumDate(selectedStartDate!)} – ${localizations.formatMediumDate(selectedEndDate!)}' diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index a85dd27d0e..4ebb397e64 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -334,7 +334,7 @@ class AlertDialog extends StatelessWidget { /// Style for the text in the [title] of this [AlertDialog]. /// /// If null, [DialogTheme.titleTextStyle] is used. If that's null, defaults to - /// [TextTheme.headline6] of [ThemeData.textTheme]. + /// [TextTheme.titleLarge] of [ThemeData.textTheme]. final TextStyle? titleTextStyle; /// The (optional) content of the dialog is displayed in the center of the @@ -363,7 +363,7 @@ class AlertDialog extends StatelessWidget { /// Style for the text in the [content] of this [AlertDialog]. /// /// If null, [DialogTheme.contentTextStyle] is used. If that's null, defaults - /// to [TextTheme.subtitle1] of [ThemeData.textTheme]. + /// to [TextTheme.titleMedium] of [ThemeData.textTheme]. final TextStyle? contentTextStyle; /// The (optional) set of actions that are displayed at the bottom of the @@ -888,7 +888,7 @@ class SimpleDialog extends StatelessWidget { /// Style for the text in the [title] of this [SimpleDialog]. /// /// If null, [DialogTheme.titleTextStyle] is used. If that's null, defaults to - /// [TextTheme.headline6] of [ThemeData.textTheme]. + /// [TextTheme.titleLarge] of [ThemeData.textTheme]. final TextStyle? titleTextStyle; /// The (optional) content of the dialog is displayed in a @@ -976,7 +976,7 @@ class SimpleDialog extends StatelessWidget { bottom: children == null ? effectiveTitlePadding.bottom * paddingScaleFactor : effectiveTitlePadding.bottom, ), child: DefaultTextStyle( - style: titleTextStyle ?? DialogTheme.of(context).titleTextStyle ?? theme.textTheme.headline6!, + style: titleTextStyle ?? DialogTheme.of(context).titleTextStyle ?? theme.textTheme.titleLarge!, child: Semantics( // For iOS platform, the focus always lands on the title. // Set nameRoute to false to avoid title being announce twice. @@ -1297,10 +1297,10 @@ class _DialogDefaultsM2 extends DialogTheme { Color? get backgroundColor => Theme.of(context).dialogBackgroundColor; @override - TextStyle? get titleTextStyle => _textTheme.headline6; + TextStyle? get titleTextStyle => _textTheme.titleLarge; @override - TextStyle? get contentTextStyle => _textTheme.subtitle1; + TextStyle? get contentTextStyle => _textTheme.titleMedium; @override EdgeInsetsGeometry? get actionsPadding => EdgeInsets.zero; diff --git a/packages/flutter/lib/src/material/drawer_header.dart b/packages/flutter/lib/src/material/drawer_header.dart index 4b5a2df6f9..bff2c267d8 100644 --- a/packages/flutter/lib/src/material/drawer_header.dart +++ b/packages/flutter/lib/src/material/drawer_header.dart @@ -91,7 +91,7 @@ class DrawerHeader extends StatelessWidget { duration: duration, curve: curve, child: child == null ? null : DefaultTextStyle( - style: theme.textTheme.bodyText1!, + style: theme.textTheme.bodyLarge!, child: MediaQuery.removePadding( context: context, removeTop: true, diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart index 4fe46d78ca..764557d720 100644 --- a/packages/flutter/lib/src/material/dropdown.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -1050,7 +1050,7 @@ class DropdownButton extends StatefulWidget { /// ** See code in examples/api/lib/material/dropdown/dropdown_button.style.0.dart ** /// {@end-tool} /// - /// Defaults to the [TextTheme.subtitle1] value of the current + /// Defaults to the [TextTheme.titleMedium] value of the current /// [ThemeData.textTheme] of the current [Theme]. final TextStyle? style; @@ -1266,7 +1266,7 @@ class _DropdownButtonState extends State> with WidgetsBindi } } - TextStyle? get _textStyle => widget.style ?? Theme.of(context).textTheme.subtitle1; + TextStyle? get _textStyle => widget.style ?? Theme.of(context).textTheme.titleMedium; void _handleTap() { final TextDirection? textDirection = Directionality.maybeOf(context); @@ -1334,7 +1334,7 @@ class _DropdownButtonState extends State> with WidgetsBindi // would be clipped. double get _denseButtonHeight { final double textScaleFactor = MediaQuery.of(context).textScaleFactor; - final double fontSize = _textStyle!.fontSize ?? Theme.of(context).textTheme.subtitle1!.fontSize!; + final double fontSize = _textStyle!.fontSize ?? Theme.of(context).textTheme.titleMedium!.fontSize!; final double scaledFontSize = textScaleFactor * fontSize; return math.max(scaledFontSize, math.max(widget.iconSize, _kDenseButtonHeight)); } diff --git a/packages/flutter/lib/src/material/elevated_button.dart b/packages/flutter/lib/src/material/elevated_button.dart index 399cbd0707..8d9f46252f 100644 --- a/packages/flutter/lib/src/material/elevated_button.dart +++ b/packages/flutter/lib/src/material/elevated_button.dart @@ -362,7 +362,7 @@ class ElevatedButton extends ButtonStyleButton { disabledForegroundColor: colorScheme.onSurface.withOpacity(0.38), shadowColor: theme.shadowColor, elevation: 2, - textStyle: theme.textTheme.button, + textStyle: theme.textTheme.labelLarge, padding: _scaledPadding(context), minimumSize: const Size(64, 36), maximumSize: Size.infinite, diff --git a/packages/flutter/lib/src/material/expansion_tile.dart b/packages/flutter/lib/src/material/expansion_tile.dart index ece7892e97..9014bbd23b 100644 --- a/packages/flutter/lib/src/material/expansion_tile.dart +++ b/packages/flutter/lib/src/material/expansion_tile.dart @@ -409,7 +409,7 @@ class _ExpansionTileState extends State with SingleTickerProvider _headerColorTween ..begin = widget.collapsedTextColor ?? expansionTileTheme.collapsedTextColor - ?? theme.textTheme.subtitle1!.color + ?? theme.textTheme.titleMedium!.color ..end = widget.textColor ?? expansionTileTheme.textColor ?? colorScheme.primary; _iconColorTween ..begin = widget.collapsedIconColor diff --git a/packages/flutter/lib/src/material/flexible_space_bar.dart b/packages/flutter/lib/src/material/flexible_space_bar.dart index be29b78515..518f91f018 100644 --- a/packages/flutter/lib/src/material/flexible_space_bar.dart +++ b/packages/flutter/lib/src/material/flexible_space_bar.dart @@ -322,7 +322,7 @@ class _FlexibleSpaceBarState extends State { final double opacity = settings.toolbarOpacity; if (opacity > 0.0) { - TextStyle titleStyle = theme.primaryTextTheme.headline6!; + TextStyle titleStyle = theme.primaryTextTheme.titleLarge!; titleStyle = titleStyle.copyWith( color: titleStyle.color!.withOpacity(opacity), ); diff --git a/packages/flutter/lib/src/material/floating_action_button.dart b/packages/flutter/lib/src/material/floating_action_button.dart index 376acda063..06b715a6df 100644 --- a/packages/flutter/lib/src/material/floating_action_button.dart +++ b/packages/flutter/lib/src/material/floating_action_button.dart @@ -501,7 +501,7 @@ class FloatingActionButton extends StatelessWidget { /// The text style for an extended [FloatingActionButton]'s label. /// /// If null, [FloatingActionButtonThemeData.extendedTextStyle] is used. If - /// that is also null, then [TextTheme.button] with a letter spacing of 1.2 + /// that is also null, then [TextTheme.labelLarge] with a letter spacing of 1.2 /// is used. final TextStyle? extendedTextStyle; @@ -794,7 +794,7 @@ class _FABDefaultsM2 extends FloatingActionButtonThemeData { @override double? get iconSize => _isLarge ? 36.0 : 24.0; @override EdgeInsetsGeometry? get extendedPadding => EdgeInsetsDirectional.only(start: hasChild && _isExtended ? 16.0 : 20.0, end: 20.0); - @override TextStyle? get extendedTextStyle => _theme.textTheme.button!.copyWith(letterSpacing: 1.2); + @override TextStyle? get extendedTextStyle => _theme.textTheme.labelLarge!.copyWith(letterSpacing: 1.2); } // BEGIN GENERATED TOKEN PROPERTIES - FAB diff --git a/packages/flutter/lib/src/material/grid_tile_bar.dart b/packages/flutter/lib/src/material/grid_tile_bar.dart index e8f923b785..d9b3c32234 100644 --- a/packages/flutter/lib/src/material/grid_tile_bar.dart +++ b/packages/flutter/lib/src/material/grid_tile_bar.dart @@ -88,13 +88,13 @@ class GridTileBar extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ DefaultTextStyle( - style: darkTheme.textTheme.subtitle1!, + style: darkTheme.textTheme.titleMedium!, softWrap: false, overflow: TextOverflow.ellipsis, child: title!, ), DefaultTextStyle( - style: darkTheme.textTheme.caption!, + style: darkTheme.textTheme.bodySmall!, softWrap: false, overflow: TextOverflow.ellipsis, child: subtitle!, @@ -105,7 +105,7 @@ class GridTileBar extends StatelessWidget { else if (title != null || subtitle != null) Expanded( child: DefaultTextStyle( - style: darkTheme.textTheme.subtitle1!, + style: darkTheme.textTheme.titleMedium!, softWrap: false, overflow: TextOverflow.ellipsis, child: title ?? subtitle!, diff --git a/packages/flutter/lib/src/material/input_decorator.dart b/packages/flutter/lib/src/material/input_decorator.dart index fd58da9bae..aa76a8ce3a 100644 --- a/packages/flutter/lib/src/material/input_decorator.dart +++ b/packages/flutter/lib/src/material/input_decorator.dart @@ -1761,7 +1761,7 @@ class InputDecorator extends StatefulWidget { /// The style on which to base the label, hint, counter, and error styles /// if the [decoration] does not provide explicit styles. /// - /// If null, `baseStyle` defaults to the `subtitle1` style from the + /// If null, `baseStyle` defaults to the `titleMedium` style from the /// current [Theme], see [ThemeData.textTheme]. /// /// The [TextStyle.textBaseline] of the [baseStyle] is used to determine @@ -2029,7 +2029,7 @@ class _InputDecoratorState extends State with TickerProviderStat final TextStyle? style = MaterialStateProperty.resolveAs(decoration.labelStyle, materialState) ?? MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.labelStyle, materialState); - return themeData.textTheme.subtitle1! + return themeData.textTheme.titleMedium! .merge(widget.baseStyle) .merge(defaultStyle) .merge(style) @@ -2044,7 +2044,7 @@ class _InputDecoratorState extends State with TickerProviderStat final TextStyle? style = MaterialStateProperty.resolveAs(decoration.hintStyle, materialState) ?? MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.hintStyle, materialState); - return themeData.textTheme.subtitle1! + return themeData.textTheme.titleMedium! .merge(widget.baseStyle) .merge(defaultStyle) .merge(style); @@ -2060,7 +2060,7 @@ class _InputDecoratorState extends State with TickerProviderStat final TextStyle? style = MaterialStateProperty.resolveAs(decoration.floatingLabelStyle, materialState) ?? MaterialStateProperty.resolveAs(themeData.inputDecorationTheme.floatingLabelStyle, materialState); - return themeData.textTheme.subtitle1! + return themeData.textTheme.titleMedium! .merge(widget.baseStyle) .copyWith(height: 1) .merge(defaultTextStyle) @@ -4357,19 +4357,19 @@ class _InputDecoratorDefaultsM2 extends InputDecorationTheme { TextStyle? get helperStyle => MaterialStateTextStyle.resolveWith((Set states) { final ThemeData themeData= Theme.of(context); if (states.contains(MaterialState.disabled)) { - return themeData.textTheme.caption!.copyWith(color: Colors.transparent); + return themeData.textTheme.bodySmall!.copyWith(color: Colors.transparent); } - return themeData.textTheme.caption!.copyWith(color: themeData.hintColor); + return themeData.textTheme.bodySmall!.copyWith(color: themeData.hintColor); }); @override TextStyle? get errorStyle => MaterialStateTextStyle.resolveWith((Set states) { final ThemeData themeData= Theme.of(context); if (states.contains(MaterialState.disabled)) { - return themeData.textTheme.caption!.copyWith(color: Colors.transparent); + return themeData.textTheme.bodySmall!.copyWith(color: Colors.transparent); } - return themeData.textTheme.caption!.copyWith(color: themeData.errorColor); + return themeData.textTheme.bodySmall!.copyWith(color: themeData.errorColor); }); @override diff --git a/packages/flutter/lib/src/material/list_tile.dart b/packages/flutter/lib/src/material/list_tile.dart index dc20750765..0ea45078be 100644 --- a/packages/flutter/lib/src/material/list_tile.dart +++ b/packages/flutter/lib/src/material/list_tile.dart @@ -23,8 +23,8 @@ import 'theme_data.dart'; /// Defines the title font used for [ListTile] descendants of a [ListTileTheme]. /// -/// List tiles that appear in a [Drawer] use the theme's [TextTheme.bodyText1] -/// text style, which is a little smaller than the theme's [TextTheme.subtitle1] +/// List tiles that appear in a [Drawer] use the theme's [TextTheme.bodyLarge] +/// text style, which is a little smaller than the theme's [TextTheme.titleMedium] /// text style, which is used by default. enum ListTileStyle { /// Use a title font that's appropriate for a [ListTile] in a list. @@ -323,14 +323,14 @@ class ListTile extends StatelessWidget { /// two lines. For example, you can use [Text.maxLines] to enforce the number /// 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] /// and [selected]. /// /// When [enabled] is false, the text color is set to [ThemeData.disabledColor]. /// /// 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. final Widget? subtitle; @@ -624,10 +624,10 @@ class ListTile extends StatelessWidget { final TextStyle textStyle; switch(style ?? tileTheme.style ?? theme.listTileTheme.style ?? ListTileStyle.list) { case ListTileStyle.drawer: - textStyle = theme.useMaterial3 ? theme.textTheme.bodyMedium! : theme.textTheme.bodyText1!; + textStyle = theme.useMaterial3 ? theme.textTheme.bodyMedium! : theme.textTheme.bodyLarge!; break; case ListTileStyle.list: - textStyle = theme.useMaterial3 ? theme.textTheme.titleMedium! : theme.textTheme.subtitle1!; + textStyle = theme.useMaterial3 ? theme.textTheme.titleMedium! : theme.textTheme.titleMedium!; break; } final Color? color = _textColor(theme, tileTheme, textStyle.color); @@ -637,11 +637,11 @@ class ListTile extends StatelessWidget { } TextStyle _subtitleTextStyle(ThemeData theme, ListTileThemeData tileTheme) { - final TextStyle textStyle = theme.useMaterial3 ? theme.textTheme.bodyMedium! : theme.textTheme.bodyText2!; + final TextStyle textStyle = theme.useMaterial3 ? theme.textTheme.bodyMedium! : theme.textTheme.bodyMedium!; final Color? color = _textColor( theme, tileTheme, - theme.useMaterial3 ? theme.textTheme.bodySmall!.color : theme.textTheme.caption!.color, + theme.useMaterial3 ? theme.textTheme.bodySmall!.color : theme.textTheme.bodySmall!.color, ); return _isDenseLayout(theme, tileTheme) ? textStyle.copyWith(color: color, fontSize: 12.0) @@ -649,7 +649,7 @@ class ListTile extends StatelessWidget { } TextStyle _trailingAndLeadingTextStyle(ThemeData theme, ListTileThemeData tileTheme) { - final TextStyle textStyle = theme.useMaterial3 ? theme.textTheme.bodyMedium! : theme.textTheme.bodyText2!; + final TextStyle textStyle = theme.useMaterial3 ? theme.textTheme.bodyMedium! : theme.textTheme.bodyMedium!; final Color? color = _textColor(theme, tileTheme, textStyle.color); return textStyle.copyWith(color: color); } diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart index 15b1ce3c80..1194a0f1bc 100644 --- a/packages/flutter/lib/src/material/material.dart +++ b/packages/flutter/lib/src/material/material.dart @@ -417,7 +417,7 @@ class _MaterialState extends State with TickerProviderStateMixin { Widget? contents = widget.child; if (contents != null) { contents = AnimatedDefaultTextStyle( - style: widget.textStyle ?? Theme.of(context).textTheme.bodyText2!, + style: widget.textStyle ?? Theme.of(context).textTheme.bodyMedium!, duration: widget.animationDuration, child: contents, ); diff --git a/packages/flutter/lib/src/material/material_button.dart b/packages/flutter/lib/src/material/material_button.dart index 67dbc1da71..9a20732463 100644 --- a/packages/flutter/lib/src/material/material_button.dart +++ b/packages/flutter/lib/src/material/material_button.dart @@ -130,7 +130,7 @@ class MaterialButton extends StatelessWidget { /// The color to use for this button's text. /// /// The button's [Material.textStyle] will be the current theme's button text - /// style, [TextTheme.button] of [ThemeData.textTheme], configured with this + /// style, [TextTheme.labelLarge] of [ThemeData.textTheme], configured with this /// color. /// /// The default text color depends on the button theme's text theme, @@ -148,7 +148,7 @@ class MaterialButton extends StatelessWidget { /// The color to use for this button's text when the button is disabled. /// /// The button's [Material.textStyle] will be the current theme's button text - /// style, [TextTheme.button] of [ThemeData.textTheme], configured with this + /// style, [TextTheme.labelLarge] of [ThemeData.textTheme], configured with this /// color. /// /// The default value is the theme's disabled color, @@ -395,7 +395,7 @@ class MaterialButton extends StatelessWidget { onHighlightChanged: onHighlightChanged, mouseCursor: mouseCursor, fillColor: buttonTheme.getFillColor(this), - textStyle: theme.textTheme.button!.copyWith(color: buttonTheme.getTextColor(this)), + textStyle: theme.textTheme.labelLarge!.copyWith(color: buttonTheme.getTextColor(this)), focusColor: focusColor ?? buttonTheme.getFocusColor(this), hoverColor: hoverColor ?? buttonTheme.getHoverColor(this), highlightColor: highlightColor ?? theme.highlightColor, diff --git a/packages/flutter/lib/src/material/navigation_bar.dart b/packages/flutter/lib/src/material/navigation_bar.dart index 85cc7e2c36..b0dd9a85f5 100644 --- a/packages/flutter/lib/src/material/navigation_bar.dart +++ b/packages/flutter/lib/src/material/navigation_bar.dart @@ -268,7 +268,7 @@ class NavigationDestination extends StatelessWidget { /// /// The accompanying [Text] widget will use /// [NavigationBarThemeData.labelTextStyle]. If this are null, the default - /// text style would use [TextTheme.overline] with [ColorScheme.onSurface]. + /// text style would use [TextTheme.labelSmall] with [ColorScheme.onSurface]. final String label; /// The text to display in the tooltip for this [NavigationDestination], when @@ -1224,7 +1224,7 @@ class _NavigationBarDefaultsM2 extends NavigationBarThemeData { @override Color? get indicatorColor => _colors.secondary.withOpacity(0.24); - @override MaterialStateProperty? get labelTextStyle => MaterialStatePropertyAll(_theme.textTheme.overline!.copyWith(color: _colors.onSurface)); + @override MaterialStateProperty? get labelTextStyle => MaterialStatePropertyAll(_theme.textTheme.labelSmall!.copyWith(color: _colors.onSurface)); } // BEGIN GENERATED TOKEN PROPERTIES - NavigationBar diff --git a/packages/flutter/lib/src/material/navigation_rail.dart b/packages/flutter/lib/src/material/navigation_rail.dart index 8502a119b2..f3c2a10c09 100644 --- a/packages/flutter/lib/src/material/navigation_rail.dart +++ b/packages/flutter/lib/src/material/navigation_rail.dart @@ -226,7 +226,7 @@ class NavigationRail extends StatefulWidget { /// When one of the [destinations] is selected the [selectedLabelTextStyle] /// will be used instead. /// - /// The default value is based on the [Theme]'s [TextTheme.bodyText1]. The + /// The default value is based on the [Theme]'s [TextTheme.bodyLarge]. The /// default color is based on the [Theme]'s [ColorScheme.onSurface]. /// /// Properties from this text style, or @@ -239,7 +239,7 @@ class NavigationRail extends StatefulWidget { /// When a [NavigationRailDestination] is not selected, /// [unselectedLabelTextStyle] will be used. /// - /// The default value is based on the [TextTheme.bodyText1] of + /// The default value is based on the [TextTheme.bodyLarge] of /// [ThemeData.textTheme]. The default color is based on the [Theme]'s /// [ColorScheme.primary]. /// @@ -936,11 +936,11 @@ class _NavigationRailDefaultsM2 extends NavigationRailThemeData { @override Color? get backgroundColor => _colors.surface; @override TextStyle? get unselectedLabelTextStyle { - return _theme.textTheme.bodyText1!.copyWith(color: _colors.onSurface.withOpacity(0.64)); + return _theme.textTheme.bodyLarge!.copyWith(color: _colors.onSurface.withOpacity(0.64)); } @override TextStyle? get selectedLabelTextStyle { - return _theme.textTheme.bodyText1!.copyWith(color: _colors.primary); + return _theme.textTheme.bodyLarge!.copyWith(color: _colors.primary); } @override IconThemeData? get unselectedIconTheme { diff --git a/packages/flutter/lib/src/material/outlined_button.dart b/packages/flutter/lib/src/material/outlined_button.dart index 5d95f6e117..065fc1e5be 100644 --- a/packages/flutter/lib/src/material/outlined_button.dart +++ b/packages/flutter/lib/src/material/outlined_button.dart @@ -318,7 +318,7 @@ class OutlinedButton extends ButtonStyleButton { disabledBackgroundColor: Colors.transparent, shadowColor: theme.shadowColor, elevation: 0, - textStyle: theme.textTheme.button, + textStyle: theme.textTheme.labelLarge, padding: _scaledPadding(context), minimumSize: const Size(64, 36), maximumSize: Size.infinite, diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart index 567afe26e9..64ba4aa859 100644 --- a/packages/flutter/lib/src/material/paginated_data_table.dart +++ b/packages/flutter/lib/src/material/paginated_data_table.dart @@ -404,7 +404,7 @@ class PaginatedDataTableState extends State { } // FOOTER - final TextStyle? footerTextStyle = themeData.textTheme.caption; + final TextStyle? footerTextStyle = themeData.textTheme.bodySmall; final List footerWidgets = []; if (widget.onRowsPerPageChanged != null) { final List availableRowsPerPage = widget.availableRowsPerPage @@ -493,8 +493,8 @@ class PaginatedDataTableState extends State { // These typographic styles aren't quite the regular ones. We pick the closest ones from the regular // list and then tweak them appropriately. // See https://material.io/design/components/data-tables.html#tables-within-cards - style: _selectedRowCount > 0 ? themeData.textTheme.subtitle1!.copyWith(color: themeData.colorScheme.secondary) - : themeData.textTheme.headline6!.copyWith(fontWeight: FontWeight.w400), + style: _selectedRowCount > 0 ? themeData.textTheme.titleMedium!.copyWith(color: themeData.colorScheme.secondary) + : themeData.textTheme.titleLarge!.copyWith(fontWeight: FontWeight.w400), child: IconTheme.merge( data: const IconThemeData( opacity: 0.54, diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index ee73bb0327..b0689adc33 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -267,7 +267,7 @@ class PopupMenuItem extends PopupMenuEntry { /// The text style of the popup menu item. /// /// If this property is null, then [PopupMenuThemeData.textStyle] is used. - /// If [PopupMenuThemeData.textStyle] is also null, then [TextTheme.subtitle1] + /// If [PopupMenuThemeData.textStyle] is also null, then [TextTheme.titleMedium] /// of [ThemeData.textTheme] is used. final TextStyle? textStyle; @@ -344,7 +344,7 @@ class PopupMenuItemState> extends State { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); final PopupMenuThemeData popupMenuTheme = PopupMenuTheme.of(context); - TextStyle style = widget.textStyle ?? popupMenuTheme.textStyle ?? theme.textTheme.subtitle1!; + TextStyle style = widget.textStyle ?? popupMenuTheme.textStyle ?? theme.textTheme.titleMedium!; if (!widget.enabled) { style = style.copyWith(color: theme.disabledColor); diff --git a/packages/flutter/lib/src/material/range_slider.dart b/packages/flutter/lib/src/material/range_slider.dart index df6839f3f4..ea3a1348da 100644 --- a/packages/flutter/lib/src/material/range_slider.dart +++ b/packages/flutter/lib/src/material/range_slider.dart @@ -292,7 +292,7 @@ class RangeSlider extends StatefulWidget { /// There are two labels: one for the start thumb and one for the end thumb. /// /// Each label is rendered using the active [ThemeData]'s - /// [TextTheme.bodyText1] text style, with the theme data's + /// [TextTheme.bodyLarge] text style, with the theme data's /// [ColorScheme.onPrimary] color. The label's text style can be overridden /// with [SliderThemeData.valueIndicatorTextStyle]. /// @@ -609,7 +609,7 @@ class _RangeSliderState extends State with TickerProviderStateMixin overlayShape: sliderTheme.overlayShape ?? defaultOverlayShape, rangeValueIndicatorShape: valueIndicatorShape, showValueIndicator: sliderTheme.showValueIndicator ?? defaultShowValueIndicator, - valueIndicatorTextStyle: sliderTheme.valueIndicatorTextStyle ?? theme.textTheme.bodyText1!.copyWith( + valueIndicatorTextStyle: sliderTheme.valueIndicatorTextStyle ?? theme.textTheme.bodyLarge!.copyWith( color: theme.colorScheme.onPrimary, ), minThumbSeparation: sliderTheme.minThumbSeparation ?? defaultMinThumbSeparation, diff --git a/packages/flutter/lib/src/material/search.dart b/packages/flutter/lib/src/material/search.dart index 04b730d067..0f1cbaf234 100644 --- a/packages/flutter/lib/src/material/search.dart +++ b/packages/flutter/lib/src/material/search.dart @@ -583,7 +583,7 @@ class _SearchPageState extends State<_SearchPage> { title: TextField( controller: widget.delegate._queryTextController, focusNode: focusNode, - style: widget.delegate.searchFieldStyle ?? theme.textTheme.headline6, + style: widget.delegate.searchFieldStyle ?? theme.textTheme.titleLarge, textInputAction: widget.delegate.textInputAction, keyboardType: widget.delegate.keyboardType, onSubmitted: (String _) { diff --git a/packages/flutter/lib/src/material/slider.dart b/packages/flutter/lib/src/material/slider.dart index 04c761b0b6..3301c8405b 100644 --- a/packages/flutter/lib/src/material/slider.dart +++ b/packages/flutter/lib/src/material/slider.dart @@ -324,7 +324,7 @@ class Slider extends StatefulWidget { /// It is used to display the value of a discrete slider, and it is displayed /// as part of the value indicator shape. /// - /// The label is rendered using the active [ThemeData]'s [TextTheme.bodyText1] + /// The label is rendered using the active [ThemeData]'s [TextTheme.bodyLarge] /// text style, with the theme data's [ColorScheme.onPrimary] color. The /// label's text style can be overridden with /// [SliderThemeData.valueIndicatorTextStyle]. @@ -724,7 +724,7 @@ class _SliderState extends State with TickerProviderStateMixin { overlayShape: sliderTheme.overlayShape ?? defaultOverlayShape, valueIndicatorShape: valueIndicatorShape, showValueIndicator: sliderTheme.showValueIndicator ?? defaultShowValueIndicator, - valueIndicatorTextStyle: sliderTheme.valueIndicatorTextStyle ?? theme.textTheme.bodyText1!.copyWith( + valueIndicatorTextStyle: sliderTheme.valueIndicatorTextStyle ?? theme.textTheme.bodyLarge!.copyWith( color: theme.colorScheme.onPrimary, ), ); diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart index 20fb61cee9..d4a23825c0 100644 --- a/packages/flutter/lib/src/material/snack_bar.dart +++ b/packages/flutter/lib/src/material/snack_bar.dart @@ -468,7 +468,7 @@ class _SnackBarState extends State { ), ); - final TextStyle? contentTextStyle = snackBarTheme.contentTextStyle ?? ThemeData(brightness: brightness).textTheme.subtitle1; + final TextStyle? contentTextStyle = snackBarTheme.contentTextStyle ?? ThemeData(brightness: brightness).textTheme.titleMedium; final SnackBarBehavior snackBarBehavior = widget.behavior ?? snackBarTheme.behavior ?? SnackBarBehavior.fixed; assert((){ // Whether the behavior is set through the constructor or the theme, diff --git a/packages/flutter/lib/src/material/stepper.dart b/packages/flutter/lib/src/material/stepper.dart index b8a61f6899..13d0b3fdd8 100644 --- a/packages/flutter/lib/src/material/stepper.dart +++ b/packages/flutter/lib/src/material/stepper.dart @@ -165,7 +165,7 @@ class Step { final bool isActive; /// Only [StepperType.horizontal], Optional widget that appears under the [title]. - /// By default, uses the `bodyText1` theme. + /// By default, uses the `bodyLarge` theme. final Widget? label; } @@ -554,13 +554,13 @@ class _StepperState extends State with TickerProviderStateMixin { case StepState.indexed: case StepState.editing: case StepState.complete: - return textTheme.bodyText1!; + return textTheme.bodyLarge!; case StepState.disabled: - return textTheme.bodyText1!.copyWith( + return textTheme.bodyLarge!.copyWith( color: _isDark() ? _kDisabledDark : _kDisabledLight, ); case StepState.error: - return textTheme.bodyText1!.copyWith( + return textTheme.bodyLarge!.copyWith( color: _isDark() ? _kErrorDark : _kErrorLight, ); } @@ -575,13 +575,13 @@ class _StepperState extends State with TickerProviderStateMixin { case StepState.indexed: case StepState.editing: case StepState.complete: - return textTheme.caption!; + return textTheme.bodySmall!; case StepState.disabled: - return textTheme.caption!.copyWith( + return textTheme.bodySmall!.copyWith( color: _isDark() ? _kDisabledDark : _kDisabledLight, ); case StepState.error: - return textTheme.caption!.copyWith( + return textTheme.bodySmall!.copyWith( color: _isDark() ? _kErrorDark : _kErrorLight, ); } @@ -596,13 +596,13 @@ class _StepperState extends State with TickerProviderStateMixin { case StepState.indexed: case StepState.editing: case StepState.complete: - return textTheme.bodyText1!; + return textTheme.bodyLarge!; case StepState.disabled: - return textTheme.bodyText1!.copyWith( + return textTheme.bodyLarge!.copyWith( color: _isDark() ? _kDisabledDark : _kDisabledLight, ); case StepState.error: - return textTheme.bodyText1!.copyWith( + return textTheme.bodyLarge!.copyWith( color: _isDark() ? _kErrorDark : _kErrorLight, ); } diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 39b1e8d7dc..fdfa842918 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -189,12 +189,12 @@ class _TabStyle extends AnimatedWidget { // the same value of inherit. Force that to be inherit=true here. final TextStyle defaultStyle = (labelStyle ?? tabBarTheme.labelStyle - ?? themeData.primaryTextTheme.bodyText1! + ?? themeData.primaryTextTheme.bodyLarge! ).copyWith(inherit: true); final TextStyle defaultUnselectedStyle = (unselectedLabelStyle ?? tabBarTheme.unselectedLabelStyle ?? labelStyle - ?? themeData.primaryTextTheme.bodyText1! + ?? themeData.primaryTextTheme.bodyLarge! ).copyWith(inherit: true); final TextStyle textStyle = selected ? TextStyle.lerp(defaultStyle, defaultUnselectedStyle, animation.value)! @@ -202,7 +202,7 @@ class _TabStyle extends AnimatedWidget { final Color selectedColor = labelColor ?? tabBarTheme.labelColor - ?? themeData.primaryTextTheme.bodyText1!.color!; + ?? themeData.primaryTextTheme.bodyLarge!.color!; final Color unselectedColor = unselectedLabelColor ?? tabBarTheme.unselectedLabelColor ?? selectedColor.withAlpha(0xB2); // 70% alpha @@ -741,7 +741,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget { /// opacity unless [unselectedLabelColor] is non-null. /// /// If this parameter is null, then the color of the [ThemeData.primaryTextTheme]'s - /// bodyText1 text color is used. + /// [TextTheme.bodyLarge] text color is used. final Color? labelColor; /// The color of unselected tab labels. @@ -756,7 +756,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget { /// both selected and unselected label styles. /// /// If this property is null, then the text style of the - /// [ThemeData.primaryTextTheme]'s bodyText1 definition is used. + /// [ThemeData.primaryTextTheme]'s [TextTheme.bodyLarge] definition is used. final TextStyle? labelStyle; /// The padding added to each of the tab labels. @@ -772,7 +772,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget { /// /// If this property is null, then the [labelStyle] value is used. If [labelStyle] /// is null, then the text style of the [ThemeData.primaryTextTheme]'s - /// bodyText1 definition is used. + /// [TextTheme.bodyLarge] definition is used. final TextStyle? unselectedLabelStyle; /// Defines the ink response focus, hover, and splash colors. diff --git a/packages/flutter/lib/src/material/text_button.dart b/packages/flutter/lib/src/material/text_button.dart index d2de36ac24..4035dbf2d7 100644 --- a/packages/flutter/lib/src/material/text_button.dart +++ b/packages/flutter/lib/src/material/text_button.dart @@ -338,7 +338,7 @@ class TextButton extends ButtonStyleButton { disabledBackgroundColor: Colors.transparent, shadowColor: theme.shadowColor, elevation: 0, - textStyle: theme.textTheme.button, + textStyle: theme.textTheme.labelLarge, padding: _scaledPadding(context), minimumSize: const Size(64, 36), maximumSize: Size.infinite, diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart index 4ded0a36e5..a65041c3e1 100644 --- a/packages/flutter/lib/src/material/text_field.dart +++ b/packages/flutter/lib/src/material/text_field.dart @@ -479,7 +479,7 @@ class TextField extends StatefulWidget { /// /// This text style is also used as the base style for the [decoration]. /// - /// If null, defaults to the `subtitle1` text style from the current [Theme]. + /// If null, defaults to the `titleMedium` text style from the current [Theme]. final TextStyle? style; /// {@macro flutter.widgets.editableText.strutStyle} @@ -1197,7 +1197,7 @@ class _TextFieldState extends State with RestorationMixin implements final ThemeData theme = Theme.of(context); final DefaultSelectionStyle selectionStyle = DefaultSelectionStyle.of(context); - final TextStyle style = (theme.useMaterial3 ? _m3InputStyle(context) : theme.textTheme.subtitle1!).merge(widget.style); + final TextStyle style = (theme.useMaterial3 ? _m3InputStyle(context) : theme.textTheme.titleMedium!).merge(widget.style); final Brightness keyboardAppearance = widget.keyboardAppearance ?? theme.brightness; final TextEditingController controller = _effectiveController; final FocusNode focusNode = _effectiveFocusNode; @@ -1440,7 +1440,7 @@ class _TextFieldState extends State with RestorationMixin implements } TextStyle _m2CounterErrorStyle(BuildContext context) => - Theme.of(context).textTheme.caption!.copyWith(color: Theme.of(context).errorColor); + Theme.of(context).textTheme.bodySmall!.copyWith(color: Theme.of(context).errorColor); // BEGIN GENERATED TOKEN PROPERTIES - TextField diff --git a/packages/flutter/lib/src/material/text_theme.dart b/packages/flutter/lib/src/material/text_theme.dart index b62c2f9d95..20a627853e 100644 --- a/packages/flutter/lib/src/material/text_theme.dart +++ b/packages/flutter/lib/src/material/text_theme.dart @@ -10,7 +10,7 @@ import 'typography.dart'; /// Material design text theme. /// /// Definitions for the various typographical styles found in Material Design -/// (e.g., button, caption). Rather than creating a [TextTheme] directly, +/// (e.g., labelLarge, bodySmall). Rather than creating a [TextTheme] directly, /// you can obtain an instance as [Typography.black] or [Typography.white]. /// /// To obtain the current text theme, call [Theme.of] with the current @@ -101,18 +101,70 @@ class TextTheme with Diagnosticable { TextStyle? labelLarge, this.labelMedium, TextStyle? labelSmall, + @Deprecated( + 'Use displayLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline1, + @Deprecated( + 'Use displayMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline2, + @Deprecated( + 'Use displaySmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline3, + @Deprecated( + 'Use headlineMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline4, + @Deprecated( + 'Use headlineSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline5, + @Deprecated( + 'Use titleLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline6, + @Deprecated( + 'Use titleMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? subtitle1, + @Deprecated( + 'Use titleSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? subtitle2, + @Deprecated( + 'Use bodyLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? bodyText1, + @Deprecated( + 'Use bodyMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? bodyText2, + @Deprecated( + 'Use bodySmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? caption, + @Deprecated( + 'Use labelLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? button, + @Deprecated( + 'Use labelSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? overline, }) : assert( (displayLarge == null && displayMedium == null && displaySmall == null && headlineMedium == null && @@ -232,48 +284,100 @@ class TextTheme with Diagnosticable { final TextStyle? labelSmall; /// Extremely large text. + @Deprecated( + 'Use displayLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get headline1 => displayLarge; /// Very, very large text. /// /// Used for the date in the dialog shown by [showDatePicker]. + @Deprecated( + 'Use displayMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get headline2 => displayMedium; /// Very large text. + @Deprecated( + 'Use displaySmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get headline3 => displaySmall; /// Large text. + @Deprecated( + 'Use headlineMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get headline4 => headlineMedium; /// Used for large text in dialogs (e.g., the month and year in the dialog /// shown by [showDatePicker]). + @Deprecated( + 'Use headlineSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get headline5 => headlineSmall; /// Used for the primary text in app bars and dialogs (e.g., [AppBar.title] /// and [AlertDialog.title]). + @Deprecated( + 'Use titleLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get headline6 => titleLarge; /// Used for the primary text in lists (e.g., [ListTile.title]). + @Deprecated( + 'Use titleMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get subtitle1 => titleMedium; - /// For medium emphasis text that's a little smaller than [subtitle1]. + /// For medium emphasis text that's a little smaller than [titleMedium]. + @Deprecated( + 'Use titleSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get subtitle2 => titleSmall; - /// Used for emphasizing text that would otherwise be [bodyText2]. + /// Used for emphasizing text that would otherwise be [bodyMedium]. + @Deprecated( + 'Use bodyLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get bodyText1 => bodyLarge; /// The default text style for [Material]. + @Deprecated( + 'Use bodyMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get bodyText2 => bodyMedium; /// Used for auxiliary text associated with images. + @Deprecated( + 'Use bodySmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get caption => bodySmall; /// Used for text on [ElevatedButton], [TextButton] and [OutlinedButton]. + @Deprecated( + 'Use labelLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get button => labelLarge; /// The smallest style. /// /// Typically used for captions or to introduce a (larger) headline. + @Deprecated( + 'Use labelSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? get overline => labelSmall; /// Creates a copy of this text theme but with the given fields replaced with @@ -332,18 +436,70 @@ class TextTheme with Diagnosticable { TextStyle? labelLarge, TextStyle? labelMedium, TextStyle? labelSmall, + @Deprecated( + 'Use displayLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline1, + @Deprecated( + 'Use displayMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline2, + @Deprecated( + 'Use displaySmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline3, + @Deprecated( + 'Use headlineMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline4, + @Deprecated( + 'Use headlineSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline5, + @Deprecated( + 'Use titleLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? headline6, + @Deprecated( + 'Use titleMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? subtitle1, + @Deprecated( + 'Use titleSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? subtitle2, + @Deprecated( + 'Use bodyLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? bodyText1, + @Deprecated( + 'Use bodyMedium instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? bodyText2, + @Deprecated( + 'Use bodySmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? caption, + @Deprecated( + 'Use labelLarge instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? button, + @Deprecated( + 'Use labelSmall instead. ' + 'This feature was deprecated after v3.1.0-0.0.pre.', + ) TextStyle? overline, }) { assert( diff --git a/packages/flutter/lib/src/material/theme.dart b/packages/flutter/lib/src/material/theme.dart index ee27565303..959941f75c 100644 --- a/packages/flutter/lib/src/material/theme.dart +++ b/packages/flutter/lib/src/material/theme.dart @@ -72,7 +72,7 @@ class Theme extends StatelessWidget { /// Widget build(BuildContext context) { /// return Text( /// 'Example', - /// style: Theme.of(context).textTheme.headline6, + /// style: Theme.of(context).textTheme.titleLarge, /// ); /// } /// ``` @@ -96,7 +96,7 @@ class Theme extends StatelessWidget { /// return Center( /// child: Text( /// 'Example', - /// style: Theme.of(context).textTheme.headline6, + /// style: Theme.of(context).textTheme.titleLarge, /// ), /// ); /// }, diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index b92f569029..56cff21d75 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -199,7 +199,7 @@ enum MaterialTapTargetSize { /// its default background color and the [FloatingActionButton] widget /// uses the color scheme's [ColorScheme.secondary] for its default /// background. By default, the [Text] widget uses -/// [TextTheme.bodyText2], and the color of that [TextStyle] has been +/// [TextTheme.bodyMedium], and the color of that [TextStyle] has been /// changed to purple. /// /// ![](https://flutter.github.io/assets-for-api-docs/assets/material/material_app_theme_data.png) @@ -210,7 +210,7 @@ enum MaterialTapTargetSize { /// colorScheme: ColorScheme.fromSwatch().copyWith( /// secondary: Colors.green, /// ), -/// textTheme: const TextTheme(bodyText2: TextStyle(color: Colors.purple)), +/// textTheme: const TextTheme(bodyMedium: TextStyle(color: Colors.purple)), /// ), /// home: Scaffold( /// appBar: AppBar( @@ -1584,7 +1584,7 @@ class ThemeData with Diagnosticable { /// /// ```dart /// final ThemeData theme = Theme.of(context); - /// final TextStyle style = theme.textTheme.headline1!.copyWith( + /// final TextStyle style = theme.textTheme.displayLarge!.copyWith( /// color: theme.colorScheme.onSecondary, /// ); /// // ...use style... diff --git a/packages/flutter/lib/src/material/time_picker.dart b/packages/flutter/lib/src/material/time_picker.dart index c8fc468944..c4197924ad 100644 --- a/packages/flutter/lib/src/material/time_picker.dart +++ b/packages/flutter/lib/src/material/time_picker.dart @@ -256,7 +256,7 @@ class _TimePickerHeader extends StatelessWidget { const SizedBox(height: 16.0), Text( helpText ?? MaterialLocalizations.of(context).timePickerDialHelpText, - style: TimePickerTheme.of(context).helpTextStyle ?? themeData.textTheme.overline, + style: TimePickerTheme.of(context).helpTextStyle ?? themeData.textTheme.labelSmall, ), controls, ], @@ -297,7 +297,7 @@ class _HourMinuteControl extends StatelessWidget { ? themeData.colorScheme.primary.withOpacity(isDark ? 0.24 : 0.12) : themeData.colorScheme.onSurface.withOpacity(0.12); }); - final TextStyle style = timePickerTheme.hourMinuteTextStyle ?? themeData.textTheme.headline2!; + final TextStyle style = timePickerTheme.hourMinuteTextStyle ?? themeData.textTheme.displayMedium!; final ShapeBorder shape = timePickerTheme.hourMinuteShape ?? _kDefaultShape; final Set states = isSelected ? {MaterialState.selected} : {}; @@ -416,7 +416,7 @@ class _StringFragment extends StatelessWidget { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); final TimePickerThemeData timePickerTheme = TimePickerTheme.of(context); - final TextStyle hourMinuteStyle = timePickerTheme.hourMinuteTextStyle ?? theme.textTheme.headline2!; + final TextStyle hourMinuteStyle = timePickerTheme.hourMinuteTextStyle ?? theme.textTheme.displayMedium!; final Color textColor = timePickerTheme.hourMinuteTextColor ?? theme.colorScheme.onSurface; return ExcludeSemantics( @@ -560,7 +560,7 @@ class _DayPeriodControl extends StatelessWidget { final Set amStates = amSelected ? {MaterialState.selected} : {}; final bool pmSelected = !amSelected; final Set pmStates = pmSelected ? {MaterialState.selected} : {}; - final TextStyle textStyle = timePickerTheme.dayPeriodTextStyle ?? Theme.of(context).textTheme.subtitle1!; + final TextStyle textStyle = timePickerTheme.dayPeriodTextStyle ?? Theme.of(context).textTheme.titleMedium!; final TextStyle amStyle = textStyle.copyWith( color: MaterialStateProperty.resolveAs(textColor, amStates), ); @@ -1181,7 +1181,7 @@ class _DialState extends State<_Dial> with SingleTickerProviderStateMixin { ]; _TappableLabel _buildTappableLabel(TextTheme textTheme, Color color, int value, String label, VoidCallback onTap) { - final TextStyle style = textTheme.bodyText1!.copyWith(color: color); + final TextStyle style = textTheme.bodyLarge!.copyWith(color: color); final double labelScaleFactor = math.min(MediaQuery.of(context).textScaleFactor, 2.0); return _TappableLabel( value: value, @@ -1466,7 +1466,7 @@ class _TimePickerInputState extends State<_TimePickerInput> with RestorationMixi final TimeOfDayFormat timeOfDayFormat = MaterialLocalizations.of(context).timeOfDayFormat(alwaysUse24HourFormat: media.alwaysUse24HourFormat); final bool use24HourDials = hourFormat(of: timeOfDayFormat) != HourFormat.h; final ThemeData theme = Theme.of(context); - final TextStyle hourMinuteStyle = TimePickerTheme.of(context).hourMinuteTextStyle ?? theme.textTheme.headline2!; + final TextStyle hourMinuteStyle = TimePickerTheme.of(context).hourMinuteTextStyle ?? theme.textTheme.displayMedium!; return Padding( padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0), @@ -1475,7 +1475,7 @@ class _TimePickerInputState extends State<_TimePickerInput> with RestorationMixi children: [ Text( widget.helpText ?? MaterialLocalizations.of(context).timePickerInputHelpText, - style: TimePickerTheme.of(context).helpTextStyle ?? theme.textTheme.overline, + style: TimePickerTheme.of(context).helpTextStyle ?? theme.textTheme.labelSmall, ), const SizedBox(height: 16.0), Row( @@ -1515,7 +1515,7 @@ class _TimePickerInputState extends State<_TimePickerInput> with RestorationMixi ExcludeSemantics( child: Text( widget.hourLabelText ?? MaterialLocalizations.of(context).timePickerHourLabel, - style: theme.textTheme.caption, + style: theme.textTheme.bodySmall, maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -1547,7 +1547,7 @@ class _TimePickerInputState extends State<_TimePickerInput> with RestorationMixi ExcludeSemantics( child: Text( widget.minuteLabelText ?? MaterialLocalizations.of(context).timePickerMinuteLabel, - style: theme.textTheme.caption, + style: theme.textTheme.bodySmall, maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -1571,7 +1571,7 @@ class _TimePickerInputState extends State<_TimePickerInput> with RestorationMixi if (hourHasError.value || minuteHasError.value) Text( widget.errorInvalidText ?? MaterialLocalizations.of(context).invalidTimeLabel, - style: theme.textTheme.bodyText2!.copyWith(color: theme.colorScheme.error), + style: theme.textTheme.bodyMedium!.copyWith(color: theme.colorScheme.error), ) else const SizedBox(height: 2.0), diff --git a/packages/flutter/lib/src/material/time_picker_theme.dart b/packages/flutter/lib/src/material/time_picker_theme.dart index b9ad528c10..ea6cc946d2 100644 --- a/packages/flutter/lib/src/material/time_picker_theme.dart +++ b/packages/flutter/lib/src/material/time_picker_theme.dart @@ -153,13 +153,13 @@ class TimePickerThemeData with Diagnosticable { /// Used to configure the [TextStyle]s for the day period control. /// /// If this is null, the time picker defaults to the overall theme's - /// [TextTheme.subtitle1]. + /// [TextTheme.titleMedium]. final TextStyle? dayPeriodTextStyle; /// Used to configure the [TextStyle]s for the helper text in the header. /// /// If this is null, the time picker defaults to the overall theme's - /// [TextTheme.overline]. + /// [TextTheme.labelSmall]. final TextStyle? helpTextStyle; /// The shape of the [Dialog] that the time picker is presented in. diff --git a/packages/flutter/lib/src/material/toggle_buttons.dart b/packages/flutter/lib/src/material/toggle_buttons.dart index 7fe10a3a61..6756fe5a86 100644 --- a/packages/flutter/lib/src/material/toggle_buttons.dart +++ b/packages/flutter/lib/src/material/toggle_buttons.dart @@ -710,7 +710,7 @@ class ToggleButtons extends StatelessWidget { } final TextStyle currentTextStyle = textStyle ?? toggleButtonsTheme.textStyle - ?? theme.textTheme.bodyText2!; + ?? theme.textTheme.bodyMedium!; final BoxConstraints? currentConstraints = constraints ?? toggleButtonsTheme.constraints; final Size minimumSize = currentConstraints == null diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart index 2cccb853bd..607b7cb7d9 100644 --- a/packages/flutter/lib/src/material/tooltip.dart +++ b/packages/flutter/lib/src/material/tooltip.dart @@ -197,9 +197,9 @@ class Tooltip extends StatefulWidget { /// /// If null, the message's [TextStyle] will be determined based on /// [ThemeData]. If [ThemeData.brightness] is set to [Brightness.dark], - /// [TextTheme.bodyText2] of [ThemeData.textTheme] will be used with + /// [TextTheme.bodyMedium] of [ThemeData.textTheme] will be used with /// [Colors.white]. Otherwise, if [ThemeData.brightness] is set to - /// [Brightness.light], [TextTheme.bodyText2] of [ThemeData.textTheme] will be + /// [Brightness.light], [TextTheme.bodyMedium] of [ThemeData.textTheme] will be /// used with [Colors.black]. final TextStyle? textStyle; @@ -704,7 +704,7 @@ class TooltipState extends State with SingleTickerProviderStateMixin { final TextStyle defaultTextStyle; final BoxDecoration defaultDecoration; if (theme.brightness == Brightness.dark) { - defaultTextStyle = theme.textTheme.bodyText2!.copyWith( + defaultTextStyle = theme.textTheme.bodyMedium!.copyWith( color: Colors.black, fontSize: _getDefaultFontSize(), ); @@ -713,7 +713,7 @@ class TooltipState extends State with SingleTickerProviderStateMixin { borderRadius: const BorderRadius.all(Radius.circular(4)), ); } else { - defaultTextStyle = theme.textTheme.bodyText2!.copyWith( + defaultTextStyle = theme.textTheme.bodyMedium!.copyWith( color: Colors.white, fontSize: _getDefaultFontSize(), ); @@ -857,7 +857,7 @@ class _TooltipOverlay extends StatelessWidget { child: ConstrainedBox( constraints: BoxConstraints(minHeight: height), child: DefaultTextStyle( - style: Theme.of(context).textTheme.bodyText2!, + style: Theme.of(context).textTheme.bodyMedium!, child: Container( decoration: decoration, padding: padding, diff --git a/packages/flutter/lib/src/material/user_accounts_drawer_header.dart b/packages/flutter/lib/src/material/user_accounts_drawer_header.dart index a49f8da2bf..97445ef405 100644 --- a/packages/flutter/lib/src/material/user_accounts_drawer_header.dart +++ b/packages/flutter/lib/src/material/user_accounts_drawer_header.dart @@ -148,7 +148,7 @@ class _AccountDetailsState extends State<_AccountDetails> with SingleTickerProvi child: Padding( padding: const EdgeInsets.symmetric(vertical: 2.0), child: DefaultTextStyle( - style: theme.primaryTextTheme.bodyText1!, + style: theme.primaryTextTheme.bodyLarge!, overflow: TextOverflow.ellipsis, child: widget.accountName!, ), @@ -160,7 +160,7 @@ class _AccountDetailsState extends State<_AccountDetails> with SingleTickerProvi child: Padding( padding: const EdgeInsets.symmetric(vertical: 2.0), child: DefaultTextStyle( - style: theme.primaryTextTheme.bodyText2!, + style: theme.primaryTextTheme.bodyMedium!, overflow: TextOverflow.ellipsis, child: widget.accountEmail!, ), diff --git a/packages/flutter/lib/src/widgets/container.dart b/packages/flutter/lib/src/widgets/container.dart index f157fa5ce9..c5e80a4ab6 100644 --- a/packages/flutter/lib/src/widgets/container.dart +++ b/packages/flutter/lib/src/widgets/container.dart @@ -216,7 +216,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget { /// ```dart /// Container( /// constraints: BoxConstraints.expand( -/// height: Theme.of(context).textTheme.headline4!.fontSize! * 1.1 + 200.0, +/// height: Theme.of(context).textTheme.headlineMedium!.fontSize! * 1.1 + 200.0, /// ), /// padding: const EdgeInsets.all(8.0), /// color: Colors.blue[600], @@ -225,7 +225,7 @@ class DecoratedBox extends SingleChildRenderObjectWidget { /// child: Text('Hello World', /// style: Theme.of(context) /// .textTheme -/// .headline4! +/// .headlineMedium! /// .copyWith(color: Colors.white)), /// ) /// ``` diff --git a/packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart b/packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart index 0ad4c04371..439153bfe1 100644 --- a/packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart +++ b/packages/flutter/lib/src/widgets/default_text_editing_shortcuts.dart @@ -94,7 +94,7 @@ import 'text_editing_intents.dart'; /// ), /// Text( /// '$_counter', -/// style: Theme.of(context).textTheme.headline4, +/// style: Theme.of(context).textTheme.headlineMedium, /// ), /// Shortcuts( /// shortcuts: { diff --git a/packages/flutter/test/material/about_test.dart b/packages/flutter/test/material/about_test.dart index 52472679dc..8c862ba97a 100644 --- a/packages/flutter/test/material/about_test.dart +++ b/packages/flutter/test/material/about_test.dart @@ -256,8 +256,8 @@ void main() { MaterialApp( theme: ThemeData( primaryTextTheme: const TextTheme( - headline6: titleTextStyle, - subtitle2: subtitleTextStyle, + titleLarge: titleTextStyle, + titleSmall: subtitleTextStyle, ), ), home: const Center( @@ -302,19 +302,19 @@ void main() { theme: ThemeData( // Not used because appBarTheme is prioritized. primaryTextTheme: const TextTheme( - headline6: TextStyle( + titleLarge: TextStyle( fontSize: 12, color: Colors.grey, ), - subtitle2: TextStyle( + titleSmall: TextStyle( fontSize: 10, color: Colors.grey, ), ), appBarTheme: const AppBarTheme( textTheme: TextTheme( - headline6: titleTextStyle, - subtitle2: subtitleTextStyle, + titleLarge: titleTextStyle, + titleSmall: subtitleTextStyle, ), foregroundColor: Colors.indigo, ), diff --git a/packages/flutter/test/material/app_bar_theme_test.dart b/packages/flutter/test/material/app_bar_theme_test.dart index 4892cd708d..6c4ba608f8 100644 --- a/packages/flutter/test/material/app_bar_theme_test.dart +++ b/packages/flutter/test/material/app_bar_theme_test.dart @@ -45,7 +45,7 @@ void main() { expect(iconTheme.data, IconThemeData(color: theme.colorScheme.onSurface, size: 24)); expect(actionsIconTheme.data, IconThemeData(color: theme.colorScheme.onSurfaceVariant, size: 24)); expect(actionIconText.text.style!.color, Colors.black); - expect(text.style, Typography.material2021().englishLike.bodyText2!.merge(Typography.material2021().black.bodyText2).copyWith(color: theme.colorScheme.onSurface)); + expect(text.style, Typography.material2021().englishLike.bodyMedium!.merge(Typography.material2021().black.bodyMedium).copyWith(color: theme.colorScheme.onSurface)); expect(tester.getSize(find.byType(AppBar)).height, kToolbarHeight); expect(tester.getSize(find.byType(AppBar)).width, 800); } else { @@ -58,7 +58,7 @@ void main() { expect(iconTheme.data, const IconThemeData(color: Colors.white)); expect(actionsIconTheme.data, const IconThemeData(color: Colors.white)); expect(actionIconText.text.style!.color, Colors.white); - expect(text.style, Typography.material2014().englishLike.bodyText2!.merge(Typography.material2014().white.bodyText2)); + expect(text.style, Typography.material2014().englishLike.bodyMedium!.merge(Typography.material2014().white.bodyMedium)); expect(tester.getSize(find.byType(AppBar)).height, kToolbarHeight); expect(tester.getSize(find.byType(AppBar)).width, 800); } @@ -284,7 +284,7 @@ void main() { // - surface tint color: ColorScheme.surfaceTint // - background color: ColorScheme.surface // - foreground color: ColorScheme.onSurface - // - actions text: style bodyText2, foreground color + // - actions text: style bodyMedium, foreground color // - status bar brightness: light (based on color scheme brightness) { await tester.pumpWidget(buildFrame(lightTheme)); @@ -303,7 +303,7 @@ void main() { expect(iconTheme.data.color, lightTheme.colorScheme.onSurface); expect(actionsIconTheme.data.color, lightTheme.colorScheme.onSurface); expect(actionIconText.text.style!.color, lightTheme.colorScheme.onSurface); - expect(text.style, Typography.material2021().englishLike.bodyText2!.merge(Typography.material2021().black.bodyText2).copyWith(color: lightTheme.colorScheme.onSurface)); + expect(text.style, Typography.material2021().englishLike.bodyMedium!.merge(Typography.material2021().black.bodyMedium).copyWith(color: lightTheme.colorScheme.onSurface)); } // M3 AppBar defaults for dark themes: @@ -312,7 +312,7 @@ void main() { // - surface tint color: ColorScheme.surfaceTint // - background color: ColorScheme.surface // - foreground color: ColorScheme.onSurface - // - actions text: style bodyText2, foreground color + // - actions text: style bodyMedium, foreground color // - status bar brightness: dark (based on background color) { await tester.pumpWidget(buildFrame(ThemeData.from(colorScheme: const ColorScheme.dark()))); @@ -332,7 +332,7 @@ void main() { expect(iconTheme.data.color, darkTheme.colorScheme.onSurface); expect(actionsIconTheme.data.color, darkTheme.colorScheme.onSurface); expect(actionIconText.text.style!.color, darkTheme.colorScheme.onSurface); - expect(text.style, Typography.material2021().englishLike.bodyText2!.merge(Typography.material2021().black.bodyText2).copyWith(color: darkTheme.colorScheme.onSurface)); + expect(text.style, Typography.material2021().englishLike.bodyMedium!.merge(Typography.material2021().black.bodyMedium).copyWith(color: darkTheme.colorScheme.onSurface)); } } else { // AppBar defaults for light themes: @@ -341,7 +341,7 @@ void main() { // - surface tint color: null // - background color: ColorScheme.primary // - foreground color: ColorScheme.onPrimary - // - actions text: style bodyText2, foreground color + // - actions text: style bodyMedium, foreground color // - status bar brightness: light (based on color scheme brightness) { await tester.pumpWidget(buildFrame(lightTheme)); @@ -360,7 +360,7 @@ void main() { expect(iconTheme.data.color, lightTheme.colorScheme.onPrimary); expect(actionsIconTheme.data.color, lightTheme.colorScheme.onPrimary); expect(actionIconText.text.style!.color, lightTheme.colorScheme.onPrimary); - expect(text.style, Typography.material2014().englishLike.bodyText2!.merge(Typography.material2014().black.bodyText2).copyWith(color: lightTheme.colorScheme.onPrimary)); + expect(text.style, Typography.material2014().englishLike.bodyMedium!.merge(Typography.material2014().black.bodyMedium).copyWith(color: lightTheme.colorScheme.onPrimary)); } // AppBar defaults for dark themes: @@ -369,7 +369,7 @@ void main() { // - surface tint color: null // - background color: ColorScheme.surface // - foreground color: ColorScheme.onSurface - // - actions text: style bodyText2, foreground color + // - actions text: style bodyMedium, foreground color // - status bar brightness: dark (based on background color) { await tester.pumpWidget(buildFrame(darkTheme)); @@ -389,7 +389,7 @@ void main() { expect(iconTheme.data.color, darkTheme.colorScheme.onSurface); expect(actionsIconTheme.data.color, darkTheme.colorScheme.onSurface); expect(actionIconText.text.style!.color, darkTheme.colorScheme.onSurface); - expect(text.style, Typography.material2014().englishLike.bodyText2!.merge(Typography.material2014().black.bodyText2).copyWith(color: darkTheme.colorScheme.onSurface)); + expect(text.style, Typography.material2014().englishLike.bodyMedium!.merge(Typography.material2014().black.bodyMedium).copyWith(color: darkTheme.colorScheme.onSurface)); } } }); diff --git a/packages/flutter/test/material/banner_theme_test.dart b/packages/flutter/test/material/banner_theme_test.dart index 7d4c73f97a..258966ad4f 100644 --- a/packages/flutter/test/material/banner_theme_test.dart +++ b/packages/flutter/test/material/banner_theme_test.dart @@ -68,7 +68,7 @@ void main() { final RenderParagraph content = _getTextRenderObjectFromDialog(tester, contentText); expect(material.color, const Color(0xffffffff)); // Default value for ThemeData.typography is Typography.material2014() - expect(content.text.style, Typography.material2014().englishLike.bodyText2!.merge(Typography.material2014().black.bodyText2)); + expect(content.text.style, Typography.material2014().englishLike.bodyMedium!.merge(Typography.material2014().black.bodyMedium)); }); testWidgets('Passing no MaterialBannerThemeData returns defaults when presented by ScaffoldMessenger', (WidgetTester tester) async { @@ -108,7 +108,7 @@ void main() { final RenderParagraph content = _getTextRenderObjectFromDialog(tester, contentText); expect(material.color, const Color(0xffffffff)); // Default value for ThemeData.typography is Typography.material2014() - expect(content.text.style, Typography.material2014().englishLike.bodyText2!.merge(Typography.material2014().black.bodyText2)); + expect(content.text.style, Typography.material2014().englishLike.bodyMedium!.merge(Typography.material2014().black.bodyMedium)); }); testWidgets('MaterialBanner uses values from MaterialBannerThemeData', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/chip_test.dart b/packages/flutter/test/material/chip_test.dart index 8ce03453c5..7202ce7423 100644 --- a/packages/flutter/test/material/chip_test.dart +++ b/packages/flutter/test/material/chip_test.dart @@ -250,19 +250,19 @@ void main() { TextStyle labelStyle = getLabelStyle(tester, 'Chip A').style; expect(labelStyle.color?.value, 0xde000000); - expect(labelStyle.fontFamily, textTheme.bodyText1?.fontFamily); - expect(labelStyle.fontFamilyFallback, textTheme.bodyText1?.fontFamilyFallback); - expect(labelStyle.fontFeatures, textTheme.bodyText1?.fontFeatures); - expect(labelStyle.fontSize, textTheme.bodyText1?.fontSize); - expect(labelStyle.fontStyle, textTheme.bodyText1?.fontStyle); - expect(labelStyle.fontWeight, textTheme.bodyText1?.fontWeight); - expect(labelStyle.height, textTheme.bodyText1?.height); - expect(labelStyle.inherit, textTheme.bodyText1?.inherit); - expect(labelStyle.leadingDistribution, textTheme.bodyText1?.leadingDistribution); - expect(labelStyle.letterSpacing, textTheme.bodyText1?.letterSpacing); - expect(labelStyle.overflow, textTheme.bodyText1?.overflow); - expect(labelStyle.textBaseline, textTheme.bodyText1?.textBaseline); - expect(labelStyle.wordSpacing, textTheme.bodyText1?.wordSpacing); + expect(labelStyle.fontFamily, textTheme.bodyLarge?.fontFamily); + expect(labelStyle.fontFamilyFallback, textTheme.bodyLarge?.fontFamilyFallback); + expect(labelStyle.fontFeatures, textTheme.bodyLarge?.fontFeatures); + expect(labelStyle.fontSize, textTheme.bodyLarge?.fontSize); + expect(labelStyle.fontStyle, textTheme.bodyLarge?.fontStyle); + expect(labelStyle.fontWeight, textTheme.bodyLarge?.fontWeight); + expect(labelStyle.height, textTheme.bodyLarge?.height); + expect(labelStyle.inherit, textTheme.bodyLarge?.inherit); + expect(labelStyle.leadingDistribution, textTheme.bodyLarge?.leadingDistribution); + expect(labelStyle.letterSpacing, textTheme.bodyLarge?.letterSpacing); + expect(labelStyle.overflow, textTheme.bodyLarge?.overflow); + expect(labelStyle.textBaseline, textTheme.bodyLarge?.textBaseline); + expect(labelStyle.wordSpacing, textTheme.bodyLarge?.wordSpacing); await tester.pumpWidget(buildFrame(Brightness.dark)); await tester.pumpAndSettle(); // Theme transition animation @@ -277,19 +277,19 @@ void main() { labelStyle = getLabelStyle(tester, 'Chip A').style; expect(labelStyle.color?.value, 0xdeffffff); - expect(labelStyle.fontFamily, textTheme.bodyText1?.fontFamily); - expect(labelStyle.fontFamilyFallback, textTheme.bodyText1?.fontFamilyFallback); - expect(labelStyle.fontFeatures, textTheme.bodyText1?.fontFeatures); - expect(labelStyle.fontSize, textTheme.bodyText1?.fontSize); - expect(labelStyle.fontStyle, textTheme.bodyText1?.fontStyle); - expect(labelStyle.fontWeight, textTheme.bodyText1?.fontWeight); - expect(labelStyle.height, textTheme.bodyText1?.height); - expect(labelStyle.inherit, textTheme.bodyText1?.inherit); - expect(labelStyle.leadingDistribution, textTheme.bodyText1?.leadingDistribution); - expect(labelStyle.letterSpacing, textTheme.bodyText1?.letterSpacing); - expect(labelStyle.overflow, textTheme.bodyText1?.overflow); - expect(labelStyle.textBaseline, textTheme.bodyText1?.textBaseline); - expect(labelStyle.wordSpacing, textTheme.bodyText1?.wordSpacing); + expect(labelStyle.fontFamily, textTheme.bodyLarge?.fontFamily); + expect(labelStyle.fontFamilyFallback, textTheme.bodyLarge?.fontFamilyFallback); + expect(labelStyle.fontFeatures, textTheme.bodyLarge?.fontFeatures); + expect(labelStyle.fontSize, textTheme.bodyLarge?.fontSize); + expect(labelStyle.fontStyle, textTheme.bodyLarge?.fontStyle); + expect(labelStyle.fontWeight, textTheme.bodyLarge?.fontWeight); + expect(labelStyle.height, textTheme.bodyLarge?.height); + expect(labelStyle.inherit, textTheme.bodyLarge?.inherit); + expect(labelStyle.leadingDistribution, textTheme.bodyLarge?.leadingDistribution); + expect(labelStyle.letterSpacing, textTheme.bodyLarge?.letterSpacing); + expect(labelStyle.overflow, textTheme.bodyLarge?.overflow); + expect(labelStyle.textBaseline, textTheme.bodyLarge?.textBaseline); + expect(labelStyle.wordSpacing, textTheme.bodyLarge?.wordSpacing); }); testWidgets('Chip control test', (WidgetTester tester) async { @@ -1767,7 +1767,7 @@ void main() { final ChipThemeData defaultChipTheme = ChipThemeData.fromDefaults( brightness: themeData.brightness, secondaryColor: Colors.blue, - labelStyle: themeData.textTheme.bodyText1!, + labelStyle: themeData.textTheme.bodyLarge!, ); bool value = false; Widget buildApp({ diff --git a/packages/flutter/test/material/chip_theme_test.dart b/packages/flutter/test/material/chip_theme_test.dart index ec0a8f2232..ac8e53e4d6 100644 --- a/packages/flutter/test/material/chip_theme_test.dart +++ b/packages/flutter/test/material/chip_theme_test.dart @@ -327,7 +327,7 @@ void main() { testWidgets('ChipThemeData generates correct opacities for defaults', (WidgetTester tester) async { const Color customColor1 = Color(0xcafefeed); const Color customColor2 = Color(0xdeadbeef); - final TextStyle customStyle = ThemeData.fallback().textTheme.bodyText1!.copyWith(color: customColor2); + final TextStyle customStyle = ThemeData.fallback().textTheme.bodyLarge!.copyWith(color: customColor2); final ChipThemeData lightTheme = ChipThemeData.fromDefaults( secondaryColor: customColor1, @@ -391,7 +391,7 @@ void main() { final ChipThemeData chipThemeBlack = ChipThemeData.fromDefaults( secondaryColor: Colors.black, brightness: Brightness.dark, - labelStyle: ThemeData.fallback().textTheme.bodyText1!.copyWith(color: Colors.black), + labelStyle: ThemeData.fallback().textTheme.bodyLarge!.copyWith(color: Colors.black), ).copyWith( elevation: 1.0, labelPadding: const EdgeInsets.symmetric(horizontal: 8.0), @@ -407,7 +407,7 @@ void main() { final ChipThemeData chipThemeWhite = ChipThemeData.fromDefaults( secondaryColor: Colors.white, brightness: Brightness.light, - labelStyle: ThemeData.fallback().textTheme.bodyText1!.copyWith(color: Colors.white), + labelStyle: ThemeData.fallback().textTheme.bodyLarge!.copyWith(color: Colors.white), ).copyWith( padding: const EdgeInsets.all(2.0), labelPadding: const EdgeInsets.only(top: 8.0, bottom: 8.0), diff --git a/packages/flutter/test/material/circle_avatar_test.dart b/packages/flutter/test/material/circle_avatar_test.dart index cfeb97742a..4a7f534807 100644 --- a/packages/flutter/test/material/circle_avatar_test.dart +++ b/packages/flutter/test/material/circle_avatar_test.dart @@ -166,7 +166,7 @@ void main() { expect(decoration.color, equals(theme.primaryColorLight)); final RenderParagraph paragraph = tester.renderObject(find.text('Z')); - expect(paragraph.text.style!.color, equals(theme.primaryTextTheme.headline6!.color)); + expect(paragraph.text.style!.color, equals(theme.primaryTextTheme.titleLarge!.color)); }); testWidgets('CircleAvatar with dark theme', (WidgetTester tester) async { @@ -191,7 +191,7 @@ void main() { expect(decoration.color, equals(theme.primaryColorDark)); final RenderParagraph paragraph = tester.renderObject(find.text('Z')); - expect(paragraph.text.style!.color, equals(theme.primaryTextTheme.headline6!.color)); + expect(paragraph.text.style!.color, equals(theme.primaryTextTheme.titleLarge!.color)); }); testWidgets('CircleAvatar text does not expand with textScaleFactor', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/dialog_theme_test.dart b/packages/flutter/test/material/dialog_theme_test.dart index 5666af42da..b3018cd0fd 100644 --- a/packages/flutter/test/material/dialog_theme_test.dart +++ b/packages/flutter/test/material/dialog_theme_test.dart @@ -299,7 +299,7 @@ void main() { title: Text(titleText), actions: [ ], ); - final ThemeData theme = ThemeData(textTheme: const TextTheme(headline6: titleTextStyle)); + final ThemeData theme = ThemeData(textTheme: const TextTheme(titleLarge: titleTextStyle)); await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme)); await tester.tap(find.text('X')); @@ -347,7 +347,7 @@ void main() { const SimpleDialog dialog = SimpleDialog( title: Text(titleText), ); - final ThemeData theme = ThemeData(textTheme: const TextTheme(headline6: titleTextStyle)); + final ThemeData theme = ThemeData(textTheme: const TextTheme(titleLarge: titleTextStyle)); await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme)); await tester.tap(find.text('X')); @@ -398,7 +398,7 @@ void main() { content: Text(contentText), actions: [ ], ); - final ThemeData theme = ThemeData(textTheme: const TextTheme(subtitle1: contentTextStyle)); + final ThemeData theme = ThemeData(textTheme: const TextTheme(titleMedium: contentTextStyle)); await tester.pumpWidget(_appWithDialog(tester, dialog, theme: theme)); await tester.tap(find.text('X')); diff --git a/packages/flutter/test/material/expansion_tile_test.dart b/packages/flutter/test/material/expansion_tile_test.dart index 8c4cd5a277..36bdf9e55d 100644 --- a/packages/flutter/test/material/expansion_tile_test.dart +++ b/packages/flutter/test/material/expansion_tile_test.dart @@ -164,7 +164,7 @@ void main() { theme: ThemeData( colorScheme: ColorScheme.fromSwatch().copyWith(primary: foregroundColor), unselectedWidgetColor: unselectedWidgetColor, - textTheme: const TextTheme(subtitle1: TextStyle(color: headerColor)), + textTheme: const TextTheme(titleMedium: TextStyle(color: headerColor)), ), home: Material( child: SingleChildScrollView( diff --git a/packages/flutter/test/material/list_tile_test.dart b/packages/flutter/test/material/list_tile_test.dart index 5edd20c4b0..4f7a655997 100644 --- a/packages/flutter/test/material/list_tile_test.dart +++ b/packages/flutter/test/material/list_tile_test.dart @@ -1993,9 +1993,9 @@ void main() { Color textColor(Key key) => tester.state(find.byKey(key)).textStyle.color!; await tester.pumpWidget(buildFrame()); - // Enabled color should be default bodyText2 color. - expect(textColor(leadingKey), theme.textTheme.bodyText2!.color); - expect(textColor(trailingKey), theme.textTheme.bodyText2!.color); + // Enabled color should be default bodyMedium color. + expect(textColor(leadingKey), theme.textTheme.bodyMedium!.color); + expect(textColor(trailingKey), theme.textTheme.bodyMedium!.color); await tester.pumpWidget(buildFrame(selected: true)); // Wait for text color to animate. @@ -2398,25 +2398,25 @@ void main() { // ListTile - ListTileStyle.list (default). await tester.pumpWidget(buildFrame()); 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'); - expect(title.text.style!.color, theme.textTheme.subtitle1!.color); + expect(title.text.style!.color, theme.textTheme.titleMedium!.color); 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'); - expect(trailing.text.style!.color, theme.textTheme.bodyText2!.color); + expect(trailing.text.style!.color, theme.textTheme.bodyMedium!.color); // ListTile - ListTileStyle.drawer. await tester.pumpWidget(buildFrame(style: ListTileStyle.drawer)); await tester.pumpAndSettle(); 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'); - expect(title.text.style!.color, theme.textTheme.subtitle1!.color); + expect(title.text.style!.color, theme.textTheme.titleMedium!.color); 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'); - expect(trailing.text.style!.color, theme.textTheme.bodyText2!.color); + expect(trailing.text.style!.color, theme.textTheme.bodyMedium!.color); }); }); } diff --git a/packages/flutter/test/material/popup_menu_test.dart b/packages/flutter/test/material/popup_menu_test.dart index 61dd0b8ad7..9cc07b955e 100644 --- a/packages/flutter/test/material/popup_menu_test.dart +++ b/packages/flutter/test/material/popup_menu_test.dart @@ -1773,7 +1773,7 @@ void main() { textDirection: textDirection, child: PopupMenuTheme( data: PopupMenuTheme.of(context).copyWith( - textStyle: Theme.of(context).textTheme.subtitle1!.copyWith(fontSize: fontSize), + textStyle: Theme.of(context).textTheme.titleMedium!.copyWith(fontSize: fontSize), ), child: child!, ), diff --git a/packages/flutter/test/material/search_test.dart b/packages/flutter/test/material/search_test.dart index 629e3e6603..19f03af5d5 100644 --- a/packages/flutter/test/material/search_test.dart +++ b/packages/flutter/test/material/search_test.dart @@ -756,7 +756,7 @@ void main() { expect(appBarBackground.color, Colors.white); final TextField textField = tester.widget(find.byType(TextField)); - expect(textField.style!.color, themeData.textTheme.bodyText1!.color); + expect(textField.style!.color, themeData.textTheme.bodyLarge!.color); expect(textField.style!.color, isNot(equals(Colors.white))); }); @@ -784,7 +784,7 @@ void main() { expect(appBarBackground.color, themeData.primaryColor); final TextField textField = tester.widget(find.byType(TextField)); - expect(textField.style!.color, themeData.textTheme.bodyText1!.color); + expect(textField.style!.color, themeData.textTheme.bodyLarge!.color); expect(textField.style!.color, isNot(equals(themeData.primaryColor))); }); diff --git a/packages/flutter/test/material/slider_theme_test.dart b/packages/flutter/test/material/slider_theme_test.dart index 111da30fef..92ee74da01 100644 --- a/packages/flutter/test/material/slider_theme_test.dart +++ b/packages/flutter/test/material/slider_theme_test.dart @@ -148,7 +148,7 @@ void main() { primaryColor: customColor1, primaryColorDark: customColor2, primaryColorLight: customColor3, - valueIndicatorTextStyle: ThemeData.fallback().textTheme.bodyText1!.copyWith(color: customColor4), + valueIndicatorTextStyle: ThemeData.fallback().textTheme.bodyLarge!.copyWith(color: customColor4), ); expect(sliderTheme.activeTrackColor, equals(customColor1.withAlpha(0xff))); @@ -176,7 +176,7 @@ void main() { primaryColor: customColor1, primaryColorDark: customColor2, primaryColorLight: customColor3, - valueIndicatorTextStyle: ThemeData.fallback().textTheme.bodyText1!.copyWith(color: customColor4), + valueIndicatorTextStyle: ThemeData.fallback().textTheme.bodyLarge!.copyWith(color: customColor4), ); expect(sliderTheme.overlayShape, const RoundSliderOverlayShape()); @@ -195,13 +195,13 @@ void main() { primaryColor: Colors.black, primaryColorDark: Colors.black, primaryColorLight: Colors.black, - valueIndicatorTextStyle: ThemeData.fallback().textTheme.bodyText1!.copyWith(color: Colors.black), + valueIndicatorTextStyle: ThemeData.fallback().textTheme.bodyLarge!.copyWith(color: Colors.black), ).copyWith(trackHeight: 2.0); final SliderThemeData sliderThemeWhite = SliderThemeData.fromPrimaryColors( primaryColor: Colors.white, primaryColorDark: Colors.white, primaryColorLight: Colors.white, - valueIndicatorTextStyle: ThemeData.fallback().textTheme.bodyText1!.copyWith(color: Colors.white), + valueIndicatorTextStyle: ThemeData.fallback().textTheme.bodyLarge!.copyWith(color: Colors.white), ).copyWith(trackHeight: 6.0); final SliderThemeData lerp = SliderThemeData.lerp(sliderThemeBlack, sliderThemeWhite, 0.5); const Color middleGrey = Color(0xff7f7f7f); diff --git a/packages/flutter/test/material/snack_bar_theme_test.dart b/packages/flutter/test/material/snack_bar_theme_test.dart index cd82a63d9d..7339d7d789 100644 --- a/packages/flutter/test/material/snack_bar_theme_test.dart +++ b/packages/flutter/test/material/snack_bar_theme_test.dart @@ -91,7 +91,7 @@ void main() { final Material material = _getSnackBarMaterial(tester); final RenderParagraph content = _getSnackBarTextRenderObject(tester, text); - expect(content.text.style, Typography.material2018().white.subtitle1); + expect(content.text.style, Typography.material2018().white.titleMedium); expect(material.color, const Color(0xFF333333)); expect(material.elevation, 6.0); expect(material.shape, null); diff --git a/packages/flutter/test/material/stepper_test.dart b/packages/flutter/test/material/stepper_test.dart index 41a42e9a11..e78b8df28b 100644 --- a/packages/flutter/test/material/stepper_test.dart +++ b/packages/flutter/test/material/stepper_test.dart @@ -1147,18 +1147,18 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async testWidgets('Stepper with Alternative Label', (WidgetTester tester) async { int index = 0; - late TextStyle bodyText1Style; - late TextStyle bodyText2Style; - late TextStyle captionStyle; + late TextStyle bodyLargeStyle; + late TextStyle bodyMediumStyle; + late TextStyle bodySmallStyle; await tester.pumpWidget( MaterialApp( home: Material( child: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - bodyText1Style = Theme.of(context).textTheme.bodyText1!; - bodyText2Style = Theme.of(context).textTheme.bodyText2!; - captionStyle = Theme.of(context).textTheme.caption!; + bodyLargeStyle = Theme.of(context).textTheme.bodyText1!; + bodyMediumStyle = Theme.of(context).textTheme.bodyText2!; + bodySmallStyle = Theme.of(context).textTheme.caption!; return Stepper( type: StepperType.horizontal, currentStep: index, @@ -1171,17 +1171,17 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async Step( title: const Text('Title 1'), content: const Text('Content 1'), - label: Text('Label 1', style: Theme.of(context).textTheme.caption), + label: Text('Label 1', style: Theme.of(context).textTheme.bodySmall), ), Step( title: const Text('Title 2'), content: const Text('Content 2'), - label: Text('Label 2', style: Theme.of(context).textTheme.bodyText1), + label: Text('Label 2', style: Theme.of(context).textTheme.bodyLarge), ), Step( title: const Text('Title 3'), content: const Text('Content 3'), - label: Text('Label 3', style: Theme.of(context).textTheme.bodyText2), + label: Text('Label 3', style: Theme.of(context).textTheme.bodyMedium), ), ], ); @@ -1196,8 +1196,8 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async final Text label3TextWidget = tester.widget(find.text('Label 3')); - expect(captionStyle, label1TextWidget.style); - expect(bodyText2Style, label3TextWidget.style); + expect(bodySmallStyle, label1TextWidget.style); + expect(bodyMediumStyle, label3TextWidget.style); late Text selectedLabelTextWidget; late Text nextLabelTextWidget; @@ -1209,10 +1209,10 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async // Check Styles of Selected Label Text Widgets and Another Label Text Widget selectedLabelTextWidget = tester.widget(find.text('Label ${index + 1}')); - expect(captionStyle, selectedLabelTextWidget.style); + expect(bodySmallStyle, selectedLabelTextWidget.style); nextLabelTextWidget = tester.widget(find.text('Label ${index + 2}')); - expect(bodyText1Style, nextLabelTextWidget.style); + expect(bodyLargeStyle, nextLabelTextWidget.style); // Tap to Step2 Label then, `index` become 1 @@ -1222,11 +1222,11 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async // Check Styles of Selected Label Text Widgets and Another Label Text Widget selectedLabelTextWidget = tester.widget(find.text('Label ${index + 1}')); - expect(bodyText1Style, selectedLabelTextWidget.style); + expect(bodyLargeStyle, selectedLabelTextWidget.style); nextLabelTextWidget = tester.widget(find.text('Label ${index + 2}')); - expect(bodyText2Style, nextLabelTextWidget.style); + expect(bodyMediumStyle, nextLabelTextWidget.style); }); } diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart index 90d7cd4c4b..1619eb4b3c 100644 --- a/packages/flutter/test/material/text_field_test.dart +++ b/packages/flutter/test/material/text_field_test.dart @@ -3620,7 +3620,7 @@ void main() { ); final Text helperText = tester.widget(find.text('helper text')); expect(helperText.style!.color, themeData.hintColor); - expect(helperText.style!.fontSize, Typography.englishLike2014.caption!.fontSize); + expect(helperText.style!.fontSize, Typography.englishLike2014.bodySmall!.fontSize); }); testWidgets('TextField with specified helperStyle', (WidgetTester tester) async { @@ -7290,7 +7290,7 @@ void main() { final ThemeData themeData = ThemeData( textTheme: TextTheme( - subtitle1: TextStyle( + titleMedium: TextStyle( color: Colors.blue[500], ), ), @@ -7312,12 +7312,12 @@ void main() { // Empty TextStyle is overridden by theme await tester.pumpWidget(buildFrame(const TextStyle())); EditableText editableText = tester.widget(find.byType(EditableText)); - expect(editableText.style.color, themeData.textTheme.subtitle1!.color); - expect(editableText.style.background, themeData.textTheme.subtitle1!.background); - expect(editableText.style.shadows, themeData.textTheme.subtitle1!.shadows); - expect(editableText.style.decoration, themeData.textTheme.subtitle1!.decoration); - expect(editableText.style.locale, themeData.textTheme.subtitle1!.locale); - expect(editableText.style.wordSpacing, themeData.textTheme.subtitle1!.wordSpacing); + expect(editableText.style.color, themeData.textTheme.titleMedium!.color); + expect(editableText.style.background, themeData.textTheme.titleMedium!.background); + expect(editableText.style.shadows, themeData.textTheme.titleMedium!.shadows); + expect(editableText.style.decoration, themeData.textTheme.titleMedium!.decoration); + expect(editableText.style.locale, themeData.textTheme.titleMedium!.locale); + expect(editableText.style.wordSpacing, themeData.textTheme.titleMedium!.wordSpacing); // Properties set on TextStyle override theme const Color setColor = Colors.red; diff --git a/packages/flutter/test/material/text_theme_test.dart b/packages/flutter/test/material/text_theme_test.dart index 6e0dbaee00..9338686b4c 100644 --- a/packages/flutter/test/material/text_theme_test.dart +++ b/packages/flutter/test/material/text_theme_test.dart @@ -50,9 +50,9 @@ void main() { test('TextTheme merges properly in the presence of null fields.', () { - const TextTheme partialTheme = TextTheme(headline6: TextStyle(color: Color(0xcafefeed))); + const TextTheme partialTheme = TextTheme(titleLarge: TextStyle(color: Color(0xcafefeed))); final TextTheme fullTheme = ThemeData.fallback().textTheme.merge(partialTheme); - expect(fullTheme.headline6!.color, equals(partialTheme.headline6!.color)); + expect(fullTheme.titleLarge!.color, equals(partialTheme.titleLarge!.color)); const TextTheme onlyHeadlineSmallAndTitleLarge = TextTheme( headlineSmall: TextStyle(color: Color(0xcafefeed)), diff --git a/packages/flutter/test/material/theme_data_test.dart b/packages/flutter/test/material/theme_data_test.dart index 1abe3cbaa9..19c970d358 100644 --- a/packages/flutter/test/material/theme_data_test.dart +++ b/packages/flutter/test/material/theme_data_test.dart @@ -94,8 +94,8 @@ void main() { final ThemeData darkTheme = ThemeData(brightness: Brightness.dark); final Typography typography = Typography.material2018(platform: lightTheme.platform); - expect(lightTheme.textTheme.headline6!.color, typography.black.headline6!.color); - expect(darkTheme.textTheme.headline6!.color, typography.white.headline6!.color); + expect(lightTheme.textTheme.titleLarge!.color, typography.black.titleLarge!.color); + expect(darkTheme.textTheme.titleLarge!.color, typography.white.titleLarge!.color); }); test('Default primary text theme contrasts with primary brightness', () { @@ -103,8 +103,8 @@ void main() { final ThemeData darkTheme = ThemeData(primaryColor: Colors.black); final Typography typography = Typography.material2018(platform: lightTheme.platform); - expect(lightTheme.primaryTextTheme.headline6!.color, typography.black.headline6!.color); - expect(darkTheme.primaryTextTheme.headline6!.color, typography.white.headline6!.color); + expect(lightTheme.primaryTextTheme.titleLarge!.color, typography.black.titleLarge!.color); + expect(darkTheme.primaryTextTheme.titleLarge!.color, typography.white.titleLarge!.color); }); test('Default icon theme contrasts with brightness', () { @@ -112,8 +112,8 @@ void main() { final ThemeData darkTheme = ThemeData(brightness: Brightness.dark); final Typography typography = Typography.material2018(platform: lightTheme.platform); - expect(lightTheme.textTheme.headline6!.color, typography.black.headline6!.color); - expect(darkTheme.textTheme.headline6!.color, typography.white.headline6!.color); + expect(lightTheme.textTheme.titleLarge!.color, typography.black.titleLarge!.color); + expect(darkTheme.textTheme.titleLarge!.color, typography.white.titleLarge!.color); }); test('Default primary icon theme contrasts with primary brightness', () { @@ -121,8 +121,8 @@ void main() { final ThemeData darkTheme = ThemeData(primaryColor: Colors.black); final Typography typography = Typography.material2018(platform: lightTheme.platform); - expect(lightTheme.primaryTextTheme.headline6!.color, typography.black.headline6!.color); - expect(darkTheme.primaryTextTheme.headline6!.color, typography.white.headline6!.color); + expect(lightTheme.primaryTextTheme.titleLarge!.color, typography.black.titleLarge!.color); + expect(darkTheme.primaryTextTheme.titleLarge!.color, typography.white.titleLarge!.color); }); test('light, dark and fallback constructors support useMaterial3', () { @@ -159,15 +159,15 @@ void main() { final ThemeData themeData = ThemeData( fontFamily: 'Ahem', textTheme: const TextTheme( - headline6: TextStyle(fontFamily: 'Roboto'), + titleLarge: TextStyle(fontFamily: 'Roboto'), ), ); - expect(themeData.textTheme.bodyText1!.fontFamily, equals('Ahem')); - expect(themeData.primaryTextTheme.headline3!.fontFamily, equals('Ahem')); + expect(themeData.textTheme.bodyLarge!.fontFamily, equals('Ahem')); + expect(themeData.primaryTextTheme.displaySmall!.fontFamily, equals('Ahem')); // Shouldn't override the specified style's family - expect(themeData.textTheme.headline6!.fontFamily, equals('Roboto')); + expect(themeData.textTheme.titleLarge!.fontFamily, equals('Roboto')); }); test('Can estimate brightness - directly', () { diff --git a/packages/flutter/test/material/theme_test.dart b/packages/flutter/test/material/theme_test.dart index d80746db75..ed129c83f2 100644 --- a/packages/flutter/test/material/theme_test.dart +++ b/packages/flutter/test/material/theme_test.dart @@ -387,12 +387,12 @@ void main() { final ThemeData fallback = ThemeData.fallback(); final ThemeData customTheme = fallback.copyWith( primaryTextTheme: fallback.primaryTextTheme.copyWith( - bodyText2: fallback.primaryTextTheme.bodyText2!.copyWith( + bodyMedium: fallback.primaryTextTheme.bodyMedium!.copyWith( fontSize: kMagicFontSize, ), ), ); - expect(customTheme.primaryTextTheme.bodyText2!.fontSize, kMagicFontSize); + expect(customTheme.primaryTextTheme.bodyMedium!.fontSize, kMagicFontSize); late double actualFontSize; await tester.pumpWidget(Directionality( @@ -401,10 +401,10 @@ void main() { data: customTheme, child: Builder(builder: (BuildContext context) { final ThemeData theme = Theme.of(context); - actualFontSize = theme.primaryTextTheme.bodyText2!.fontSize!; + actualFontSize = theme.primaryTextTheme.bodyMedium!.fontSize!; return Text( 'A', - style: theme.primaryTextTheme.bodyText2, + style: theme.primaryTextTheme.bodyMedium, ); }), ), diff --git a/packages/flutter/test/material/time_picker_theme_test.dart b/packages/flutter/test/material/time_picker_theme_test.dart index 021674b6ff..54a14e2c72 100644 --- a/packages/flutter/test/material/time_picker_theme_test.dart +++ b/packages/flutter/test/material/time_picker_theme_test.dart @@ -114,40 +114,40 @@ void main() { final RenderParagraph hourText = _textRenderParagraph(tester, '7'); expect( hourText.text.style, - Typography.material2014().englishLike.headline2! - .merge(Typography.material2014().black.headline2) + Typography.material2014().englishLike.displayMedium! + .merge(Typography.material2014().black.displayMedium) .copyWith(color: defaultTheme.colorScheme.primary), ); final RenderParagraph minuteText = _textRenderParagraph(tester, '15'); expect( minuteText.text.style, - Typography.material2014().englishLike.headline2! - .merge(Typography.material2014().black.headline2) + Typography.material2014().englishLike.displayMedium! + .merge(Typography.material2014().black.displayMedium) .copyWith(color: defaultTheme.colorScheme.onSurface), ); final RenderParagraph amText = _textRenderParagraph(tester, 'AM'); expect( amText.text.style, - Typography.material2014().englishLike.subtitle1! - .merge(Typography.material2014().black.subtitle1) + Typography.material2014().englishLike.titleMedium! + .merge(Typography.material2014().black.titleMedium) .copyWith(color: defaultTheme.colorScheme.primary), ); final RenderParagraph pmText = _textRenderParagraph(tester, 'PM'); expect( pmText.text.style, - Typography.material2014().englishLike.subtitle1! - .merge(Typography.material2014().black.subtitle1) + Typography.material2014().englishLike.titleMedium! + .merge(Typography.material2014().black.titleMedium) .copyWith(color: defaultTheme.colorScheme.onSurface.withOpacity(0.6)), ); final RenderParagraph helperText = _textRenderParagraph(tester, 'SELECT TIME'); expect( helperText.text.style, - Typography.material2014().englishLike.overline! - .merge(Typography.material2014().black.overline), + Typography.material2014().englishLike.labelSmall! + .merge(Typography.material2014().black.labelSmall), ); final CustomPaint dialPaint = tester.widget(findDialPaint); @@ -157,8 +157,8 @@ void main() { expect( // ignore: avoid_dynamic_calls primaryLabels.first.painter.text.style, - Typography.material2014().englishLike.bodyText1! - .merge(Typography.material2014().black.bodyText1) + Typography.material2014().englishLike.bodyLarge! + .merge(Typography.material2014().black.bodyLarge) .copyWith(color: defaultTheme.colorScheme.onSurface), ); // ignore: avoid_dynamic_calls @@ -166,8 +166,8 @@ void main() { expect( // ignore: avoid_dynamic_calls secondaryLabels.first.painter.text.style, - Typography.material2014().englishLike.bodyText1! - .merge(Typography.material2014().white.bodyText1) + Typography.material2014().englishLike.bodyLarge! + .merge(Typography.material2014().white.bodyLarge) .copyWith(color: defaultTheme.colorScheme.onPrimary), ); @@ -227,8 +227,8 @@ void main() { expect(hourDecoration.focusedErrorBorder, OutlineInputBorder(borderSide: BorderSide(color: defaultTheme.colorScheme.error, width: 2))); expect( hourDecoration.hintStyle, - Typography.material2014().englishLike.headline2! - .merge(defaultTheme.textTheme.headline2!.copyWith(color: defaultTheme.colorScheme.onSurface.withOpacity(0.36))), + Typography.material2014().englishLike.displayMedium! + .merge(defaultTheme.textTheme.displayMedium!.copyWith(color: defaultTheme.colorScheme.onSurface.withOpacity(0.36))), ); }); @@ -254,8 +254,8 @@ void main() { final RenderParagraph hourText = _textRenderParagraph(tester, '7'); expect( hourText.text.style, - Typography.material2014().englishLike.bodyText2! - .merge(Typography.material2014().black.bodyText2) + Typography.material2014().englishLike.bodyMedium! + .merge(Typography.material2014().black.bodyMedium) .merge(timePickerTheme.hourMinuteTextStyle) .copyWith(color: _selectedColor), ); @@ -263,8 +263,8 @@ void main() { final RenderParagraph minuteText = _textRenderParagraph(tester, '15'); expect( minuteText.text.style, - Typography.material2014().englishLike.bodyText2! - .merge(Typography.material2014().black.bodyText2) + Typography.material2014().englishLike.bodyMedium! + .merge(Typography.material2014().black.bodyMedium) .merge(timePickerTheme.hourMinuteTextStyle) .copyWith(color: _unselectedColor), ); @@ -272,8 +272,8 @@ void main() { final RenderParagraph amText = _textRenderParagraph(tester, 'AM'); expect( amText.text.style, - Typography.material2014().englishLike.subtitle1! - .merge(Typography.material2014().black.subtitle1) + Typography.material2014().englishLike.titleMedium! + .merge(Typography.material2014().black.titleMedium) .merge(timePickerTheme.dayPeriodTextStyle) .copyWith(color: _selectedColor), ); @@ -281,8 +281,8 @@ void main() { final RenderParagraph pmText = _textRenderParagraph(tester, 'PM'); expect( pmText.text.style, - Typography.material2014().englishLike.subtitle1! - .merge(Typography.material2014().black.subtitle1) + Typography.material2014().englishLike.titleMedium! + .merge(Typography.material2014().black.titleMedium) .merge(timePickerTheme.dayPeriodTextStyle) .copyWith(color: _unselectedColor), ); @@ -290,8 +290,8 @@ void main() { final RenderParagraph helperText = _textRenderParagraph(tester, 'SELECT TIME'); expect( helperText.text.style, - Typography.material2014().englishLike.bodyText2! - .merge(Typography.material2014().black.bodyText2) + Typography.material2014().englishLike.bodyMedium! + .merge(Typography.material2014().black.bodyMedium) .merge(timePickerTheme.helpTextStyle), ); @@ -302,8 +302,8 @@ void main() { expect( // ignore: avoid_dynamic_calls primaryLabels.first.painter.text.style, - Typography.material2014().englishLike.bodyText1! - .merge(Typography.material2014().black.bodyText1) + Typography.material2014().englishLike.bodyLarge! + .merge(Typography.material2014().black.bodyLarge) .copyWith(color: _unselectedColor), ); // ignore: avoid_dynamic_calls @@ -311,8 +311,8 @@ void main() { expect( // ignore: avoid_dynamic_calls secondaryLabels.first.painter.text.style, - Typography.material2014().englishLike.bodyText1! - .merge(Typography.material2014().white.bodyText1) + Typography.material2014().englishLike.bodyLarge! + .merge(Typography.material2014().white.bodyLarge) .copyWith(color: _selectedColor), ); diff --git a/packages/flutter/test/material/toggle_buttons_test.dart b/packages/flutter/test/material/toggle_buttons_test.dart index 8607da96ec..57efacc76f 100644 --- a/packages/flutter/test/material/toggle_buttons_test.dart +++ b/packages/flutter/test/material/toggle_buttons_test.dart @@ -223,15 +223,15 @@ void main() { of: find.widgetWithText(TextButton, 'First child'), matching: find.byType(DefaultTextStyle), )).style; - expect(textStyle.fontFamily, theme.textTheme.bodyText2!.fontFamily); - expect(textStyle.decoration, theme.textTheme.bodyText2!.decoration); + expect(textStyle.fontFamily, theme.textTheme.bodyMedium!.fontFamily); + expect(textStyle.decoration, theme.textTheme.bodyMedium!.decoration); textStyle = tester.widget(find.descendant( of: find.widgetWithText(TextButton, 'Second child'), matching: find.byType(DefaultTextStyle), )).style; - expect(textStyle.fontFamily, theme.textTheme.bodyText2!.fontFamily); - expect(textStyle.decoration, theme.textTheme.bodyText2!.decoration); + expect(textStyle.fontFamily, theme.textTheme.bodyMedium!.fontFamily); + expect(textStyle.decoration, theme.textTheme.bodyMedium!.decoration); }); testWidgets('Custom text style except color is applied', (WidgetTester tester) async { diff --git a/packages/flutter/test/rendering/localized_fonts_test.dart b/packages/flutter/test/rendering/localized_fonts_test.dart index bcb029d837..98497769fd 100644 --- a/packages/flutter/test/rendering/localized_fonts_test.dart +++ b/packages/flutter/test/rendering/localized_fonts_test.dart @@ -27,7 +27,7 @@ void main() { home: Builder( builder: (BuildContext context) { const String character = '骨'; - final TextStyle style = Theme.of(context).textTheme.headline2!; + final TextStyle style = Theme.of(context).textTheme.displayMedium!; return Scaffold( body: Container( padding: const EdgeInsets.all(48.0), @@ -71,7 +71,7 @@ void main() { home: Builder( builder: (BuildContext context) { const String character = '骨'; - final TextStyle style = Theme.of(context).textTheme.headline2!; + final TextStyle style = Theme.of(context).textTheme.displayMedium!; return Scaffold( body: Container( padding: const EdgeInsets.all(48.0), @@ -122,7 +122,7 @@ void main() { home: Builder( builder: (BuildContext context) { const String character = '骨'; - final TextStyle style = Theme.of(context).textTheme.headline2!; + final TextStyle style = Theme.of(context).textTheme.displayMedium!; return Scaffold( body: Container( padding: const EdgeInsets.all(48.0), diff --git a/packages/flutter/test/widgets/editable_text_cursor_test.dart b/packages/flutter/test/widgets/editable_text_cursor_test.dart index 1708f82a86..b0d374c4f0 100644 --- a/packages/flutter/test/widgets/editable_text_cursor_test.dart +++ b/packages/flutter/test/widgets/editable_text_cursor_test.dart @@ -68,7 +68,7 @@ void main() { key: editableTextKey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -123,7 +123,7 @@ void main() { key: editableTextKey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -962,7 +962,7 @@ void main() { key: editableTextKey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018(platform: TargetPlatform.iOS).black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.iOS).black.titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -1023,7 +1023,7 @@ void main() { key: editableTextKey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018(platform: TargetPlatform.iOS).black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.iOS).black.titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart index c7921fd0d7..98cbbf0653 100644 --- a/packages/flutter/test/widgets/editable_text_test.dart +++ b/packages/flutter/test/widgets/editable_text_test.dart @@ -2506,7 +2506,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -2584,7 +2584,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -2630,7 +2630,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -2667,7 +2667,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, onEditingComplete: () { onEditingCompleteCalled = true; @@ -2707,7 +2707,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, onEditingComplete: () { onEditingCompleteCalled = true; @@ -2747,7 +2747,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, onEditingComplete: () { onEditingCompleteCalled = true; @@ -2786,7 +2786,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, maxLines: 3, onEditingComplete: () { @@ -2822,7 +2822,7 @@ void main() { Widget widget = MaterialApp( home: EditableText( backgroundCursorColor: Colors.grey, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, focusNode: focusNode, controller: controller, @@ -2846,7 +2846,7 @@ void main() { widget = MaterialApp( home: EditableText( backgroundCursorColor: Colors.grey, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, focusNode: focusNode, controller: controller, @@ -2887,7 +2887,7 @@ void main() { final Widget widget = MaterialApp( home: EditableText( backgroundCursorColor: Colors.grey, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, focusNode: focusNode, controller: controller, @@ -2963,7 +2963,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: controller, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, autocorrectionTextRectColor: rectColor, showCursor: false, @@ -3031,7 +3031,7 @@ void main() { focusNode: focusNode, style: Typography.material2018() .black - .subtitle1!, + .titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -4374,7 +4374,7 @@ void main() { child: EditableText( controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -4404,7 +4404,7 @@ void main() { child: EditableText( controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -4448,7 +4448,7 @@ void main() { key: ValueKey(controller1.text), controller: controller1, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -4457,7 +4457,7 @@ void main() { key: ValueKey(controller2.text), controller: controller2, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, minLines: 10, @@ -4574,7 +4574,7 @@ void main() { key: ValueKey(controller.text), controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -4614,7 +4614,7 @@ void main() { key: ValueKey(controller.text), controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, scribbleEnabled: false, @@ -4964,7 +4964,7 @@ void main() { child: EditableText( controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardAppearance: Brightness.dark, @@ -5041,7 +5041,7 @@ void main() { showSelectionHandles: true, controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -5110,7 +5110,7 @@ void main() { showSelectionHandles: true, controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -5285,7 +5285,7 @@ void main() { controller: controller, showSelectionHandles: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -5422,7 +5422,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -6183,7 +6183,7 @@ void main() { controller: controller, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -6363,7 +6363,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -6514,7 +6514,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -6675,7 +6675,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -6837,7 +6837,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7031,7 +7031,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7143,7 +7143,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7208,7 +7208,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7400,7 +7400,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7591,7 +7591,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7693,7 +7693,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7759,7 +7759,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -7844,7 +7844,7 @@ void main() { showSelectionHandles: true, controller: controller, focusNode: FocusNode(), - style: Typography.material2018(platform: TargetPlatform.iOS).black.subtitle1!, + style: Typography.material2018(platform: TargetPlatform.iOS).black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: cupertinoTextSelectionControls, @@ -8020,7 +8020,7 @@ void main() { maxLines: 2, controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -8279,7 +8279,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -8377,7 +8377,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, inputFormatters: [LengthLimitingTextInputFormatter(6)], onChanged: (String s) => controller.text += ' onChanged', @@ -8477,7 +8477,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, inputFormatters: [LengthLimitingTextInputFormatter(6)], ), @@ -8521,7 +8521,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -8570,7 +8570,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -8581,7 +8581,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -8633,7 +8633,7 @@ void main() { focusNode: focusNode1, cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -8645,7 +8645,7 @@ void main() { focusNode: focusNode2, cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -8683,7 +8683,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -8732,7 +8732,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ); @@ -9188,7 +9188,7 @@ void main() { home: EditableText( controller: controller, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), @@ -9250,7 +9250,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -9524,7 +9524,7 @@ void main() { backgroundCursorColor: Colors.grey, controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, selectionControls: materialTextSelectionControls, keyboardType: TextInputType.text, @@ -10090,7 +10090,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, selectionControls: materialTextSelectionControls, onSelectionChanged: (TextSelection selection, SelectionChangedCause? cause) { @@ -10117,7 +10117,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, onChanged: (String text) { throw FlutterError(errorText); @@ -10143,7 +10143,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, onEditingComplete: () { throw FlutterError(errorText); @@ -10174,7 +10174,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, onSubmitted: (String text) { throw FlutterError(errorText); @@ -10210,7 +10210,7 @@ void main() { focusNode: FocusNode(), cursorColor: Colors.red, backgroundCursorColor: Colors.blue, - style: Typography.material2018().black.subtitle1!.copyWith(fontFamily: 'Roboto'), + style: Typography.material2018().black.titleMedium!.copyWith(fontFamily: 'Roboto'), keyboardType: TextInputType.text, ), )); @@ -10289,7 +10289,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -10345,7 +10345,7 @@ void main() { controller: controller, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardType: TextInputType.text, @@ -10484,7 +10484,7 @@ void main() { controller: controller, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardType: TextInputType.text, @@ -10648,7 +10648,7 @@ void main() { controller: controller, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardType: TextInputType.text, @@ -10744,7 +10744,7 @@ void main() { controller: controller, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardType: TextInputType.text, @@ -10982,7 +10982,7 @@ void main() { controller: controller, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, keyboardType: TextInputType.text, @@ -11075,7 +11075,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -11124,7 +11124,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -11165,7 +11165,7 @@ void main() { setState = setter; return EditableText( focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: enableInteractiveSelection ? materialTextSelectionControls : null, @@ -11287,7 +11287,7 @@ void main() { child: EditableText( key: key, focusNode: focusNode, - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, controller: controller, @@ -12200,7 +12200,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -12281,7 +12281,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -12347,7 +12347,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -12427,7 +12427,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -12526,7 +12526,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -12603,7 +12603,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -12808,7 +12808,7 @@ void main() { showSelectionHandles: true, autofocus: true, focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, selectionControls: materialTextSelectionControls, @@ -13141,7 +13141,7 @@ class _TransformedEditableTextState extends State { child: EditableText( controller: TextEditingController(), focusNode: FocusNode(), - style: Typography.material2018().black.subtitle1!, + style: Typography.material2018().black.titleMedium!, cursorColor: Colors.blue, backgroundCursorColor: Colors.grey, ), diff --git a/packages/flutter/test/widgets/inherited_model_test.dart b/packages/flutter/test/widgets/inherited_model_test.dart index ebc15a9241..f18deffcc8 100644 --- a/packages/flutter/test/widgets/inherited_model_test.dart +++ b/packages/flutter/test/widgets/inherited_model_test.dart @@ -226,7 +226,7 @@ void main() { final Widget showABC = Builder( builder: (BuildContext context) { final ABCModel abc = ABCModel.of(context)!; - return Text('a: ${abc.a} b: ${abc.b} c: ${abc.c}', style: Theme.of(context).textTheme.headline6); + return Text('a: ${abc.a} b: ${abc.b} c: ${abc.c}', style: Theme.of(context).textTheme.titleLarge); }, ); @@ -343,7 +343,7 @@ void main() { final Widget showABC = Builder( builder: (BuildContext context) { final ABCModel abc = ABCModel.of(context)!; - return Text('a: ${abc.a} b: ${abc.b} c: ${abc.c}', style: Theme.of(context).textTheme.headline6); + return Text('a: ${abc.a} b: ${abc.b} c: ${abc.c}', style: Theme.of(context).textTheme.titleLarge); }, ); diff --git a/packages/flutter/test/widgets/navigator_test.dart b/packages/flutter/test/widgets/navigator_test.dart index 1ea2748266..d2bec281d9 100644 --- a/packages/flutter/test/widgets/navigator_test.dart +++ b/packages/flutter/test/widgets/navigator_test.dart @@ -85,7 +85,7 @@ class OnTapPage extends StatelessWidget { onTap: onTap, behavior: HitTestBehavior.opaque, child: Center( - child: Text(id, style: Theme.of(context).textTheme.headline3), + child: Text(id, style: Theme.of(context).textTheme.displaySmall), ), ), ); diff --git a/packages/flutter/test/widgets/route_notification_messages_test.dart b/packages/flutter/test/widgets/route_notification_messages_test.dart index a1cb44bba1..4eb8545160 100644 --- a/packages/flutter/test/widgets/route_notification_messages_test.dart +++ b/packages/flutter/test/widgets/route_notification_messages_test.dart @@ -22,7 +22,7 @@ class OnTapPage extends StatelessWidget { onTap: onTap, behavior: HitTestBehavior.opaque, child: Center( - child: Text(id, style: Theme.of(context).textTheme.headline3), + child: Text(id, style: Theme.of(context).textTheme.displaySmall), ), ), ); diff --git a/packages/flutter/test_fixes/material.dart b/packages/flutter/test_fixes/material.dart index 312a7729ad..efee066696 100644 --- a/packages/flutter/test_fixes/material.dart +++ b/packages/flutter/test_fixes/material.dart @@ -592,4 +592,56 @@ void main() { themeData = ThemeData.raw(selectedRowColor: Brightness.dark); themeData = themeData.copyWith(selectedRowColor: Brightness.dark); themeData.selectedRowColor; // Removing field reference not supported. + + // Changes made in https://github.com/flutter/flutter/pull/109817 + var TextTheme textTheme = TextTheme( + headline1: headline1Style, + headline2: headline2Style, + headline3: headline3Style, + headline4: headline4Style, + headline5: headline5Style, + headline6: headline6Style, + subtitle1: subtitle1Style, + subtitle2: subtitle2Style, + bodyText1: bodyText1Style, + bodyText2: bodyText2Style, + caption: captionStyle, + button: buttonStyle, + overline: overlineStyle, + ); + var TextTheme textTheme = TextTheme(error: ''); + + // Changes made in https://github.com/flutter/flutter/pull/109817 + var TextTheme copiedTextTheme = TextTheme.copyWith( + headline1: headline1Style, + headline2: headline2Style, + headline3: headline3Style, + headline4: headline4Style, + headline5: headline5Style, + headline6: headline6Style, + subtitle1: subtitle1Style, + subtitle2: subtitle2Style, + bodyText1: bodyText1Style, + bodyText2: bodyText2Style, + caption: captionStyle, + button: buttonStyle, + overline: overlineStyle, + ); + var TextTheme copiedTextTheme = TextTheme.copyWith(error: ''); + + // Changes made in https://github.com/flutter/flutter/pull/109817 + var style; + style = textTheme.headline1; + style = textTheme.headline2; + style = textTheme.headline3; + style = textTheme.headline4; + style = textTheme.headline5; + style = textTheme.headline6; + style = textTheme.subtitle1; + style = textTheme.subtitle2; + style = textTheme.bodyText1; + style = textTheme.bodyText2; + style = textTheme.caption; + style = textTheme.button; + style = textTheme.overline; } diff --git a/packages/flutter/test_fixes/material.dart.expect b/packages/flutter/test_fixes/material.dart.expect index 4f2f9ba7d4..a1e957a6e7 100644 --- a/packages/flutter/test_fixes/material.dart.expect +++ b/packages/flutter/test_fixes/material.dart.expect @@ -80,55 +80,56 @@ void main() { // Changes made in https://github.com/flutter/flutter/pull/48547 var TextTheme textTheme = TextTheme( - headline1: displayStyle4, - headline2: displayStyle3, - headline3: displayStyle2, - headline4: displayStyle1, - headline5: headlineStyle, - headline6: titleStyle, - subtitle1: subheadStyle, - bodyText1: body2Style, - bodyText2: body1Style, - caption: captionStyle, - button: buttonStyle, - subtitle2: subtitleStyle, - overline: overlineStyle, + displayLarge: displayStyle4, + displayMedium: displayStyle3, + displaySmall: displayStyle2, + headlineMedium: displayStyle1, + headlineSmall: headlineStyle, + titleLarge: titleStyle, + titleMedium: subheadStyle, + bodyLarge: body2Style, + bodyMedium: body1Style, + bodySmall: captionStyle, + labelLarge: buttonStyle, + titleSmall: subtitleStyle, + labelSmall: overlineStyle, ); var TextTheme textTheme = TextTheme(error: ''); // Changes made in https://github.com/flutter/flutter/pull/48547 var TextTheme copiedTextTheme = TextTheme.copyWith( - headline1: displayStyle4, - headline2: displayStyle3, - headline3: displayStyle2, - headline4: displayStyle1, - headline5: headlineStyle, - headline6: titleStyle, - subtitle1: subheadStyle, - bodyText1: body2Style, - bodyText2: body1Style, - caption: captionStyle, - button: buttonStyle, - subtitle2: subtitleStyle, - overline: overlineStyle, + displayLarge: displayStyle4, + displayMedium: displayStyle3, + displaySmall: displayStyle2, + headlineMedium: displayStyle1, + headlineSmall: headlineStyle, + titleLarge: titleStyle, + titleMedium: subheadStyle, + bodyLarge: body2Style, + bodyMedium: body1Style, + bodySmall: captionStyle, + labelLarge: buttonStyle, + titleSmall: subtitleStyle, + labelSmall: overlineStyle, ); var TextTheme copiedTextTheme = TextTheme.copyWith(error: ''); // Changes made in https://github.com/flutter/flutter/pull/48547 var style; - style = textTheme.headline1; - style = textTheme.headline2; - style = textTheme.headline3; - style = textTheme.headline4; - style = textTheme.headline5; - style = textTheme.headline6; - style = textTheme.subtitle1; - style = textTheme.bodyText1; - style = textTheme.bodyText2; - style = textTheme.caption; - style = textTheme.button; - style = textTheme.subtitle2; - style = textTheme.overline; + style = textTheme.displayLarge; + style = textTheme.displayMedium; + style = textTheme.displaySmall; + style = textTheme.headlineMedium; + style = textTheme.headlineSmall; + style = textTheme.titleLarge; + style = textTheme.titleMedium; + style = textTheme.bodyLarge; + style = textTheme.bodyMedium; + style = textTheme.bodySmall; + style = textTheme.labelLarge; + style = textTheme.titleSmall; + style = textTheme.labelSmall; + // Changes made in https://github.com/flutter/flutter/pull/68736 MediaQuery.maybeOf(context); @@ -441,18 +442,18 @@ void main() { TextTheme myTextTheme = TextTheme(); AppBar appBar = AppBar(); - appBar = AppBar(toolbarTextStyle: myTextTheme.bodyText2, titleTextStyle: myTextTheme.headline6); - appBar = AppBar(toolbarTextStyle: myTextTheme.bodyText2, titleTextStyle: myTextTheme.headline6); + appBar = AppBar(toolbarTextStyle: myTextTheme.bodyMedium, titleTextStyle: myTextTheme.titleLarge); + appBar = AppBar(toolbarTextStyle: myTextTheme.bodyMedium, titleTextStyle: myTextTheme.titleLarge); SliverAppBar sliverAppBar = SliverAppBar(); - sliverAppBar = SliverAppBar(toolbarTextStyle: myTextTheme.bodyText2, titleTextStyle: myTextTheme.headline6); - sliverAppBar = SliverAppBar(toolbarTextStyle: myTextTheme.bodyText2, titleTextStyle: myTextTheme.headline6); + sliverAppBar = SliverAppBar(toolbarTextStyle: myTextTheme.bodyMedium, titleTextStyle: myTextTheme.titleLarge); + sliverAppBar = SliverAppBar(toolbarTextStyle: myTextTheme.bodyMedium, titleTextStyle: myTextTheme.titleLarge); AppBarTheme appBarTheme = AppBarTheme(); - appBarTheme = AppBarTheme(toolbarTextStyle: myTextTheme.bodyText2, titleTextStyle: myTextTheme.headline6); - appBarTheme = AppBarTheme(toolbarTextStyle: myTextTheme.bodyText2, titleTextStyle: myTextTheme.headline6); - appBarTheme = appBarTheme.copyWith(toolbarTextStyle: myTextTheme.bodyText2, titleTextStyle: myTextTheme.headline6); - appBarTheme = appBarTheme.copyWith(toolbarTextStyle: myTextTheme.bodyText2, titleTextStyle: myTextTheme.headline6); + appBarTheme = AppBarTheme(toolbarTextStyle: myTextTheme.bodyMedium, titleTextStyle: myTextTheme.titleLarge); + appBarTheme = AppBarTheme(toolbarTextStyle: myTextTheme.bodyMedium, titleTextStyle: myTextTheme.titleLarge); + appBarTheme = appBarTheme.copyWith(toolbarTextStyle: myTextTheme.bodyMedium, titleTextStyle: myTextTheme.titleLarge); + appBarTheme = appBarTheme.copyWith(toolbarTextStyle: myTextTheme.bodyMedium, titleTextStyle: myTextTheme.titleLarge); AppBar appBar = AppBar(); appBar = AppBar(); @@ -795,4 +796,56 @@ void main() { themeData = ThemeData.raw(); themeData = themeData.copyWith(); themeData.selectedRowColor; // Removing field reference not supported. + + // Changes made in https://github.com/flutter/flutter/pull/109817 + var TextTheme textTheme = TextTheme( + displayLarge: headline1Style, + displayMedium: headline2Style, + displaySmall: headline3Style, + headlineMedium: headline4Style, + headlineSmall: headline5Style, + titleLarge: headline6Style, + titleMedium: subtitle1Style, + titleSmall: subtitle2Style, + bodyLarge: bodyText1Style, + bodyMedium: bodyText2Style, + bodySmall: captionStyle, + labelLarge: buttonStyle, + labelSmall: overlineStyle, + ); + var TextTheme textTheme = TextTheme(error: ''); + + // Changes made in https://github.com/flutter/flutter/pull/109817 + var TextTheme copiedTextTheme = TextTheme.copyWith( + displayLarge: headline1Style, + displayMedium: headline2Style, + displaySmall: headline3Style, + headlineMedium: headline4Style, + headlineSmall: headline5Style, + titleLarge: headline6Style, + titleMedium: subtitle1Style, + titleSmall: subtitle2Style, + bodyLarge: bodyText1Style, + bodyMedium: bodyText2Style, + bodySmall: captionStyle, + labelLarge: buttonStyle, + labelSmall: overlineStyle, + ); + var TextTheme copiedTextTheme = TextTheme.copyWith(error: ''); + + // Changes made in https://github.com/flutter/flutter/pull/109817 + var style; + style = textTheme.displayLarge; + style = textTheme.displayMedium; + style = textTheme.displaySmall; + style = textTheme.headlineMedium; + style = textTheme.headlineSmall; + style = textTheme.titleLarge; + style = textTheme.titleMedium; + style = textTheme.titleSmall; + style = textTheme.bodyLarge; + style = textTheme.bodyMedium; + style = textTheme.bodySmall; + style = textTheme.labelLarge; + style = textTheme.labelSmall; } diff --git a/packages/flutter_localizations/test/basics_test.dart b/packages/flutter_localizations/test/basics_test.dart index 961bceb5f8..4ac2375a7d 100644 --- a/packages/flutter_localizations/test/basics_test.dart +++ b/packages/flutter_localizations/test/basics_test.dart @@ -22,9 +22,9 @@ void main() { )); final LocalizationTrackerState outerTracker = tester.state(find.byKey(const ValueKey('outer'), skipOffstage: false)); - expect(outerTracker.captionFontSize, 12.0); + expect(outerTracker.bodySmallFontSize, 12.0); final LocalizationTrackerState innerTracker = tester.state(find.byKey(const ValueKey('inner'), skipOffstage: false)); - expect(innerTracker.captionFontSize, 13.0); + expect(innerTracker.bodySmallFontSize, 13.0); }); testWidgets('Localizations is compatible with ChangeNotifier.dispose() called during didChangeDependencies', (WidgetTester tester) async { @@ -92,11 +92,11 @@ class LocalizationTracker extends StatefulWidget { } class LocalizationTrackerState extends State { - late double captionFontSize; + late double bodySmallFontSize; @override Widget build(BuildContext context) { - captionFontSize = Theme.of(context).textTheme.caption!.fontSize!; + bodySmallFontSize = Theme.of(context).textTheme.bodySmall!.fontSize!; return Container(); } } diff --git a/packages/flutter_tools/templates/app/lib/main.dart.tmpl b/packages/flutter_tools/templates/app/lib/main.dart.tmpl index 3062012e47..e963b8ac4a 100644 --- a/packages/flutter_tools/templates/app/lib/main.dart.tmpl +++ b/packages/flutter_tools/templates/app/lib/main.dart.tmpl @@ -112,7 +112,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), diff --git a/packages/flutter_tools/templates/module/common/lib/main.dart.tmpl b/packages/flutter_tools/templates/module/common/lib/main.dart.tmpl index 51b5654e37..8c5545e059 100644 --- a/packages/flutter_tools/templates/module/common/lib/main.dart.tmpl +++ b/packages/flutter_tools/templates/module/common/lib/main.dart.tmpl @@ -104,7 +104,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ), diff --git a/packages/flutter_tools/test/integration.shard/analyze_once_test.dart b/packages/flutter_tools/test/integration.shard/analyze_once_test.dart index 5dad4ab088..391acce9bd 100644 --- a/packages/flutter_tools/test/integration.shard/analyze_once_test.dart +++ b/packages/flutter_tools/test/integration.shard/analyze_once_test.dart @@ -423,7 +423,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.headlineMedium, ), ], ),