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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
227 changed files with 464 additions and 898 deletions

View File

@ -23,7 +23,7 @@ class ComplexLayoutAppState extends State<ComplexLayoutApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: lightTheme ? ThemeData.light() : ThemeData.dark(),
theme: lightTheme ? ThemeData() : ThemeData.dark(),
title: 'Advanced Layout',
home:
scrollMode == ScrollMode.complex

View File

@ -20,11 +20,7 @@ class PlatformViewApp extends StatefulWidget {
class PlatformViewAppState extends State<PlatformViewApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
title: 'Advanced Layout',
home: const PlatformViewLayout(),
);
return const MaterialApp(title: 'Advanced Layout', home: PlatformViewLayout());
}
}

View File

@ -40,7 +40,6 @@ class PlatformViewAppState extends State<PlatformViewApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
title: 'Advanced Layout',
home: Scaffold(
appBar: AppBar(title: const Text('Platform View Ad Banners')),

View File

@ -44,7 +44,6 @@ class PlatformViewAppState extends State<PlatformViewApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
title: 'Advanced Layout',
home: Scaffold(
appBar: AppBar(title: const Text('Platform View Bottom Ad Banner')),

View File

@ -22,11 +22,7 @@ class PlatformViewApp extends StatefulWidget {
class PlatformViewAppState extends State<PlatformViewApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
title: 'Advanced Layout',
home: const PlatformViewLayout(),
);
return const MaterialApp(title: 'Advanced Layout', home: PlatformViewLayout());
}
}

View File

@ -20,11 +20,7 @@ class PlatformViewApp extends StatefulWidget {
class PlatformViewAppState extends State<PlatformViewApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
title: 'Advanced Layout',
home: const PlatformViewLayout(),
);
return const MaterialApp(title: 'Advanced Layout', home: PlatformViewLayout());
}
}

View File

@ -24,11 +24,7 @@ class PlatformViewApp extends StatefulWidget {
class PlatformViewAppState extends State<PlatformViewApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.light(),
title: 'Advanced Layout',
home: const PlatformViewLayout(),
);
return const MaterialApp(title: 'Advanced Layout', home: PlatformViewLayout());
}
}

View File

@ -176,7 +176,7 @@ over water meant for the whole central valley of California? The story will shoc
final ThemeData _fortnightlyTheme = _buildFortnightlyTheme();
ThemeData _buildFortnightlyTheme() {
final ThemeData base = ThemeData.light();
final ThemeData base = ThemeData();
return base.copyWith(
primaryTextTheme: _buildTextTheme(base.primaryTextTheme),
scaffoldBackgroundColor: Colors.white,

View File

@ -81,7 +81,7 @@ IconThemeData _customIconTheme(IconThemeData original) {
}
ThemeData _buildShrineTheme() {
final ThemeData base = ThemeData.light();
final ThemeData base = ThemeData();
return base.copyWith(
colorScheme: kShrineColorScheme,
primaryColor: kShrinePink100,

View File

@ -15,7 +15,7 @@ IconThemeData _customIconTheme(IconThemeData original, Color color) {
}
ThemeData _buildCraneTheme() {
final ThemeData base = ThemeData.light();
final ThemeData base = ThemeData();
return base.copyWith(
colorScheme: const ColorScheme.light().copyWith(

View File

@ -509,7 +509,7 @@ List<Widget> buildVideoPreviewItems(BuildContext context) {
}
ThemeData buildTheme(BuildContext context) {
final TextTheme lightTextTheme = ThemeData.light().textTheme;
final TextTheme lightTextTheme = ThemeData().textTheme;
return ThemeData(
scaffoldBackgroundColor: Colors.white,
appBarTheme: AppBarTheme(

View File

@ -150,7 +150,7 @@ class _RestorableEmailState extends RestorableListenable<EmailStore> {
}
ThemeData _buildReplyLightTheme(BuildContext context) {
final ThemeData base = ThemeData.light();
final ThemeData base = ThemeData();
return base.copyWith(
bottomAppBarTheme: const BottomAppBarTheme(color: ReplyColors.blue700),
bottomSheetTheme: BottomSheetThemeData(

View File

@ -21,7 +21,7 @@ IconThemeData _customIconTheme(IconThemeData original) {
}
ThemeData _buildShrineTheme() {
final ThemeData base = ThemeData.light();
final ThemeData base = ThemeData();
return base.copyWith(
appBarTheme: const AppBarTheme(systemOverlayStyle: SystemUiOverlayStyle.dark, elevation: 0),
scaffoldBackgroundColor: shrineBackgroundWhite,

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(),

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