Skip to content

Commit fbc80a6

Browse files
authored
[material_ui] Remove static access of copyWith from dart fix golden tests for ThemeData/TextTheme (#12994)
Fixes flutter/flutter#193231 Hopefully unblocks the flutter -> packages autoroller. The `dart fix` golden tests for `ThemeData` and `TextTheme` were incorrectly trying to statically access `copyWith` which is an instance member. This caused an unexpected `dart fix` change involving deprecated members (details at flutter/flutter#193231) but I think the underlying issue is the golden tests don't contain valid Dart code. ## Pre-Review Checklist **Changelog exemption:** Test changes only. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent c06a3f2 commit fbc80a6

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎packages/material_ui/test_fixes/text_theme.dart‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void main() {
2424
var errorTextTheme = TextTheme(error: '');
2525

2626
// Changes made in https://github.com/flutter/flutter/pull/48547
27-
var copiedTextTheme = TextTheme.copyWith(
27+
var copiedTextTheme = textTheme.copyWith(
2828
display4: displayStyle4,
2929
display3: displayStyle3,
3030
display2: displayStyle2,
@@ -39,7 +39,7 @@ void main() {
3939
subtitle: subtitleStyle,
4040
overline: overlineStyle,
4141
);
42-
var errorCopiedTextTheme = TextTheme.copyWith(error: '');
42+
var errorCopiedTextTheme = textTheme.copyWith(error: '');
4343

4444
// Changes made in https://github.com/flutter/flutter/pull/48547
4545
var style;
@@ -76,7 +76,7 @@ void main() {
7676
var anotherErrorTextTheme = TextTheme(error: '');
7777

7878
// Changes made in https://github.com/flutter/flutter/pull/109817
79-
var anotherCopiedTextTheme = TextTheme.copyWith(
79+
var anotherCopiedTextTheme = anotherTextTheme.copyWith(
8080
headline1: headline1Style,
8181
headline2: headline2Style,
8282
headline3: headline3Style,
@@ -91,7 +91,7 @@ void main() {
9191
button: buttonStyle,
9292
overline: overlineStyle,
9393
);
94-
var anotherErrorCopiedTextTheme = TextTheme.copyWith(error: '');
94+
var anotherErrorCopiedTextTheme = anotherTextTheme.copyWith(error: '');
9595

9696
// Changes made in https://github.com/flutter/flutter/pull/109817
9797
var style;

‎packages/material_ui/test_fixes/text_theme.dart.expect‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void main() {
2424
var errorTextTheme = TextTheme(error: '');
2525

2626
// Changes made in https://github.com/flutter/flutter/pull/48547
27-
var copiedTextTheme = TextTheme.copyWith(
27+
var copiedTextTheme = textTheme.copyWith(
2828
displayLarge: displayStyle4,
2929
displayMedium: displayStyle3,
3030
displaySmall: displayStyle2,
@@ -39,7 +39,7 @@ void main() {
3939
titleSmall: subtitleStyle,
4040
labelSmall: overlineStyle,
4141
);
42-
var errorCopiedTextTheme = TextTheme.copyWith(error: '');
42+
var errorCopiedTextTheme = textTheme.copyWith(error: '');
4343

4444
// Changes made in https://github.com/flutter/flutter/pull/48547
4545
var style;
@@ -76,7 +76,7 @@ void main() {
7676
var anotherErrorTextTheme = TextTheme(error: '');
7777

7878
// Changes made in https://github.com/flutter/flutter/pull/109817
79-
var anotherCopiedTextTheme = TextTheme.copyWith(
79+
var anotherCopiedTextTheme = anotherTextTheme.copyWith(
8080
displayLarge: headline1Style,
8181
displayMedium: headline2Style,
8282
displaySmall: headline3Style,
@@ -91,7 +91,7 @@ void main() {
9191
labelLarge: buttonStyle,
9292
labelSmall: overlineStyle,
9393
);
94-
var anotherErrorCopiedTextTheme = TextTheme.copyWith(error: '');
94+
var anotherErrorCopiedTextTheme = anotherTextTheme.copyWith(error: '');
9595

9696
// Changes made in https://github.com/flutter/flutter/pull/109817
9797
var style;

‎packages/material_ui/test_fixes/theme_data.dart‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,11 @@ void main() {
309309
ThemeData themeData = ThemeData();
310310
themeData = ThemeData(bottomAppBarColor: Colors.green);
311311
themeData = ThemeData.raw(bottomAppBarColor: Colors.green);
312-
themeData = ThemeData.copyWith(bottomAppBarColor: Colors.green);
312+
themeData = themeData.copyWith(bottomAppBarColor: Colors.green);
313313

314314
// Changes made in https://github.com/flutter/flutter/pull/131455
315-
ThemeData themeData = ThemeData.copyWith(useMaterial3: false);
315+
ThemeData themeData = ThemeData();
316+
themeData = themeData.copyWith(useMaterial3: false);
316317

317318
// Changes made in https://github.com/flutter/flutter/pull/155072
318319
ThemeData themeData = ThemeData();

‎packages/material_ui/test_fixes/theme_data.dart.expect‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,11 @@ void main() {
385385
ThemeData themeData = ThemeData();
386386
themeData = ThemeData(bottomAppBarTheme: BottomAppBarTheme(color: Colors.green));
387387
themeData = ThemeData.raw(bottomAppBarTheme: BottomAppBarTheme(color: Colors.green));
388-
themeData = ThemeData.copyWith(bottomAppBarTheme: BottomAppBarTheme(color: Colors.green));
388+
themeData = themeData.copyWith(bottomAppBarTheme: BottomAppBarTheme(color: Colors.green));
389389

390390
// Changes made in https://github.com/flutter/flutter/pull/131455
391-
ThemeData themeData = ThemeData.copyWith();
391+
ThemeData themeData = ThemeData();
392+
themeData = themeData.copyWith();
392393

393394
// Changes made in https://github.com/flutter/flutter/pull/155072
394395
ThemeData themeData = ThemeData();

0 commit comments

Comments
 (0)