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

@@ -38,7 +38,6 @@ class ActionIconThemeExampleApp extends StatelessWidget {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
actionIconTheme: ActionIconThemeData(
backButtonIconBuilder: (BuildContext context) {
return const Icon(Icons.arrow_back_ios_new_rounded);

View File

@@ -14,7 +14,7 @@ class ChipApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const ActionChipExample(),
);
}

View File

@@ -16,7 +16,7 @@ class AnimatedIconApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const Scaffold(body: AnimatedIconExample()),
);
}

View File

@@ -33,7 +33,7 @@ class AnimatedIconApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const Scaffold(body: AnimatedIconExample()),
);
}

View File

@@ -16,7 +16,7 @@ class AppBarApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const AppBarExample(),
);
}

View File

@@ -16,7 +16,7 @@ class AppBarApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const AppBarExample(),
);
}

View File

@@ -16,7 +16,7 @@ class AppBarMediumApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750A4)),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750A4)),
home: Material(
child: CustomScrollView(
slivers: <Widget>[

View File

@@ -16,7 +16,7 @@ class AppBarLargeApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750A4)),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750A4)),
home: Material(
child: CustomScrollView(
slivers: <Widget>[

View File

@@ -101,7 +101,6 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Bottom App Bar Demo')),
body: Column(

View File

@@ -14,7 +14,7 @@ class BottomSheetApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: Scaffold(
appBar: AppBar(title: const Text('Bottom Sheet Sample')),
body: const BottomSheetExample(),

View File

@@ -16,7 +16,7 @@ class ButtonApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
title: 'Button Types',
home: const Scaffold(body: ButtonTypesExample()),
);

View File

@@ -14,7 +14,7 @@ class CheckboxExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750a4)),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
title: 'Checkbox Sample',
home: Scaffold(
appBar: AppBar(title: const Text('Checkbox Sample')),

View File

@@ -14,7 +14,7 @@ class CheckboxListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const CheckboxListTileExample());
return const MaterialApp(home: CheckboxListTileExample());
}
}

View File

@@ -13,7 +13,7 @@ class CheckboxListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const CheckboxListTileExample());
return const MaterialApp(home: CheckboxListTileExample());
}
}

View File

@@ -15,7 +15,7 @@ class LabeledCheckboxApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const LabeledCheckboxExample());
return const MaterialApp(home: LabeledCheckboxExample());
}
}

View File

@@ -13,7 +13,7 @@ class LabeledCheckboxApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const LabeledCheckboxExample());
return const MaterialApp(home: LabeledCheckboxExample());
}
}

View File

@@ -14,7 +14,7 @@ class ChipApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const ActionChoiceExample(),
);
}

View File

@@ -96,7 +96,7 @@ class _DynamicColorExampleState extends State<DynamicColorExample> {
}
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorScheme: colorScheme),
theme: ThemeData(colorScheme: colorScheme),
debugShowCheckedModeBanner: false,
home: Builder(
builder:

View File

@@ -16,7 +16,7 @@ class AdaptiveAlertDialogApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
// Try this: set the platform to TargetPlatform.android and see the difference
theme: ThemeData(platform: TargetPlatform.iOS, useMaterial3: true),
theme: ThemeData(platform: TargetPlatform.iOS),
home: Scaffold(
appBar: AppBar(title: const Text('AlertDialog Sample')),
body: const Center(child: AdaptiveDialogExample()),

View File

@@ -14,7 +14,7 @@ class AlertDialogExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: Scaffold(
appBar: AppBar(title: const Text('AlertDialog Sample')),
body: const Center(child: DialogExample()),

View File

@@ -14,7 +14,7 @@ class ShowDialogExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const DialogExample(),
);
}

View File

@@ -14,7 +14,7 @@ class DividerExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: Scaffold(
appBar: AppBar(title: const Text('Divider Sample')),
body: const DividerExample(),

View File

@@ -14,7 +14,7 @@ class VerticalDividerExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: Scaffold(
appBar: AppBar(title: const Text('Divider Sample')),
body: const DividerExample(),

View File

@@ -13,7 +13,7 @@ class DrawerApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const DrawerExample());
return const MaterialApp(home: DrawerExample());
}
}

View File

