-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove redundant useMaterial3: true
#163376
Conversation
Linux Analyze is failing due to const constructor lint. |
what should we do? |
Wherever const lint is missing, you may add it. |
5e0e2b7
to
ef6a68d
Compare
You can search "error #" to look for failures. |
ef6a68d
to
599f51b
Compare
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
I don't understand this. Can anyone help? |
599f51b
to
f205647
Compare
FYI @QuncCccccc |
This may overlap with: #162862 |
f205647
to
74be103
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for helping the migration!
Overall this looks great. I haven't reviewed all of cases. But could you help do the following update:
ThemeData.light()
is the same asThemeData()
, we can useThemeData()
to replace it.ThemeData.light().copyWith(xxx: yyy)
should also be the same as theThemeData(xxx: yyy)
which can be used to keep tests looking simpler:)
theme: ThemeData.light( | ||
useMaterial3: true, | ||
).copyWith(scaffoldBackgroundColor: scaffoldColor, cardColor: cardColor), | ||
theme: ThemeData.light().copyWith( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theme: ThemeData.light().copyWith( | |
theme: ThemeData().copyWith( |
@@ -115,7 +115,7 @@ void main() { | |||
|
|||
await tester.pumpWidget( | |||
MaterialApp( | |||
theme: ThemeData.light(useMaterial3: true).copyWith(actionIconTheme: actionIconTheme), | |||
theme: ThemeData.light().copyWith(actionIconTheme: actionIconTheme), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this can be simpler?
theme: ThemeData.light().copyWith(actionIconTheme: actionIconTheme), | |
theme: ThemeData(actionIconTheme: actionIconTheme), |
@@ -1523,7 +1515,7 @@ void main() { | |||
await tester.pumpWidget( | |||
MaterialApp( | |||
key: GlobalKey(), | |||
theme: ThemeData.light().copyWith(useMaterial3: true, appBarTheme: const AppBarTheme()), | |||
theme: ThemeData.light().copyWith(appBarTheme: const AppBarTheme()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theme: ThemeData.light().copyWith(appBarTheme: const AppBarTheme()), | |
theme: ThemeData(appBarTheme: const AppBarTheme()), |
@@ -12,7 +12,7 @@ void main() { | |||
|
|||
await tester.pumpWidget( | |||
MaterialApp( | |||
theme: ThemeData.light(useMaterial3: true), | |||
theme: ThemeData.light(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theme: ThemeData.light(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think by default, MaterialApp provides a light theme data:)
@@ -53,7 +53,7 @@ void main() { | |||
|
|||
await tester.pumpWidget( | |||
MaterialApp( | |||
theme: ThemeData.light(useMaterial3: true), | |||
theme: ThemeData.light(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theme: ThemeData.light(), |
@@ -173,7 +173,7 @@ void main() { | |||
}); | |||
|
|||
testWidgets('Small Badge RTL defaults', (WidgetTester tester) async { | |||
final ThemeData theme = ThemeData.light(useMaterial3: true); | |||
final ThemeData theme = ThemeData.light(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final ThemeData theme = ThemeData.light(); | |
final ThemeData theme = ThemeData(); |
@@ -207,7 +207,7 @@ void main() { | |||
}); | |||
|
|||
testWidgets('Large Badge textStyle and colors', (WidgetTester tester) async { | |||
final ThemeData theme = ThemeData.light(useMaterial3: true); | |||
final ThemeData theme = ThemeData.light(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final ThemeData theme = ThemeData.light(); | |
final ThemeData theme = ThemeData(); |
@@ -236,7 +236,7 @@ void main() { | |||
testWidgets('isLabelVisible', (WidgetTester tester) async { | |||
await tester.pumpWidget( | |||
MaterialApp( | |||
theme: ThemeData.light(useMaterial3: true), | |||
theme: ThemeData.light(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theme: ThemeData.light(), |
@@ -258,7 +258,7 @@ void main() { | |||
|
|||
Widget buildFrame(Alignment alignment, [Offset offset = Offset.zero]) { | |||
return MaterialApp( | |||
theme: ThemeData.light(useMaterial3: true), | |||
theme: ThemeData.light(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theme: ThemeData.light(), |
@@ -356,7 +356,7 @@ void main() { | |||
|
|||
Widget buildFrame(Alignment alignment, [Offset offset = Offset.zero]) { | |||
return MaterialApp( | |||
theme: ThemeData.light(useMaterial3: true), | |||
theme: ThemeData.light(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theme: ThemeData.light(), |
Hi @QuncCccccc I have made the changes you suggested. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for helping remove this! Just 2 more nits then we are good to go!
LGTM:)
examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart
Outdated
Show resolved
Hide resolved
examples/api/lib/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart
Outdated
Show resolved
Hide resolved
@@ -58,7 +58,7 @@ void main() { | |||
// This test can be removed when `useMaterial3` is deprecated. | |||
await tester.pumpWidget( | |||
MaterialApp( | |||
theme: ThemeData.light().copyWith(useMaterial3: false), | |||
theme: ThemeData(useMaterial3: false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the failure is because of the copyWith cannot properly handle useMaterial3
, see here. Let's just revert this part because in this PR we only wanted to handle cases for useMaterial3: true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 . Thanks for doing all of this painstaking work to migrate the code!
This PR removes redundant useMaterial3: true as described in #162818
List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.
useMaterial3: true
in framework, samples and codelabs #162818Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.