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
@@ -64,10 +64,7 @@ class CollectPersonalInfoPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
class ChooseCredentialsPage extends StatelessWidget {
|
||||
const ChooseCredentialsPage({
|
||||
super.key,
|
||||
required this.onSignupComplete,
|
||||
});
|
||||
const ChooseCredentialsPage({super.key, required this.onSignupComplete});
|
||||
|
||||
final VoidCallback onSignupComplete;
|
||||
|
||||
@@ -106,7 +103,8 @@ class SignUpPage extends StatelessWidget {
|
||||
case 'signup/choose_credentials':
|
||||
// Assume ChooseCredentialsPage collects new credentials and then
|
||||
// invokes 'onSignupComplete()'.
|
||||
builder = (BuildContext _) => ChooseCredentialsPage(
|
||||
builder =
|
||||
(BuildContext _) => ChooseCredentialsPage(
|
||||
onSignupComplete: () {
|
||||
// Referencing Navigator.of(context) from here refers to the
|
||||
// top level Navigator because SignUpPage is above the
|
||||
|
||||
@@ -15,10 +15,7 @@ class RestorablePushExampleApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return const RootRestorationScope(
|
||||
restorationId: 'app',
|
||||
child: MaterialApp(
|
||||
restorationScopeId: 'app',
|
||||
home: RestorablePushExample(),
|
||||
),
|
||||
child: MaterialApp(restorationScopeId: 'app', home: RestorablePushExample()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -42,9 +39,7 @@ class _RestorablePushExampleState extends State<RestorablePushExample> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sample Code'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Sample Code')),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => Navigator.restorablePush(context, _myRouteBuilder),
|
||||
tooltip: 'Increment Counter',
|
||||
|
||||
@@ -15,10 +15,7 @@ class RestorablePushAndRemoveUntilExampleApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return const RootRestorationScope(
|
||||
restorationId: 'app',
|
||||
child: MaterialApp(
|
||||
restorationScopeId: 'app',
|
||||
home: RestorablePushAndRemoveUntilExample(),
|
||||
),
|
||||
child: MaterialApp(restorationScopeId: 'app', home: RestorablePushAndRemoveUntilExample()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +24,8 @@ class RestorablePushAndRemoveUntilExample extends StatefulWidget {
|
||||
const RestorablePushAndRemoveUntilExample({super.key});
|
||||
|
||||
@override
|
||||
State<RestorablePushAndRemoveUntilExample> createState() => _RestorablePushAndRemoveUntilExampleState();
|
||||
State<RestorablePushAndRemoveUntilExample> createState() =>
|
||||
_RestorablePushAndRemoveUntilExampleState();
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
@@ -42,15 +40,14 @@ class _RestorablePushAndRemoveUntilExampleState extends State<RestorablePushAndR
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sample Code'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Sample Code')),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => Navigator.restorablePushAndRemoveUntil(
|
||||
context,
|
||||
_myRouteBuilder,
|
||||
ModalRoute.withName('/'),
|
||||
),
|
||||
onPressed:
|
||||
() => Navigator.restorablePushAndRemoveUntil(
|
||||
context,
|
||||
_myRouteBuilder,
|
||||
ModalRoute.withName('/'),
|
||||
),
|
||||
tooltip: 'Increment Counter',
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
|
||||
@@ -15,19 +15,13 @@ class RestorablePushReplacementExampleApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return const RootRestorationScope(
|
||||
restorationId: 'app',
|
||||
child: MaterialApp(
|
||||
restorationScopeId: 'app',
|
||||
home: RestorablePushReplacementExample(),
|
||||
),
|
||||
child: MaterialApp(restorationScopeId: 'app', home: RestorablePushReplacementExample()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RestorablePushReplacementExample extends StatefulWidget {
|
||||
const RestorablePushReplacementExample({
|
||||
this.wasPushed = false,
|
||||
super.key,
|
||||
});
|
||||
const RestorablePushReplacementExample({this.wasPushed = false, super.key});
|
||||
|
||||
final bool wasPushed;
|
||||
|
||||
@@ -40,22 +34,19 @@ class _RestorablePushReplacementExampleState extends State<RestorablePushReplace
|
||||
@pragma('vm:entry-point')
|
||||
static Route<void> _myRouteBuilder(BuildContext context, Object? arguments) {
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (BuildContext context) => const RestorablePushReplacementExample(
|
||||
wasPushed: true,
|
||||
),
|
||||
builder: (BuildContext context) => const RestorablePushReplacementExample(wasPushed: true),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sample Code'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Sample Code')),
|
||||
body: Center(
|
||||
child: widget.wasPushed
|
||||
? const Text('This is a new route.')
|
||||
: const Text('This is the initial route.'),
|
||||
child:
|
||||
widget.wasPushed
|
||||
? const Text('This is a new route.')
|
||||
: const Text('This is the initial route.'),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => Navigator.restorablePushReplacement(context, _myRouteBuilder),
|
||||
|
||||
@@ -15,10 +15,7 @@ class RestorablePushExampleApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return const RootRestorationScope(
|
||||
restorationId: 'app',
|
||||
child: MaterialApp(
|
||||
restorationScopeId: 'app',
|
||||
home: RestorablePushExample(),
|
||||
),
|
||||
child: MaterialApp(restorationScopeId: 'app', home: RestorablePushExample()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -42,9 +39,7 @@ class _RestorablePushExampleState extends State<RestorablePushExample> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sample Code'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Sample Code')),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => Navigator.of(context).restorablePush(_myRouteBuilder),
|
||||
tooltip: 'Increment Counter',
|
||||
|
||||
@@ -15,10 +15,7 @@ class RestorablePushAndRemoveUntilExampleApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return const RootRestorationScope(
|
||||
restorationId: 'app',
|
||||
child: MaterialApp(
|
||||
restorationScopeId: 'app',
|
||||
home: RestorablePushAndRemoveUntilExample(),
|
||||
),
|
||||
child: MaterialApp(restorationScopeId: 'app', home: RestorablePushAndRemoveUntilExample()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +24,8 @@ class RestorablePushAndRemoveUntilExample extends StatefulWidget {
|
||||
const RestorablePushAndRemoveUntilExample({super.key});
|
||||
|
||||
@override
|
||||
State<RestorablePushAndRemoveUntilExample> createState() => _RestorablePushAndRemoveUntilExampleState();
|
||||
State<RestorablePushAndRemoveUntilExample> createState() =>
|
||||
_RestorablePushAndRemoveUntilExampleState();
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
@@ -42,14 +40,12 @@ class _RestorablePushAndRemoveUntilExampleState extends State<RestorablePushAndR
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sample Code'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Sample Code')),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => Navigator.of(context).restorablePushAndRemoveUntil(
|
||||
_myRouteBuilder,
|
||||
ModalRoute.withName('/'),
|
||||
),
|
||||
onPressed:
|
||||
() => Navigator.of(
|
||||
context,
|
||||
).restorablePushAndRemoveUntil(_myRouteBuilder, ModalRoute.withName('/')),
|
||||
tooltip: 'Increment Counter',
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
|
||||
@@ -15,19 +15,13 @@ class RestorablePushReplacementExampleApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return const RootRestorationScope(
|
||||
restorationId: 'app',
|
||||
child: MaterialApp(
|
||||
restorationScopeId: 'app',
|
||||
home: RestorablePushReplacementExample(),
|
||||
),
|
||||
child: MaterialApp(restorationScopeId: 'app', home: RestorablePushReplacementExample()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class RestorablePushReplacementExample extends StatefulWidget {
|
||||
const RestorablePushReplacementExample({
|
||||
this.wasPushed = false,
|
||||
super.key,
|
||||
});
|
||||
const RestorablePushReplacementExample({this.wasPushed = false, super.key});
|
||||
|
||||
final bool wasPushed;
|
||||
|
||||
@@ -40,27 +34,22 @@ class _RestorablePushReplacementExampleState extends State<RestorablePushReplace
|
||||
@pragma('vm:entry-point')
|
||||
static Route<void> _myRouteBuilder(BuildContext context, Object? arguments) {
|
||||
return MaterialPageRoute<void>(
|
||||
builder: (BuildContext context) => const RestorablePushReplacementExample(
|
||||
wasPushed: true,
|
||||
),
|
||||
builder: (BuildContext context) => const RestorablePushReplacementExample(wasPushed: true),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sample Code'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Sample Code')),
|
||||
body: Center(
|
||||
child: widget.wasPushed
|
||||
? const Text('This is a new route.')
|
||||
: const Text('This is the initial route.'),
|
||||
child:
|
||||
widget.wasPushed
|
||||
? const Text('This is a new route.')
|
||||
: const Text('This is the initial route.'),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () => Navigator.of(context).restorablePushReplacement(
|
||||
_myRouteBuilder,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).restorablePushReplacement(_myRouteBuilder),
|
||||
tooltip: 'Increment Counter',
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
|
||||
@@ -41,20 +41,20 @@ class _MyHomeState extends State<MyHome> with RestorationMixin {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_counterRoute = RestorableRouteFuture<int>(onPresent: (NavigatorState navigator, Object? arguments) {
|
||||
// Defines what route should be shown (and how it should be added
|
||||
// to the navigator) when `RestorableRouteFuture.present` is called.
|
||||
return navigator.restorablePush(
|
||||
_counterRouteBuilder,
|
||||
arguments: arguments,
|
||||
);
|
||||
}, onComplete: (int count) {
|
||||
// Defines what should happen with the return value when the route
|
||||
// completes.
|
||||
setState(() {
|
||||
_lastCount.value = count;
|
||||
});
|
||||
});
|
||||
_counterRoute = RestorableRouteFuture<int>(
|
||||
onPresent: (NavigatorState navigator, Object? arguments) {
|
||||
// Defines what route should be shown (and how it should be added
|
||||
// to the navigator) when `RestorableRouteFuture.present` is called.
|
||||
return navigator.restorablePush(_counterRouteBuilder, arguments: arguments);
|
||||
},
|
||||
onComplete: (int count) {
|
||||
// Defines what should happen with the return value when the route
|
||||
// completes.
|
||||
setState(() {
|
||||
_lastCount.value = count;
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -76,9 +76,7 @@ class _MyHomeState extends State<MyHome> with RestorationMixin {
|
||||
@pragma('vm:entry-point')
|
||||
static Route<int> _counterRouteBuilder(BuildContext context, Object? arguments) {
|
||||
return MaterialPageRoute<int>(
|
||||
builder: (BuildContext context) => MyCounter(
|
||||
title: arguments!.toString(),
|
||||
),
|
||||
builder: (BuildContext context) => MyCounter(title: arguments!.toString()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -141,9 +139,7 @@ class _MyCounterState extends State<MyCounter> with RestorationMixin {
|
||||
},
|
||||
),
|
||||
),
|
||||
body: Center(
|
||||
child: Text('Count: ${_count.value}'),
|
||||
),
|
||||
body: Center(child: Text('Count: ${_count.value}')),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.add),
|
||||
onPressed: () {
|
||||
|
||||
Reference in New Issue
Block a user