Remove redundant useMaterial3: true (#163376)

<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

This PR removes redundant useMaterial3: true as described in
https://github.com/flutter/flutter/issues/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.*

- https://github.com/flutter/flutter/issues/162818

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Qun Cheng <36861262+QuncCccccc@users.noreply.github.com>
This commit is contained in:
Sangam Shrestha
2025-03-14 23:35:20 +05:45
committed by GitHub
parent bffef7a1c5
commit d261411b4c
227 changed files with 464 additions and 898 deletions

View File

@@ -15,7 +15,7 @@ void main() {
await tester.pumpWidget(const example.FloatingActionButtonExampleApp());
final ThemeData theme = ThemeData(useMaterial3: true);
final ThemeData theme = ThemeData();
expect(find.byType(FloatingActionButton), findsNWidgets(4));
expect(find.byIcon(Icons.add), findsNWidgets(4));

View File

@@ -15,7 +15,7 @@ void main() {
return tester.widget<FloatingActionButton>(finder);
}
final ColorScheme colorScheme = ThemeData(useMaterial3: true).colorScheme;
final ColorScheme colorScheme = ThemeData().colorScheme;
// Test the FAB with surface color mapping.
FloatingActionButton fab = getFAB(find.byType(FloatingActionButton).at(0));

View File

@@ -40,9 +40,9 @@ void main() {
testWidgets('Home uses MyColors extension correctly', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData.light().copyWith(
extensions: <ThemeExtension<dynamic>>[
const example.MyColors(brandColor: Color(0xFF0000FF), danger: Color(0xFFFF0000)),
theme: ThemeData(
extensions: const <ThemeExtension<dynamic>>[
example.MyColors(brandColor: Color(0xFF0000FF), danger: Color(0xFFFF0000)),
],
),
home: example.Home(isLightTheme: true, toggleTheme: () {}),

View File

@@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('ToggleButtons allows multiple or no selection', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true);
final ThemeData theme = ThemeData();
Finder findButton(String text) {
return find.descendant(
of: find.byType(ToggleButtons),
@@ -71,7 +71,7 @@ void main() {
});
testWidgets('SegmentedButton allows multiple or no selection', (WidgetTester tester) async {
final ThemeData theme = ThemeData(useMaterial3: true);
final ThemeData theme = ThemeData();
Finder findButton(String text) {
return find.descendant(
of: find.byType(SegmentedButton<example.ShirtSize>),

View File

@@ -15,9 +15,8 @@ void main() {
testWidgets('gradient matches golden', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const SizedBox(
const MaterialApp(
home: SizedBox(
width: 800,
height: 600,
child: RepaintBoundary(child: example.MoodyGradient()),