@@ -77,7 +77,7 @@ class _DropdownMenuExampleState extends State<DropdownMenuExample> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: Colors.green),
theme: ThemeData(colorSchemeSeed: Colors.green),
home: Scaffold(
body: SafeArea(
child: Column(

View File

@@ -17,7 +17,6 @@ class DropdownMenuApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('DropdownMenu Sample')),
body: const Center(child: DropdownMenuExample()),

View File

@@ -14,7 +14,6 @@ class ExpansionTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('ExpansionTile Sample')),
body: const ExpansionTileExample(),

View File

@@ -23,7 +23,6 @@ class _ExpansionTileControllerAppState extends State<ExpansionTileControllerApp>
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('ExpansionTileController Sample')),
body: Column(

View File

@@ -16,7 +16,7 @@ class FilledButtonApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: Scaffold(
appBar: AppBar(title: const Text('FilledButton Sample')),
body: Center(

View File

@@ -16,7 +16,6 @@ class ChipApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('FilterChip Sample')),
body: const FilterChipExample(),

View File

@@ -15,10 +15,7 @@ class FloatingActionButtonExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const FloatingActionButtonExample(),
);
return const MaterialApp(home: FloatingActionButtonExample());
}
}

View File

@@ -13,10 +13,7 @@ class FloatingActionButtonExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const FloatingActionButtonExample(),
);
return const MaterialApp(home: FloatingActionButtonExample());
}
}

View File

@@ -13,10 +13,7 @@ class FloatingActionButtonExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const FloatingActionButtonExample(),
);
return const MaterialApp(home: FloatingActionButtonExample());
}
}

View File

@@ -16,7 +16,7 @@ class IconButtonApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
title: 'Icon Button Types',
home: const Scaffold(body: ButtonTypesExample()),
);

View File

@@ -16,7 +16,7 @@ class IconButtonToggleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
title: 'Icon Button Types',
home: const Scaffold(body: DemoIconToggleButtons()),
);

View File

@@ -14,7 +14,7 @@ class ChipApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const InputChipExample(),
);
}

View File

@@ -25,10 +25,7 @@ class EditableChipFieldApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const EditableChipFieldExample(),
);
return const MaterialApp(home: EditableChipFieldExample());
}
}

View File

@@ -14,7 +14,6 @@ class InputDecorationExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration Sample')),
body: const InputDecorationExample(),

View File

@@ -14,7 +14,6 @@ class InputDecorationExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration Sample')),
body: const InputDecorationExample(),

View File

@@ -14,7 +14,6 @@ class InputDecorationExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration Sample')),
body: const InputDecorationExample(),

View File

@@ -14,7 +14,6 @@ class InputDecorationExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration Sample')),
body: const InputDecorationExample(),

View File

@@ -14,7 +14,6 @@ class FloatingLabelStyleErrorExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecorator Sample')),
body: const Center(child: InputDecoratorExample()),

View File

@@ -14,7 +14,6 @@ class HelperExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration.helper Sample')),
body: const HelperExample(),

View File

@@ -14,7 +14,6 @@ class LabelExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration.label Sample')),
body: const LabelExample(),

View File

@@ -14,7 +14,6 @@ class LabelStyleErrorExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecorator Sample')),
body: const Center(child: InputDecoratorExample()),

View File

@@ -13,10 +13,7 @@ class PrefixIconExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const Scaffold(body: InputDecoratorExample()),
);
return const MaterialApp(home: Scaffold(body: InputDecoratorExample()));
}
}

View File

@@ -14,7 +14,6 @@ class PrefixIconConstraintsExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration Sample')),
body: const PrefixIconConstraintsExample(),

View File

@@ -13,10 +13,7 @@ class SuffixIconExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const Scaffold(body: InputDecoratorExample()),
);
return const MaterialApp(home: Scaffold(body: InputDecoratorExample()));
}
}

View File

@@ -14,7 +14,6 @@ class SuffixIconConstraintsExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration Sample')),
body: const SuffixIconConstraintsExample(),

View File

@@ -14,7 +14,6 @@ class MaterialStateExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration Sample')),
body: const MaterialStateExample(),

View File

@@ -14,7 +14,6 @@ class MaterialStateExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecoration Sample')),
body: const MaterialStateExample(),

View File

@@ -13,7 +13,7 @@ class CustomListItemApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const CustomListItemExample());
return const MaterialApp(home: CustomListItemExample());
}
}

View File

@@ -14,10 +14,7 @@ class ListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
listTileTheme: const ListTileThemeData(textColor: Colors.white),
useMaterial3: true,
),
theme: ThemeData(listTileTheme: const ListTileThemeData(textColor: Colors.white)),
home: const ListTileExample(),
);
}

View File

@@ -13,7 +13,7 @@ class ListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
return const MaterialApp(home: ListTileExample());
}
}

View File

@@ -13,7 +13,7 @@ class ListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
return const MaterialApp(home: ListTileExample());
}
}

