Migrate TextTheme to 2018 APIs (#48547)

This commit is contained in:
Hans Muller
2020-01-24 19:03:01 -08:00
committed by Flutter GitHub Bot
parent 77fb0c1ade
commit bc5c46438a
118 changed files with 1138 additions and 749 deletions

View File

@@ -363,7 +363,7 @@ class UserHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
RichText(text: TextSpan(
style: Theme.of(context).textTheme.body1,
style: Theme.of(context).textTheme.bodyText2,
children: <TextSpan>[
TextSpan(text: userName, style: const TextStyle(fontWeight: FontWeight.bold)),
const TextSpan(text: ' shared a new '),
@@ -462,8 +462,8 @@ class ItemImageBox extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text('Artisans of Southern India', style: Theme.of(context).textTheme.body2),
Text('Silk Spinners', style: Theme.of(context).textTheme.body1),
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),
],
),
@@ -506,7 +506,7 @@ class ItemGalleryBox extends StatelessWidget {
child: Container(
color: Theme.of(context).primaryColor,
child: Center(
child: Text(tabName, style: Theme.of(context).textTheme.headline.copyWith(color: Colors.white)),
child: Text(tabName, style: Theme.of(context).textTheme.headline5.copyWith(color: Colors.white)),
),
),
),

View File

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

View File

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

View File

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

View File

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

View File

@@ -240,7 +240,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.title),
child: Text('Swipe Away: ${_cardModels.length}', style: Theme.of(context).primaryTextTheme.headline6),
),
);
}
@@ -305,7 +305,7 @@ class CardCollectionState extends State<CardCollection> {
rightArrowIcon = Opacity(opacity: 0.1, child: rightArrowIcon);
final ThemeData theme = Theme.of(context);
final TextStyle backgroundTextStyle = theme.primaryTextTheme.title;
final TextStyle backgroundTextStyle = theme.primaryTextTheme.headline6;
// 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

@@ -100,7 +100,7 @@ class ExampleDragSource extends StatelessWidget {
size *= kHeavyMultiplier;
final Widget contents = DefaultTextStyle(
style: Theme.of(context).textTheme.body1,
style: Theme.of(context).textTheme.bodyText2,
textAlign: TextAlign.center,
child: Dot(
color: color,
@@ -188,7 +188,7 @@ class MovableBall extends StatelessWidget {
@override
Widget build(BuildContext context) {
final Widget ball = DefaultTextStyle(
style: Theme.of(context).primaryTextTheme.body1,
style: Theme.of(context).primaryTextTheme.bodyText2,
textAlign: TextAlign.center,
child: Dot(
key: kBallKey,

View File

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

View File

@@ -56,7 +56,7 @@ class _HoverDemoState extends State<HoverDemo> {
final TextTheme textTheme = Theme.of(context).textTheme;
return DefaultTextStyle(
style: textTheme.display1,
style: textTheme.headline4,
child: Scaffold(
appBar: AppBar(
title: const Text('Hover Demo'),

View File

@@ -79,12 +79,12 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
onTap: () {
_focusNode.requestFocus();
},
child: Text('Tap to focus', style: textTheme.display1),
child: Text('Tap to focus', style: textTheme.headline4),
);
}
if (_event == null) {
return Text('Press a key', style: textTheme.display1);
return Text('Press a key', style: textTheme.headline4);
}
final RawKeyEventData data = _event.data;
@@ -137,7 +137,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
}
}
return DefaultTextStyle(
style: textTheme.subhead,
style: textTheme.subtitle1,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: dataText,

View File

@@ -91,7 +91,7 @@ abstract class KeyboardKey extends Diagnosticable {
/// color: Colors.white,
/// alignment: Alignment.center,
/// child: DefaultTextStyle(
/// style: textTheme.display1,
/// style: textTheme.headline4,
/// child: RawKeyboardListener(
/// focusNode: _focusNode,
/// onKey: _handleKeyEvent,
@@ -371,7 +371,7 @@ class LogicalKeyboardKey extends KeyboardKey {
/// color: Colors.white,
/// alignment: Alignment.center,
/// child: DefaultTextStyle(
/// style: textTheme.display1,
/// style: textTheme.headline4,
/// child: RawKeyboardListener(
/// focusNode: _focusNode,
/// onKey: _handleKeyEvent,