Deprecate 2018 text theme parameters (#109817)

This commit is contained in:
Kate Lovett
2022-08-22 15:00:34 -05:00
committed by GitHub
parent 717d92e802
commit 7e12b37111
151 changed files with 1112 additions and 609 deletions

View File

@@ -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: <Widget>[
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: <Widget>[
RichText(text: TextSpan(
style: Theme.of(context).textTheme.bodyText2,
style: Theme.of(context).textTheme.bodyMedium,
children: <TextSpan>[
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: <Widget>[
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: <Widget>[
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),
],
),
);

View File

@@ -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,

View File

@@ -106,7 +106,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
Text(
'0',
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
TextButton(
onPressed: () {},

View File

@@ -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<String>('${stock.symbol}_symbol_name'),
style: Theme.of(context).textTheme.headline3,
style: Theme.of(context).textTheme.displaySmall,
),
arrow,
],

View File

@@ -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,

View File

@@ -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: <Widget>[
...lines.sublist(0, lines.length - 1).map<Widget>((String line) => Text(line)),
Text(lines.last, style: themeData.textTheme.caption),
Text(lines.last, style: themeData.textTheme.bodySmall),
],
),
),

View File

@@ -117,29 +117,29 @@ over water meant for the whole central valley of California? The story will shoc
children: <Widget>[
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,

View File

@@ -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<double> animation = listenable as Animation<double>;
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<BackdropDemo> with SingleTickerProviderSt
children: <Widget>[
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(

View File

@@ -262,7 +262,7 @@ class _RadioItem<T> 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,
),
);
}

View File

@@ -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(

View File

@@ -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<ChipDemo> {
child: Center(
child: Text(
_createResult(),
style: theme.textTheme.headline6,
style: theme.textTheme.titleLarge,
),
),
),

View File

@@ -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: <Widget>[
@@ -147,13 +147,13 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
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',

View File

@@ -82,7 +82,7 @@ class DialogDemoState extends State<DialogDemo> {
@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(

View File

@@ -237,7 +237,7 @@ class _DrawerDemoState extends State<DrawerDemo> 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,
),
),
],

View File

@@ -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!,
),
),

View File

@@ -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: <Widget>[
Expanded(
@@ -116,7 +116,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
}
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<bool>(
context: context,
@@ -154,7 +154,7 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
title: Text(_hasName ? _eventName : 'Event Name TBD'),
actions: <Widget> [
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<FullScreenDialogDemo> {
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<FullScreenDialogDemo> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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<FullScreenDialogDemo> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('To', style: theme.textTheme.caption),
Text('To', style: theme.textTheme.bodySmall),
DateTimeItem(
dateTime: _toDateTime,
onChanged: (DateTime value) {

View File

@@ -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,

View File

@@ -115,7 +115,7 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> 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,

View File

@@ -212,7 +212,7 @@ class _ListDemoState extends State<ReorderableListDemo> {
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!,

View File

@@ -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>[
TextSpan(
text: suggestion.substring(query!.length),
style: theme.textTheme.subtitle1,
style: theme.textTheme.titleMedium,
),
],
),

View File

@@ -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,

View File

@@ -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,
),
),
],

View File

@@ -78,7 +78,7 @@ class _TabsFabDemoState extends State<TabsFabDemo> 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),
),
);
});

View File

@@ -293,7 +293,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
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),
],

View File

@@ -31,10 +31,10 @@ class TooltipDemo extends StatelessWidget {
bottom: false,
child: ListView(
children: <Widget>[
Text(_introText, style: theme.textTheme.subtitle1),
Text(_introText, style: theme.textTheme.titleMedium),
Row(
children: <Widget>[
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(

View File

@@ -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,

View File

@@ -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: <Widget>[

View File

@@ -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,

View File

@@ -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,
);
}

View File

@@ -51,7 +51,7 @@ class _LoginPageState extends State<LoginPage> {
const SizedBox(height: 16.0),
Text(
'SHRINE',
style: Theme.of(context).textTheme.headline5,
style: Theme.of(context).textTheme.headlineSmall,
),
],
),

View File

@@ -58,7 +58,7 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> {
),
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),
),
],
),

View File

@@ -59,7 +59,7 @@ class ProductCard extends StatelessWidget {
children: <Widget>[
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,
),
],
),

View File

@@ -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<Widget> styleItems = <Widget>[
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(

View File

@@ -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,

View File

@@ -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(

View File

@@ -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!),

View File

@@ -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: <Widget>[
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)
),
),

View File

@@ -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: <Widget>[

View File

@@ -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',
),
);

View File

@@ -44,7 +44,7 @@ class UpdaterState extends State<Updater> {
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),

View File

@@ -102,7 +102,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
],
),

View File

@@ -425,7 +425,7 @@ class _FocusDemoState extends State<FocusDemo> {
debugLabel: 'Scope',
autofocus: true,
child: DefaultTextStyle(
style: textTheme.headline4!,
style: textTheme.headlineMedium!,
child: Scaffold(
appBar: AppBar(
title: const Text('Actions Demo'),

View File

@@ -243,7 +243,7 @@ class CardCollectionState extends State<CardCollection> {
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<CardCollection> {
}
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

View File

@@ -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,

View File

@@ -138,7 +138,7 @@ class _FocusDemoState extends State<FocusDemo> {
onKey: _handleKeyPress,
autofocus: true,
child: DefaultTextStyle(
style: textTheme.headline4!,
style: textTheme.headlineMedium!,
child: Scaffold(
appBar: AppBar(
title: const Text('Focus Demo'),

View File

@@ -29,7 +29,7 @@ class _HoverDemoState extends State<HoverDemo> {
);
return DefaultTextStyle(
style: textTheme.headline4!,
style: textTheme.headlineMedium!,
child: Scaffold(
appBar: AppBar(
title: const Text('Hover Demo'),

View File

@@ -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),
),
),
),

View File

@@ -66,12 +66,12 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
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<RawKeyboardDemo> {
}
dataText.add(Text(pressed.join(' ')));
return DefaultTextStyle(
style: textTheme.subtitle1!,
style: textTheme.titleMedium!,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: dataText,

View File

@@ -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')};