View File

@@ -13,7 +13,7 @@ class ListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
return const MaterialApp(home: ListTileExample());
}
}

View File

@@ -13,7 +13,7 @@ class ListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
return const MaterialApp(home: ListTileExample());
}
}

View File

@@ -13,7 +13,7 @@ class ListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const ListTileExample());
return const MaterialApp(home: ListTileExample());
}
}

View File

@@ -253,9 +253,6 @@ class ContextMenuApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const Scaffold(body: MyContextMenu(message: kMessage)),
);
return const MaterialApp(home: Scaffold(body: MyContextMenu(message: kMessage)));
}
}

View File

@@ -112,9 +112,6 @@ class MenuApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const Scaffold(body: SafeArea(child: MyRadioMenu())),
);
return const MaterialApp(home: Scaffold(body: SafeArea(child: MyRadioMenu())));
}
}

View File

@@ -13,7 +13,7 @@ class NavigationBarApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const NavigationExample());
return const MaterialApp(home: NavigationExample());
}
}

View File

@@ -32,11 +32,7 @@ class NavigationDrawerApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(useMaterial3: true),
home: const NavigationDrawerExample(),
);
return const MaterialApp(debugShowCheckedModeBanner: false, home: NavigationDrawerExample());
}
}

View File

@@ -15,7 +15,6 @@ class PageTransitionsThemeApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
useMaterial3: true,
pageTransitionsTheme: const PageTransitionsTheme(
builders: <TargetPlatform, PageTransitionsBuilder>{
TargetPlatform.android: ZoomPageTransitionsBuilder(allowSnapshotting: false),

View File

@@ -17,7 +17,7 @@ class PopupMenuApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750a4)),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const PopupMenuExample(),
);
}

View File

@@ -14,7 +14,7 @@ class ProgressIndicatorExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750a4)),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: const ProgressIndicatorExample(),
);
}

View File

@@ -16,7 +16,6 @@ class LabeledRadioApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Custom Labeled Radio Sample')),
body: const LabeledRadioExample(),

View File

@@ -14,7 +14,6 @@ class LabeledRadioApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Custom Labeled Radio Sample')),
body: const LabeledRadioExample(),

View File

@@ -14,7 +14,6 @@ class RadioListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('RadioListTile Sample')),
body: const RadioListTileExample(),

View File

@@ -13,7 +13,7 @@ class RadioListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const RadioListTileExample());
return const MaterialApp(home: RadioListTileExample());
}
}

View File

@@ -14,7 +14,6 @@ class RadioListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('RadioListTile.toggleable Sample')),
body: const RadioListTileExample(),

View File

@@ -16,7 +16,6 @@ class ReorderableApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('ReorderableListView Sample')),
body: const ReorderableExample(),

View File

@@ -70,7 +70,7 @@ class _SearchBarAppState extends State<SearchBarApp> {
@override
Widget build(BuildContext context) {
final ThemeData themeData = ThemeData(useMaterial3: true, colorSchemeSeed: selectedColorSeed);
final ThemeData themeData = ThemeData(colorSchemeSeed: selectedColorSeed);
final ColorScheme colors = themeData.colorScheme;
return MaterialApp(

View File

@@ -21,7 +21,7 @@ class _PinnedSearchBarAppState extends State<PinnedSearchBarApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750a4)),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: Scaffold(
body: SafeArea(
child: CustomScrollView(

View File

@@ -20,10 +20,7 @@ class _SearchBarAppState extends State<SearchBarApp> {
@override
Widget build(BuildContext context) {
final ThemeData themeData = ThemeData(useMaterial3: true);
return MaterialApp(
theme: themeData,
home: Scaffold(
appBar: AppBar(title: const Text('Search Anchor Sample')),
body: Column(

View File

@@ -20,10 +20,7 @@ class _SearchBarAppState extends State<SearchBarApp> {
@override
Widget build(BuildContext context) {
final ThemeData themeData = ThemeData(
useMaterial3: true,
brightness: isDark ? Brightness.dark : Brightness.light,
);
final ThemeData themeData = ThemeData(brightness: isDark ? Brightness.dark : Brightness.light);
return MaterialApp(
theme: themeData,

View File

@@ -15,9 +15,8 @@ class SegmentedButtonApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const Scaffold(
return const MaterialApp(
home: Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

View File

@@ -16,10 +16,7 @@ class SelectionAreaSelectionListenerExampleApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple)),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}

View File

@@ -18,10 +18,7 @@ class SelectionAreaColorTextRedExampleApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple)),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}

View File

@@ -15,7 +15,7 @@ class SnackBarExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const SnackBarExample());
return const MaterialApp(home: SnackBarExample());
}
}

View File

@@ -14,7 +14,6 @@ class SwitchApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Switch Sample')),
body: const Center(child: SwitchExample()),

View File

@@ -14,7 +14,6 @@ class SwitchApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Switch Sample')),
body: const Center(child: SwitchExample()),

View File

@@ -14,7 +14,6 @@ class SwitchApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Switch Sample')),
body: const Center(child: SwitchExample()),

View File

@@ -15,7 +15,7 @@ class SwitchApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(useMaterial3: true).copyWith(
theme: ThemeData(
// Use the ambient CupertinoThemeData to style all widgets which would
// otherwise use iOS defaults.
cupertinoOverrideTheme: const CupertinoThemeData(applyThemeToAll: true),

View File

@@ -16,7 +16,6 @@ class LabeledSwitchApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Custom Labeled Switch Sample')),
body: const Center(child: LabeledSwitchExample()),

View File

@@ -14,7 +14,6 @@ class LabeledSwitchApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('Custom Labeled Switch Sample')),
body: const Center(child: LabeledSwitchExample()),

View File

@@ -14,7 +14,6 @@ class SwitchListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('SwitchListTile Sample')),
body: const Center(child: SwitchListTileExample()),

View File

@@ -14,7 +14,6 @@ class SwitchListTileApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('SwitchListTile Sample')),
body: const SwitchListTileExample(),

View File

@@ -13,7 +13,7 @@ class TabBarApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const TabBarExample());
return const MaterialApp(home: TabBarExample());
}
}

View File

@@ -13,7 +13,7 @@ class TabBarApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const TabBarExample());
return const MaterialApp(home: TabBarExample());
}
}

