Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the `engine` subdirectory and enforces that these files stay formatted with a presubmit check. **Reviewers:** Please carefully review all the commits except for the one titled "formatted". The "formatted" commit was auto-generated by running `dev/tools/format.sh -a -f`. The other commits were hand-crafted to prepare the repo for the formatting change. I recommend reviewing the commits one-by-one via the "Commits" tab and avoiding Github's "Files changed" tab as it will likely slow down your browser because of the size of this PR. --------- Co-authored-by: Kate Lovett <katelovett@google.com> Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -19,9 +19,7 @@ class AdaptiveAlertDialogApp extends StatelessWidget {
|
||||
theme: ThemeData(platform: TargetPlatform.iOS, useMaterial3: true),
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('AlertDialog Sample')),
|
||||
body: const Center(
|
||||
child: AdaptiveDialogExample(),
|
||||
),
|
||||
body: const Center(child: AdaptiveDialogExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -33,7 +31,7 @@ class AdaptiveDialogExample extends StatelessWidget {
|
||||
Widget adaptiveAction({
|
||||
required BuildContext context,
|
||||
required VoidCallback onPressed,
|
||||
required Widget child
|
||||
required Widget child,
|
||||
}) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
switch (theme.platform) {
|
||||
@@ -51,25 +49,27 @@ class AdaptiveDialogExample extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
onPressed: () => showAdaptiveDialog<String>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertDialog.adaptive(
|
||||
title: const Text('AlertDialog Title'),
|
||||
content: const Text('AlertDialog description'),
|
||||
actions: <Widget>[
|
||||
adaptiveAction(
|
||||
context: context,
|
||||
onPressed: () => Navigator.pop(context, 'Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
adaptiveAction(
|
||||
context: context,
|
||||
onPressed: () => Navigator.pop(context, 'OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onPressed:
|
||||
() => showAdaptiveDialog<String>(
|
||||
context: context,
|
||||
builder:
|
||||
(BuildContext context) => AlertDialog.adaptive(
|
||||
title: const Text('AlertDialog Title'),
|
||||
content: const Text('AlertDialog description'),
|
||||
actions: <Widget>[
|
||||
adaptiveAction(
|
||||
context: context,
|
||||
onPressed: () => Navigator.pop(context, 'Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
adaptiveAction(
|
||||
context: context,
|
||||
onPressed: () => Navigator.pop(context, 'OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: const Text('Show Dialog'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ class AlertDialogExampleApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('AlertDialog Sample')),
|
||||
body: const Center(
|
||||
child: DialogExample(),
|
||||
),
|
||||
body: const Center(child: DialogExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -30,23 +28,25 @@ class DialogExample extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
onPressed: () => showDialog<String>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
title: const Text('AlertDialog Title'),
|
||||
content: const Text('AlertDialog description'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onPressed:
|
||||
() => showDialog<String>(
|
||||
context: context,
|
||||
builder:
|
||||
(BuildContext context) => AlertDialog(
|
||||
title: const Text('AlertDialog Title'),
|
||||
content: const Text('AlertDialog description'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: const Text('Show Dialog'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,9 +17,7 @@ class AlertDialogExampleApp extends StatelessWidget {
|
||||
theme: ThemeData(colorSchemeSeed: const Color(0xff6750a4), useMaterial3: true),
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('AlertDialog Sample')),
|
||||
body: const Center(
|
||||
child: DialogExample(),
|
||||
),
|
||||
body: const Center(child: DialogExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -31,23 +29,25 @@ class DialogExample extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
onPressed: () => showDialog<String>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
title: const Text('AlertDialog Title'),
|
||||
content: const Text('AlertDialog description'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onPressed:
|
||||
() => showDialog<String>(
|
||||
context: context,
|
||||
builder:
|
||||
(BuildContext context) => AlertDialog(
|
||||
title: const Text('AlertDialog Title'),
|
||||
content: const Text('AlertDialog description'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'Cancel'),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, 'OK'),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: const Text('Show Dialog'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,7 @@ class DialogExampleApp extends StatelessWidget {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('Dialog Sample')),
|
||||
body: const Center(
|
||||
child: DialogExample(),
|
||||
),
|
||||
body: const Center(child: DialogExample()),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -33,51 +31,55 @@ class DialogExample extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => showDialog<String>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => Dialog(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text('This is a typical dialog.'),
|
||||
const SizedBox(height: 15),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Close'),
|
||||
onPressed:
|
||||
() => showDialog<String>(
|
||||
context: context,
|
||||
builder:
|
||||
(BuildContext context) => Dialog(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text('This is a typical dialog.'),
|
||||
const SizedBox(height: 15),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Close'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: const Text('Show Dialog'),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextButton(
|
||||
onPressed: () => showDialog<String>(
|
||||
context: context,
|
||||
builder: (BuildContext context) => Dialog.fullscreen(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text('This is a fullscreen dialog.'),
|
||||
const SizedBox(height: 15),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Close'),
|
||||
),
|
||||
],
|
||||
onPressed:
|
||||
() => showDialog<String>(
|
||||
context: context,
|
||||
builder:
|
||||
(BuildContext context) => Dialog.fullscreen(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
const Text('This is a fullscreen dialog.'),
|
||||
const SizedBox(height: 15),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text('Close'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: const Text('Show Fullscreen Dialog'),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -13,9 +13,7 @@ class ShowDialogExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
home: DialogExample(),
|
||||
);
|
||||
return const MaterialApp(home: DialogExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,18 +47,14 @@ class DialogExample extends StatelessWidget {
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
textStyle: Theme.of(context).textTheme.labelLarge,
|
||||
),
|
||||
style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge),
|
||||
child: const Text('Disable'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
textStyle: Theme.of(context).textTheme.labelLarge,
|
||||
),
|
||||
style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge),
|
||||
child: const Text('Enable'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
@@ -50,18 +50,14 @@ class DialogExample extends StatelessWidget {
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
textStyle: Theme.of(context).textTheme.labelLarge,
|
||||
),
|
||||
style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge),
|
||||
child: const Text('Disable'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
textStyle: Theme.of(context).textTheme.labelLarge,
|
||||
),
|
||||
style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge),
|
||||
child: const Text('Enable'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
@@ -13,10 +13,7 @@ class ShowDialogExampleApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
restorationScopeId: 'app',
|
||||
home: DialogExample(),
|
||||
);
|
||||
return const MaterialApp(restorationScopeId: 'app', home: DialogExample());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,18 +50,14 @@ class DialogExample extends StatelessWidget {
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
textStyle: Theme.of(context).textTheme.labelLarge,
|
||||
),
|
||||
style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge),
|
||||
child: const Text('Disable'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
textStyle: Theme.of(context).textTheme.labelLarge,
|
||||
),
|
||||
style: TextButton.styleFrom(textStyle: Theme.of(context).textTheme.labelLarge),
|
||||
child: const Text('Enable'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
Reference in New Issue
Block a user