Skip to content

Commit 5491c8c

Browse files
goderbauerPiinksLongCatIsLooong
authored
Auto-format Framework (flutter#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 <[email protected]> Co-authored-by: LongCatIsLooong <[email protected]>
1 parent 8e0993e commit 5491c8c

File tree

4,411 files changed

+455815
-416698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,411 files changed

+455815
-416698
lines changed

.ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ targets:
393393
- name: Linux packages_autoroller
394394
presubmit: false
395395
recipe: pub_autoroller/pub_autoroller
396+
bringup: true # https://github.com/flutter/flutter/issues/160473
396397
# This takes a while because we need to fetch network dependencies and run
397398
# Gradle for every android app in the repo
398399
timeout: 45

.vscode/settings.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
// VSCode workspace settings that are shared among all users of this project.
22
// This only affects subdirectories of this project.
33
{
4-
// VSCode formats files on save by default. Since Flutter source code is
5-
// hand-formatted, the default settings are changed to prevent inadvertent
6-
// reformatting of code.
7-
"[dart]": {
8-
"editor.formatOnSave": false,
9-
"editor.formatOnType": false,
10-
"editor.formatOnPaste": false,
11-
},
12-
134
"html.format.enable": false,
145
"githubPullRequests.ignoredPullRequestBranches": [
156
"master"

dev/a11y_assessments/lib/common/dynamic_title.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ class DynamicTitle extends StatelessWidget {
1212

1313
@override
1414
Widget build(BuildContext context) {
15-
return Title(
16-
title: title,
17-
color: Theme.of(context).colorScheme.primary,
18-
child: child,
19-
);
15+
return Title(title: title, color: Theme.of(context).colorScheme.primary, child: child);
2016
}
2117
}

dev/a11y_assessments/lib/main.dart

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,26 @@ class App extends StatelessWidget {
2121
@override
2222
Widget build(BuildContext context) {
2323
final ThemeData lightTheme = ThemeData(
24-
colorScheme: ColorScheme.fromSeed(
25-
seedColor: const Color(0xff6750a4),
26-
contrastLevel: MediaQuery.highContrastOf(context) ? 1.0 : 0.0,
27-
));
24+
colorScheme: ColorScheme.fromSeed(
25+
seedColor: const Color(0xff6750a4),
26+
contrastLevel: MediaQuery.highContrastOf(context) ? 1.0 : 0.0,
27+
),
28+
);
2829
final ThemeData darkTheme = ThemeData(
29-
colorScheme: ColorScheme.fromSeed(
30-
brightness: Brightness.dark,
31-
seedColor: const Color(0xff6750a4),
32-
contrastLevel: MediaQuery.highContrastOf(context) ? 1.0 : 0.0,
33-
));
30+
colorScheme: ColorScheme.fromSeed(
31+
brightness: Brightness.dark,
32+
seedColor: const Color(0xff6750a4),
33+
contrastLevel: MediaQuery.highContrastOf(context) ? 1.0 : 0.0,
34+
),
35+
);
3436

35-
final Map<String, WidgetBuilder> routes =
36-
Map<String, WidgetBuilder>.fromEntries(
37-
useCases.map((UseCase useCase) =>
38-
MapEntry<String, WidgetBuilder>(useCase.route, (BuildContext context) => useCase.buildWithTitle(context))),
37+
final Map<String, WidgetBuilder> routes = Map<String, WidgetBuilder>.fromEntries(
38+
useCases.map(
39+
(UseCase useCase) => MapEntry<String, WidgetBuilder>(
40+
useCase.route,
41+
(BuildContext context) => useCase.buildWithTitle(context),
42+
),
43+
),
3944
);
4045

4146
return MaterialApp(
@@ -65,22 +70,25 @@ class HomePageState extends State<HomePage> {
6570

6671
Widget _buildUseCaseItem(int index, UseCase useCase) {
6772
return Padding(
68-
padding: const EdgeInsets.all(10),
69-
child: Builder(builder: (BuildContext context) {
73+
padding: const EdgeInsets.all(10),
74+
child: Builder(
75+
builder: (BuildContext context) {
7076
return TextButton(
7177
key: Key(useCase.name),
72-
onPressed: () => Navigator.of(context).pushNamed(useCase.route, arguments: useCase.name),
78+
onPressed:
79+
() => Navigator.of(context).pushNamed(useCase.route, arguments: useCase.name),
7380
child: Text(useCase.name),
7481
);
75-
}));
82+
},
83+
),
84+
);
7685
}
7786

7887
@override
7988
Widget build(BuildContext context) {
80-
8189
return Scaffold(
8290
appBar: AppBar(
83-
title: Semantics(headingLevel: 1, child: const Text('Accessibility Assessments')),
91+
title: Semantics(headingLevel: 1, child: const Text('Accessibility Assessments')),
8492
),
8593
body: Center(
8694
child: ListView(

dev/a11y_assessments/lib/use_cases/action_chip.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class MainWidgetState extends State<MainWidget> {
3434
return Scaffold(
3535
appBar: AppBar(
3636
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
37-
title: Semantics(headingLevel:1, child: Text('$pageTitle Demo')),
37+
title: Semantics(headingLevel: 1, child: Text('$pageTitle Demo')),
3838
),
3939
body: Center(
4040
child: Column(
@@ -45,10 +45,7 @@ class MainWidgetState extends State<MainWidget> {
4545
label: const Text('Action'),
4646
onPressed: () {},
4747
),
48-
const ActionChip(
49-
avatar: Icon(Icons.favorite),
50-
label: Text('Action'),
51-
),
48+
const ActionChip(avatar: Icon(Icons.favorite), label: Text('Action')),
5249
],
5350
),
5451
),

dev/a11y_assessments/lib/use_cases/app_bar.dart

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -36,63 +36,58 @@ class MainWidgetState extends State<MainWidget> {
3636
@override
3737
Widget build(BuildContext context) {
3838
return Scaffold(
39-
appBar: <PreferredSizeWidget>[
40-
AppBar(
41-
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
42-
title: Semantics(headingLevel: 1, child: const Text('AppBar')),
43-
),
44-
AppBar(
45-
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
46-
title: Semantics(headingLevel: 1, child: const Text('AppBar')),
47-
actions: <Widget>[
48-
IconButton(
49-
icon: const Icon(Icons.add_alert),
50-
tooltip: 'Show Snackbar',
51-
onPressed: () {
52-
ScaffoldMessenger.of(context).showSnackBar(
53-
const SnackBar(content: Text('This is a snackbar')));
54-
},
39+
appBar:
40+
<PreferredSizeWidget>[
41+
AppBar(
42+
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
43+
title: Semantics(headingLevel: 1, child: const Text('AppBar')),
5544
),
56-
IconButton(
57-
icon: const Icon(Icons.navigate_next),
58-
tooltip: 'Go to the next page',
59-
onPressed: () {
60-
Navigator.push(context, MaterialPageRoute<void>(
61-
builder: (BuildContext context) {
62-
return Scaffold(
63-
appBar: AppBar(
64-
backgroundColor:
65-
Theme.of(context).colorScheme.inversePrimary,
66-
title: Semantics(headingLevel: 1, child: const Text('Next Page')),
67-
),
68-
body: const Center(
69-
child: Text(
70-
'This is the next page',
71-
style: TextStyle(fontSize: 24),
72-
),
45+
AppBar(
46+
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
47+
title: Semantics(headingLevel: 1, child: const Text('AppBar')),
48+
actions: <Widget>[
49+
IconButton(
50+
icon: const Icon(Icons.add_alert),
51+
tooltip: 'Show Snackbar',
52+
onPressed: () {
53+
ScaffoldMessenger.of(
54+
context,
55+
).showSnackBar(const SnackBar(content: Text('This is a snackbar')));
56+
},
57+
),
58+
IconButton(
59+
icon: const Icon(Icons.navigate_next),
60+
tooltip: 'Go to the next page',
61+
onPressed: () {
62+
Navigator.push(
63+
context,
64+
MaterialPageRoute<void>(
65+
builder: (BuildContext context) {
66+
return Scaffold(
67+
appBar: AppBar(
68+
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
69+
title: Semantics(headingLevel: 1, child: const Text('Next Page')),
70+
),
71+
body: const Center(
72+
child: Text('This is the next page', style: TextStyle(fontSize: 24)),
73+
),
74+
);
75+
},
7376
),
7477
);
7578
},
76-
));
77-
},
78-
),
79-
],
80-
),
81-
AppBar(
82-
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
83-
title: Semantics(headingLevel: 1, child: const Text('AppBar')),
84-
actions: <Widget>[
85-
TextButton(
86-
onPressed: () {},
87-
child: const Text('Action 1'),
79+
),
80+
],
8881
),
89-
TextButton(
90-
onPressed: () {},
91-
child: const Text('Action 2'),
82+
AppBar(
83+
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
84+
title: Semantics(headingLevel: 1, child: const Text('AppBar')),
85+
actions: <Widget>[
86+
TextButton(onPressed: () {}, child: const Text('Action 1')),
87+
TextButton(onPressed: () {}, child: const Text('Action 2')),
88+
],
9289
),
93-
],
94-
),
95-
][currentIndex],
90+
][currentIndex],
9691
body: ListView(
9792
children: <Widget>[
9893
RadioListTile<int>(

dev/a11y_assessments/lib/use_cases/auto_complete.dart

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,14 @@ class _MainWidget extends StatefulWidget {
2525
}
2626

2727
class _MainWidgetState extends State<_MainWidget> {
28-
static const List<String> _kOptions = <String>[
29-
'apple',
30-
'banana',
31-
'lemon',
32-
];
28+
static const List<String> _kOptions = <String>['apple', 'banana', 'lemon'];
3329

3430
static Widget _fieldViewBuilder(
35-
BuildContext context,
36-
TextEditingController textEditingController,
37-
FocusNode focusNode,
38-
VoidCallback onFieldSubmitted) {
31+
BuildContext context,
32+
TextEditingController textEditingController,
33+
FocusNode focusNode,
34+
VoidCallback onFieldSubmitted,
35+
) {
3936
return TextFormField(
4037
focusNode: focusNode,
4138
controller: textEditingController,
@@ -58,8 +55,7 @@ class _MainWidgetState extends State<_MainWidget> {
5855
child: Column(
5956
mainAxisAlignment: MainAxisAlignment.center,
6057
children: <Widget>[
61-
Text(
62-
'Type below to autocomplete the following possible results: $_kOptions.'),
58+
Text('Type below to autocomplete the following possible results: $_kOptions.'),
6359
Autocomplete<String>(
6460
optionsBuilder: (TextEditingValue textEditingValue) {
6561
if (textEditingValue.text == '') {

dev/a11y_assessments/lib/use_cases/badge.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ class MainWidgetState extends State<MainWidget> {
3636
),
3737
body: const Center(
3838
child: Badge(
39-
label: Text(
40-
'5',
41-
semanticsLabel: '5 new messages',
42-
style: TextStyle(color: Colors.white),
43-
),
39+
label: Text('5', semanticsLabel: '5 new messages', style: TextStyle(color: Colors.white)),
4440
backgroundColor: Colors.green,
4541
child: Icon(Icons.mail, semanticLabel: 'Messages'),
4642
),

dev/a11y_assessments/lib/use_cases/card.dart

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ class MainWidgetState extends State<MainWidget> {
4040
child: Column(
4141
mainAxisAlignment: MainAxisAlignment.center,
4242
children: <Widget>[
43-
Card(
44-
child: Padding(
45-
padding: EdgeInsets.all(16),
46-
child: Text('Card'),
47-
),
48-
),
43+
Card(child: Padding(padding: EdgeInsets.all(16), child: Text('Card'))),
4944
],
5045
),
5146
),

dev/a11y_assessments/lib/use_cases/check_box_list_tile.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ class _MainWidgetState extends State<_MainWidget> {
3030
@override
3131
Widget build(BuildContext context) {
3232
return Scaffold(
33-
appBar: AppBar(
34-
title: Semantics(headingLevel: 1, child: Text('$pageTitle Demo')),
35-
),
33+
appBar: AppBar(title: Semantics(headingLevel: 1, child: Text('$pageTitle Demo'))),
3634
body: ListView(
3735
children: <Widget>[
3836
CheckboxListTile(

dev/a11y_assessments/lib/use_cases/date_picker.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class _MainWidget extends StatefulWidget {
2525
}
2626

2727
class _MainWidgetState extends State<_MainWidget> {
28-
2928
String pageTitle = getUseCaseName(DatePickerUseCase());
3029

3130
@override
@@ -37,13 +36,14 @@ class _MainWidgetState extends State<_MainWidget> {
3736
),
3837
body: Center(
3938
child: TextButton(
40-
onPressed: () => showDatePicker(
41-
context: context,
42-
initialEntryMode: DatePickerEntryMode.calendarOnly,
43-
initialDate: DateTime.now(),
44-
firstDate: DateTime.now().subtract(const Duration(days: 365)),
45-
lastDate: DateTime.now().add(const Duration(days: 365)),
46-
),
39+
onPressed:
40+
() => showDatePicker(
41+
context: context,
42+
initialEntryMode: DatePickerEntryMode.calendarOnly,
43+
initialDate: DateTime.now(),
44+
firstDate: DateTime.now().subtract(const Duration(days: 365)),
45+
lastDate: DateTime.now().add(const Duration(days: 365)),
46+
),
4747
child: const Text('Show Date Picker'),
4848
),
4949
),

0 commit comments

Comments
 (0)