View File

@@ -13,7 +13,7 @@ class TabBarApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const TabBarExample());
return const MaterialApp(home: TabBarExample());
}
}

View File

@@ -16,7 +16,7 @@ class TextFieldExamplesApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4)),
home: Scaffold(
appBar: AppBar(title: const Text('TextField Examples')),
body: const Column(

View File

@@ -58,9 +58,9 @@ class _ThemeExtensionExampleAppState extends State<ThemeExtensionExampleApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light().copyWith(
extensions: <ThemeExtension<dynamic>>[
const MyColors(brandColor: Color(0xFF1E88E5), danger: Color(0xFFE53935)),
theme: ThemeData(
extensions: const <ThemeExtension<dynamic>>[
MyColors(brandColor: Color(0xFF1E88E5), danger: Color(0xFFE53935)),
],
),
darkTheme: ThemeData.dark().copyWith(

View File

@@ -19,10 +19,7 @@ class ToggleButtonsExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const ToggleButtonsSample(title: 'ToggleButtons Sample'),
);
return const MaterialApp(home: ToggleButtonsSample(title: 'ToggleButtons Sample'));
}
}

View File

@@ -14,10 +14,7 @@ class ToggleButtonsApp extends StatelessWidget {
const ToggleButtonsApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const Scaffold(body: ToggleButtonsExample()),
);
return const MaterialApp(home: Scaffold(body: ToggleButtonsExample()));
}
}

View File

@@ -15,9 +15,8 @@ class ExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(useMaterial3: true),
home: const Directionality(
return const MaterialApp(
home: Directionality(
// TRY THIS: Switch to TextDirection.rtl to see how the borders change.
textDirection: TextDirection.ltr,
child: Home(),

View File

@@ -16,10 +16,7 @@ class SystemOverlayStyleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, brightness: Brightness.light),
home: const SystemOverlayStyleExample(),
);
return const MaterialApp(home: SystemOverlayStyleExample());
}
}

View File

@@ -16,10 +16,7 @@ class SystemOverlayStyleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, brightness: Brightness.light),
home: const SystemOverlayStyleExample(),
);
return const MaterialApp(home: SystemOverlayStyleExample());
}
}

View File

@@ -13,7 +13,7 @@ class AnimatedSlideApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(theme: ThemeData(useMaterial3: true), home: const AnimatedSlideExample());
return const MaterialApp(home: AnimatedSlideExample());
}
}

View File

@@ -168,7 +168,6 @@ class RawMenuAnchorApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.from(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
dynamicSchemeVariant: DynamicSchemeVariant.vibrant,

View File

@@ -14,7 +14,6 @@ class ScrollNotificationObserverApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
// The Scaffold widget contains a [ScrollNotificationObserver].
// This is used by [AppBar] for its scrolled under behavior.
//

Some files were not shown because too many files have changed in this diff Show More