Unverified Commit f5b65bad authored by Renzo Olivares's avatar Renzo Olivares Committed by GitHub

Remove deprecated `TextTheme` members (#139255)

Part of: https://github.com/flutter/flutter/issues/143956
parent 2079f349
...@@ -88,7 +88,7 @@ class CountDisplay extends StatelessWidget { ...@@ -88,7 +88,7 @@ class CountDisplay extends StatelessWidget {
width: 100, width: 100,
height: 100, height: 100,
padding: const EdgeInsetsDirectional.all(10), padding: const EdgeInsetsDirectional.all(10),
child: Text('$count', style: Theme.of(context).textTheme.headline4), child: Text('$count', style: Theme.of(context).textTheme.headlineMedium),
); );
} }
} }
...@@ -381,7 +381,7 @@ class ButtonThemeData with Diagnosticable { ...@@ -381,7 +381,7 @@ class ButtonThemeData with Diagnosticable {
/// minimum size, internal padding, and shape. /// minimum size, internal padding, and shape.
/// ///
/// Despite the name, this property is not the [TextTheme] whose /// Despite the name, this property is not the [TextTheme] whose
/// [TextTheme.button] is used as the button text's [TextStyle]. /// [TextTheme.labelLarge] is used as the button text's [TextStyle].
ButtonTextTheme getTextTheme(MaterialButton button) => button.textTheme ?? textTheme; ButtonTextTheme getTextTheme(MaterialButton button) => button.textTheme ?? textTheme;
/// The foreground color of the [button]'s text and icon when /// The foreground color of the [button]'s text and icon when
......
...@@ -1507,7 +1507,7 @@ class _PopupMenuDefaultsM2 extends PopupMenuThemeData { ...@@ -1507,7 +1507,7 @@ class _PopupMenuDefaultsM2 extends PopupMenuThemeData {
late final TextTheme _textTheme = _theme.textTheme; late final TextTheme _textTheme = _theme.textTheme;
@override @override
TextStyle? get textStyle => _textTheme.subtitle1; TextStyle? get textStyle => _textTheme.titleMedium;
static EdgeInsets menuHorizontalPadding = const EdgeInsets.symmetric(horizontal: 16.0); static EdgeInsets menuHorizontalPadding = const EdgeInsets.symmetric(horizontal: 16.0);
} }
......
...@@ -482,8 +482,8 @@ void main() { ...@@ -482,8 +482,8 @@ void main() {
// Default value for ThemeData.typography is Typography.material2014() // Default value for ThemeData.typography is Typography.material2014()
expect( expect(
content.text.style, content.text.style,
Typography.material2014().englishLike.bodyText2!.merge( Typography.material2014().englishLike.bodyMedium!.merge(
Typography.material2014().black.bodyText2, Typography.material2014().black.bodyMedium,
), ),
); );
...@@ -545,8 +545,8 @@ void main() { ...@@ -545,8 +545,8 @@ void main() {
// Default value for ThemeData.typography is Typography.material2014() // Default value for ThemeData.typography is Typography.material2014()
expect( expect(
content.text.style, content.text.style,
Typography.material2014().englishLike.bodyText2!.merge( Typography.material2014().englishLike.bodyMedium!.merge(
Typography.material2014().black.bodyText2, Typography.material2014().black.bodyMedium,
), ),
); );
......
...@@ -3737,11 +3737,11 @@ void main() { ...@@ -3737,11 +3737,11 @@ void main() {
// Test popup menu item with a Text widget. // Test popup menu item with a Text widget.
expect(_labelStyle(tester, 'Item 0')!.fontSize, 16.0); expect(_labelStyle(tester, 'Item 0')!.fontSize, 16.0);
expect(_labelStyle(tester, 'Item 0')!.color, theme.textTheme.subtitle1!.color); expect(_labelStyle(tester, 'Item 0')!.color, theme.textTheme.titleMedium!.color);
// Test popup menu item with a ListTile widget. // Test popup menu item with a ListTile widget.
expect(_labelStyle(tester, 'Item 1')!.fontSize, 16.0); expect(_labelStyle(tester, 'Item 1')!.fontSize, 16.0);
expect(_labelStyle(tester, 'Item 1')!.color, theme.textTheme.subtitle1!.color); expect(_labelStyle(tester, 'Item 1')!.color, theme.textTheme.titleMedium!.color);
// Close the menu. // Close the menu.
await tester.tapAt(const Offset(20.0, 20.0)); await tester.tapAt(const Offset(20.0, 20.0));
...@@ -3754,7 +3754,7 @@ void main() { ...@@ -3754,7 +3754,7 @@ void main() {
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
); );
theme = theme.copyWith( theme = theme.copyWith(
textTheme: const TextTheme(subtitle1: customTextStyle), textTheme: const TextTheme(titleMedium: customTextStyle),
); );
await tester.pumpWidget(buildMenu()); await tester.pumpWidget(buildMenu());
......
...@@ -1404,9 +1404,9 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async ...@@ -1404,9 +1404,9 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
home: Material( home: Material(
child: StatefulBuilder( child: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) { builder: (BuildContext context, StateSetter setState) {
bodyLargeStyle = Theme.of(context).textTheme.bodyText1!; bodyLargeStyle = Theme.of(context).textTheme.bodyLarge!;
bodyMediumStyle = Theme.of(context).textTheme.bodyText2!; bodyMediumStyle = Theme.of(context).textTheme.bodyMedium!;
bodySmallStyle = Theme.of(context).textTheme.caption!; bodySmallStyle = Theme.of(context).textTheme.bodySmall!;
return Stepper( return Stepper(
type: StepperType.horizontal, type: StepperType.horizontal,
currentStep: index, currentStep: index,
......
...@@ -135,19 +135,19 @@ void main() { ...@@ -135,19 +135,19 @@ void main() {
const FontWeight regular = FontWeight.w400; const FontWeight regular = FontWeight.w400;
const FontWeight medium = FontWeight.w500; const FontWeight medium = FontWeight.w500;
// H1 Roboto light 96 -1.5 // Display Large Roboto light 96 -1.5
expect(theme.displayLarge!.fontFamily, 'Roboto'); expect(theme.displayLarge!.fontFamily, 'Roboto');
expect(theme.displayLarge!.fontWeight, light); expect(theme.displayLarge!.fontWeight, light);
expect(theme.displayLarge!.fontSize, 96); expect(theme.displayLarge!.fontSize, 96);
expect(theme.displayLarge!.letterSpacing, -1.5); expect(theme.displayLarge!.letterSpacing, -1.5);
// H2 Roboto light 60 -0.5 // Display Medium Roboto light 60 -0.5
expect(theme.displayMedium!.fontFamily, 'Roboto'); expect(theme.displayMedium!.fontFamily, 'Roboto');
expect(theme.displayMedium!.fontWeight, light); expect(theme.displayMedium!.fontWeight, light);
expect(theme.displayMedium!.fontSize, 60); expect(theme.displayMedium!.fontSize, 60);
expect(theme.displayMedium!.letterSpacing, -0.5); expect(theme.displayMedium!.letterSpacing, -0.5);
// H3 Roboto regular 48 0 // Display Small Roboto regular 48 0
expect(theme.displaySmall!.fontFamily, 'Roboto'); expect(theme.displaySmall!.fontFamily, 'Roboto');
expect(theme.displaySmall!.fontWeight, regular); expect(theme.displaySmall!.fontWeight, regular);
expect(theme.displaySmall!.fontSize, 48); expect(theme.displaySmall!.fontSize, 48);
...@@ -159,55 +159,55 @@ void main() { ...@@ -159,55 +159,55 @@ void main() {
expect(theme.headlineLarge!.fontSize, 40); expect(theme.headlineLarge!.fontSize, 40);
expect(theme.headlineLarge!.letterSpacing, 0.25); expect(theme.headlineLarge!.letterSpacing, 0.25);
// H4 Roboto regular 34 0.25 // Headline Medium Roboto regular 34 0.25
expect(theme.headlineMedium!.fontFamily, 'Roboto'); expect(theme.headlineMedium!.fontFamily, 'Roboto');
expect(theme.headlineMedium!.fontWeight, regular); expect(theme.headlineMedium!.fontWeight, regular);
expect(theme.headlineMedium!.fontSize, 34); expect(theme.headlineMedium!.fontSize, 34);
expect(theme.headlineMedium!.letterSpacing, 0.25); expect(theme.headlineMedium!.letterSpacing, 0.25);
// H5 Roboto regular 24 0 // Headline Small Roboto regular 24 0
expect(theme.headlineSmall!.fontFamily, 'Roboto'); expect(theme.headlineSmall!.fontFamily, 'Roboto');
expect(theme.headlineSmall!.fontWeight, regular); expect(theme.headlineSmall!.fontWeight, regular);
expect(theme.headlineSmall!.fontSize, 24); expect(theme.headlineSmall!.fontSize, 24);
expect(theme.headlineSmall!.letterSpacing, 0); expect(theme.headlineSmall!.letterSpacing, 0);
// H6 Roboto medium 20 0.15 // Title Large Roboto medium 20 0.15
expect(theme.titleLarge!.fontFamily, 'Roboto'); expect(theme.titleLarge!.fontFamily, 'Roboto');
expect(theme.titleLarge!.fontWeight, medium); expect(theme.titleLarge!.fontWeight, medium);
expect(theme.titleLarge!.fontSize, 20); expect(theme.titleLarge!.fontSize, 20);
expect(theme.titleLarge!.letterSpacing, 0.15); expect(theme.titleLarge!.letterSpacing, 0.15);
// Subtitle1 Roboto regular 16 0.15 // Title Medium Roboto regular 16 0.15
expect(theme.titleMedium!.fontFamily, 'Roboto'); expect(theme.titleMedium!.fontFamily, 'Roboto');
expect(theme.titleMedium!.fontWeight, regular); expect(theme.titleMedium!.fontWeight, regular);
expect(theme.titleMedium!.fontSize, 16); expect(theme.titleMedium!.fontSize, 16);
expect(theme.titleMedium!.letterSpacing, 0.15); expect(theme.titleMedium!.letterSpacing, 0.15);
// Subtitle2 Roboto medium 14 0.1 // Title Small Roboto medium 14 0.1
expect(theme.titleSmall!.fontFamily, 'Roboto'); expect(theme.titleSmall!.fontFamily, 'Roboto');
expect(theme.titleSmall!.fontWeight, medium); expect(theme.titleSmall!.fontWeight, medium);
expect(theme.titleSmall!.fontSize, 14); expect(theme.titleSmall!.fontSize, 14);
expect(theme.titleSmall!.letterSpacing, 0.1); expect(theme.titleSmall!.letterSpacing, 0.1);
// Body1 Roboto regular 16 0.5 // Body Large Roboto regular 16 0.5
expect(theme.bodyLarge!.fontFamily, 'Roboto'); expect(theme.bodyLarge!.fontFamily, 'Roboto');
expect(theme.bodyLarge!.fontWeight, regular); expect(theme.bodyLarge!.fontWeight, regular);
expect(theme.bodyLarge!.fontSize, 16); expect(theme.bodyLarge!.fontSize, 16);
expect(theme.bodyLarge!.letterSpacing, 0.5); expect(theme.bodyLarge!.letterSpacing, 0.5);
// Body2 Roboto regular 14 0.25 // Body Medium Roboto regular 14 0.25
expect(theme.bodyMedium!.fontFamily, 'Roboto'); expect(theme.bodyMedium!.fontFamily, 'Roboto');
expect(theme.bodyMedium!.fontWeight, regular); expect(theme.bodyMedium!.fontWeight, regular);
expect(theme.bodyMedium!.fontSize, 14); expect(theme.bodyMedium!.fontSize, 14);
expect(theme.bodyMedium!.letterSpacing, 0.25); expect(theme.bodyMedium!.letterSpacing, 0.25);
// Caption Roboto regular 12 0.4 // Body Small Roboto regular 12 0.4
expect(theme.bodySmall!.fontFamily, 'Roboto'); expect(theme.bodySmall!.fontFamily, 'Roboto');
expect(theme.bodySmall!.fontWeight, regular); expect(theme.bodySmall!.fontWeight, regular);
expect(theme.bodySmall!.fontSize, 12); expect(theme.bodySmall!.fontSize, 12);
expect(theme.bodySmall!.letterSpacing, 0.4); expect(theme.bodySmall!.letterSpacing, 0.4);
// BUTTON Roboto medium 14 1.25 // Label Large Roboto medium 14 1.25
expect(theme.labelLarge!.fontFamily, 'Roboto'); expect(theme.labelLarge!.fontFamily, 'Roboto');
expect(theme.labelLarge!.fontWeight, medium); expect(theme.labelLarge!.fontWeight, medium);
expect(theme.labelLarge!.fontSize, 14); expect(theme.labelLarge!.fontSize, 14);
...@@ -219,7 +219,7 @@ void main() { ...@@ -219,7 +219,7 @@ void main() {
expect(theme.labelMedium!.fontSize, 11); expect(theme.labelMedium!.fontSize, 11);
expect(theme.labelMedium!.letterSpacing, 1.5); expect(theme.labelMedium!.letterSpacing, 1.5);
// OVERLINE Roboto regular 10 1.5 // Label Small Roboto regular 10 1.5
expect(theme.labelSmall!.fontFamily, 'Roboto'); expect(theme.labelSmall!.fontFamily, 'Roboto');
expect(theme.labelSmall!.fontWeight, regular); expect(theme.labelSmall!.fontWeight, regular);
expect(theme.labelSmall!.fontSize, 10); expect(theme.labelSmall!.fontSize, 10);
......
...@@ -142,7 +142,7 @@ void main() { ...@@ -142,7 +142,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
...@@ -9080,7 +9080,7 @@ void main() { ...@@ -9080,7 +9080,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
selectionControls: materialTextSelectionControls, selectionControls: materialTextSelectionControls,
...@@ -9174,7 +9174,7 @@ void main() { ...@@ -9174,7 +9174,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
selectionControls: materialTextSelectionControls, selectionControls: materialTextSelectionControls,
...@@ -14993,7 +14993,7 @@ void main() { ...@@ -14993,7 +14993,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
...@@ -15050,7 +15050,7 @@ void main() { ...@@ -15050,7 +15050,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
...@@ -15118,7 +15118,7 @@ void main() { ...@@ -15118,7 +15118,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
...@@ -15191,7 +15191,7 @@ void main() { ...@@ -15191,7 +15191,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
...@@ -15252,7 +15252,7 @@ void main() { ...@@ -15252,7 +15252,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
...@@ -15329,7 +15329,7 @@ void main() { ...@@ -15329,7 +15329,7 @@ void main() {
showSelectionHandles: true, showSelectionHandles: true,
autofocus: true, autofocus: true,
focusNode: focusNode, focusNode: focusNode,
style: Typography.material2018().black.subtitle1!, style: Typography.material2018().black.titleMedium!,
cursorColor: Colors.blue, cursorColor: Colors.blue,
backgroundCursorColor: Colors.grey, backgroundCursorColor: Colors.grey,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment