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:
Michael Goderbauer
2024-12-19 12:06:21 -08:00
committed by GitHub
parent 8e0993eda8
commit 5491c8c146
4411 changed files with 455108 additions and 415991 deletions

View File

@@ -15,12 +15,8 @@ class AutocompleteExampleApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('RawAutocomplete Basic'),
),
body: const Center(
child: AutocompleteBasicExample(),
),
appBar: AppBar(title: const Text('RawAutocomplete Basic')),
body: const Center(child: AutocompleteBasicExample()),
),
);
}
@@ -29,11 +25,7 @@ class AutocompleteExampleApp extends StatelessWidget {
class AutocompleteBasicExample extends StatelessWidget {
const AutocompleteBasicExample({super.key});
static const List<String> _options = <String>[
'aardvark',
'bobcat',
'chameleon',
];
static const List<String> _options = <String>['aardvark', 'bobcat', 'chameleon'];
@override
Widget build(BuildContext context) {
@@ -77,9 +69,7 @@ class AutocompleteBasicExample extends StatelessWidget {
onTap: () {
onSelected(option);
},
child: ListTile(
title: Text(option),
),
child: ListTile(title: Text(option)),
);
},
),

View File

@@ -15,12 +15,8 @@ class AutocompleteExampleApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('RawAutocomplete Custom Type'),
),
body: const Center(
child: AutocompleteCustomTypeExample(),
),
appBar: AppBar(title: const Text('RawAutocomplete Custom Type')),
body: const Center(child: AutocompleteCustomTypeExample()),
),
);
}
@@ -29,10 +25,7 @@ class AutocompleteExampleApp extends StatelessWidget {
// An example of a type that someone might want to autocomplete a list of.
@immutable
class User {
const User({
required this.email,
required this.name,
});
const User({required this.email, required this.name});
final String email;
final String name;
@@ -90,7 +83,11 @@ class AutocompleteCustomTypeExample extends StatelessWidget {
},
);
},
optionsViewBuilder: (BuildContext context, AutocompleteOnSelected<User> onSelected, Iterable<User> options) {
optionsViewBuilder: (
BuildContext context,
AutocompleteOnSelected<User> onSelected,
Iterable<User> options,
) {
return Align(
alignment: Alignment.topLeft,
child: Material(
@@ -106,9 +103,7 @@ class AutocompleteCustomTypeExample extends StatelessWidget {
onTap: () {
onSelected(option);
},
child: ListTile(
title: Text(_displayStringForOption(option)),
),
child: ListTile(title: Text(_displayStringForOption(option))),
);
},
),

View File

@@ -15,12 +15,8 @@ class AutocompleteExampleApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('RawAutocomplete Form'),
),
body: const Center(
child: AutocompleteFormExample(),
),
appBar: AppBar(title: const Text('RawAutocomplete Form')),
body: const Center(child: AutocompleteFormExample()),
),
);
}
@@ -39,11 +35,7 @@ class AutocompleteFormExampleState extends State<AutocompleteFormExample> {
String? _dropdownValue;
String? _autocompleteSelection;
static const List<String> _options = <String>[
'aardvark',
'bobcat',
'chameleon',
];
static const List<String> _options = <String>['aardvark', 'bobcat', 'chameleon'];
@override
Widget build(BuildContext context) {
@@ -62,12 +54,12 @@ class AutocompleteFormExampleState extends State<AutocompleteFormExample> {
_dropdownValue = newValue;
});
},
items: <String>['One', 'Two', 'Free', 'Four'].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
items:
<String>['One', 'Two', 'Free', 'Four'].map<DropdownMenuItem<String>>((
String value,
) {
return DropdownMenuItem<String>(value: value, child: Text(value));
}).toList(),
validator: (String? value) {
if (value == null) {
return 'Must make a selection.';
@@ -77,9 +69,7 @@ class AutocompleteFormExampleState extends State<AutocompleteFormExample> {
),
TextFormField(
controller: _textEditingController,
decoration: const InputDecoration(
hintText: 'This is a regular TextFormField',
),
decoration: const InputDecoration(hintText: 'This is a regular TextFormField'),
validator: (String? value) {
if (value == null || value.isEmpty) {
return "Can't be empty.";
@@ -106,9 +96,7 @@ class AutocompleteFormExampleState extends State<AutocompleteFormExample> {
) {
return TextFormField(
controller: textEditingController,
decoration: const InputDecoration(
hintText: 'This is a RawAutocomplete!',
),
decoration: const InputDecoration(hintText: 'This is a RawAutocomplete!'),
focusNode: focusNode,
onFieldSubmitted: (String value) {
onFieldSubmitted();
@@ -141,9 +129,7 @@ class AutocompleteFormExampleState extends State<AutocompleteFormExample> {
onTap: () {
onSelected(option);
},
child: ListTile(
title: Text(option),
),
child: ListTile(title: Text(option)),
);
},
),

View File

@@ -13,17 +13,11 @@ class AutocompleteExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: RawAutocompleteSplit(),
);
return const MaterialApp(home: RawAutocompleteSplit());
}
}
const List<String> _options = <String>[
'aardvark',
'bobcat',
'chameleon',
];
const List<String> _options = <String>['aardvark', 'bobcat', 'chameleon'];
class RawAutocompleteSplit extends StatefulWidget {
const RawAutocompleteSplit({super.key});
@@ -45,9 +39,7 @@ class RawAutocompleteSplitState extends State<RawAutocompleteSplit> {
title: TextFormField(
controller: _textEditingController,
focusNode: _focusNode,
decoration: const InputDecoration(
hintText: 'Split RawAutocomplete App',
),
decoration: const InputDecoration(hintText: 'Split RawAutocomplete App'),
onFieldSubmitted: (String value) {
RawAutocomplete.onFieldSubmitted<String>(_autocompleteKey);
},
@@ -72,16 +64,17 @@ class RawAutocompleteSplitState extends State<RawAutocompleteSplit> {
return Material(
elevation: 4.0,
child: ListView(
children: options
.map((String option) => GestureDetector(
onTap: () {
onSelected(option);
},
child: ListTile(
title: Text(option),
children:
options
.map(
(String option) => GestureDetector(
onTap: () {
onSelected(option);
},
child: ListTile(title: Text(option)),
),
))
.toList(),
)
.toList(),
),
);
},