Deprecate 2018 text theme parameters (#109817)
This commit is contained in:
@@ -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!
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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<Widget> aboutBoxChildren = <Widget>[
|
||||
const SizedBox(height: 24),
|
||||
RichText(
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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<TextPage> {
|
||||
alignment: Alignment.center,
|
||||
child: TextField(
|
||||
controller: textController,
|
||||
style: theme.primaryTextTheme.headline4?.copyWith(
|
||||
style: theme.primaryTextTheme.headlineMedium?.copyWith(
|
||||
color: widget.destination.color,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
|
||||
@@ -62,7 +62,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget>
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Circular progress indicator with a fixed color',
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
CircularProgressIndicator(
|
||||
value: controller.value,
|
||||
|
||||
@@ -46,7 +46,7 @@ class _MyAppState extends State<MyApp> {
|
||||
),
|
||||
Text(
|
||||
'$_counter',
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -68,7 +68,7 @@ class _ToggleButtonsSampleState extends State<ToggleButtonsSample> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
// 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<ToggleButtonsSample> {
|
||||
),
|
||||
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<ToggleButtonsSample> {
|
||||
),
|
||||
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,
|
||||
|
||||
@@ -70,7 +70,7 @@ class _MyKeyExampleState extends State<MyKeyExample> {
|
||||
color: Colors.white,
|
||||
alignment: Alignment.center,
|
||||
child: DefaultTextStyle(
|
||||
style: textTheme.headline4!,
|
||||
style: textTheme.headlineMedium!,
|
||||
child: Focus(
|
||||
focusNode: _focusNode,
|
||||
onKey: _handleKeyEvent,
|
||||
|
||||
@@ -70,7 +70,7 @@ class _MyPhysicalKeyExampleState extends State<MyPhysicalKeyExample> {
|
||||
color: Colors.white,
|
||||
alignment: Alignment.center,
|
||||
child: DefaultTextStyle(
|
||||
style: textTheme.headline4!,
|
||||
style: textTheme.headlineMedium!,
|
||||
child: Focus(
|
||||
focusNode: _focusNode,
|
||||
onKey: _handleKeyEvent,
|
||||
|
||||
@@ -155,7 +155,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
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(
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -50,7 +50,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
// child each time the count changes, so that it will begin its animation
|
||||
// when the count changes.
|
||||
key: ValueKey<int>(_count),
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
|
||||
@@ -38,7 +38,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.headline2!,
|
||||
style: Theme.of(context).textTheme.displayMedium!,
|
||||
textAlign: TextAlign.center,
|
||||
child: FutureBuilder<String>(
|
||||
future: _calculation, // a previously-obtained Future<String> or null
|
||||
|
||||
@@ -48,7 +48,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
@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,
|
||||
|
||||
@@ -78,7 +78,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
'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)})',
|
||||
|
||||
@@ -76,7 +76,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
'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)})',
|
||||
|
||||
@@ -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(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
debugLabel: 'Scope',
|
||||
autofocus: true,
|
||||
child: DefaultTextStyle(
|
||||
style: textTheme.headline4!,
|
||||
style: textTheme.headlineMedium!,
|
||||
child: Focus(
|
||||
onKey: _handleKeyPress,
|
||||
debugLabel: 'Button',
|
||||
|
||||
@@ -119,7 +119,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
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<MyStatefulWidget> {
|
||||
? null
|
||||
: () => setState(() => backdropIsVisible = true),
|
||||
child: DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.headline2!,
|
||||
style: Theme.of(context).textTheme.displayMedium!,
|
||||
child: const Text('FOREGROUND')),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -82,7 +82,7 @@ class _RestorableCounterState extends State<RestorableCounter>
|
||||
),
|
||||
Text(
|
||||
'${_counter.value}',
|
||||
style: Theme.of(context).textTheme.headline4,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user