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

@@ -7,14 +7,12 @@ import 'package:flutter_api_samples/material/toggle_buttons/toggle_buttons.0.dar
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Single-select ToggleButtons', (WidgetTester tester) async {
TextButton findButton(String text) {
return tester.widget<TextButton>(find.widgetWithText(TextButton, text));
}
await tester.pumpWidget(
const example.ToggleButtonsExampleApp(),
);
await tester.pumpWidget(const example.ToggleButtonsExampleApp());
TextButton firstButton = findButton('Apple');
TextButton secondButton = findButton('Banana');
@@ -46,9 +44,8 @@ void main() {
TextButton findButton(String text) {
return tester.widget<TextButton>(find.widgetWithText(TextButton, text));
}
await tester.pumpWidget(
const example.ToggleButtonsExampleApp(),
);
await tester.pumpWidget(const example.ToggleButtonsExampleApp());
TextButton firstButton = findButton('Tomatoes');
TextButton secondButton = findButton('Potatoes');
@@ -81,18 +78,16 @@ void main() {
TextButton findButton(IconData iconData) {
return tester.widget<TextButton>(find.widgetWithIcon(TextButton, iconData));
}
await tester.pumpWidget(
const example.ToggleButtonsExampleApp(),
);
await tester.pumpWidget(const example.ToggleButtonsExampleApp());
TextButton firstButton = findButton(Icons.sunny);
TextButton secondButton = findButton(Icons.cloud);
TextButton thirdButton = findButton(Icons.ac_unit);
const Color selectedColor = Color(0xff90caf9);
const Color selectedColor = Color(0xff90caf9);
const Color unselectedColor = Color(0x00fef7ff);
/// Third button is selected.
expect(firstButton.style!.backgroundColor!.resolve(enabled), unselectedColor);
expect(secondButton.style!.backgroundColor!.resolve(enabled), unselectedColor);
@@ -113,4 +108,4 @@ void main() {
});
}
Set<MaterialState> enabled = <MaterialState>{ };
Set<MaterialState> enabled = <MaterialState>{};

View File

@@ -81,14 +81,12 @@ void main() {
await tester.pumpWidget(const example.ToggleButtonsApp());
Material segmentMButton = tester.widget<Material>(find.descendant(
of: findButton('M'),
matching: find.byType(Material),
));
Material segmentXLButton = tester.widget<Material>(find.descendant(
of: findButton('XL'),
matching: find.byType(Material),
));
Material segmentMButton = tester.widget<Material>(
find.descendant(of: findButton('M'), matching: find.byType(Material)),
);
Material segmentXLButton = tester.widget<Material>(
find.descendant(of: findButton('XL'), matching: find.byType(Material)),
);
// Initially, only M is selected.
expect(segmentMButton.color, theme.colorScheme.secondaryContainer);
@@ -99,14 +97,12 @@ void main() {
await tester.pumpAndSettle();
// // Now both M and XL are selected.
segmentMButton = tester.widget<Material>(find.descendant(
of: findButton('M'),
matching: find.byType(Material),
));
segmentXLButton = tester.widget<Material>(find.descendant(
of: findButton('XL'),
matching: find.byType(Material),
));
segmentMButton = tester.widget<Material>(
find.descendant(of: findButton('M'), matching: find.byType(Material)),
);
segmentXLButton = tester.widget<Material>(
find.descendant(of: findButton('XL'), matching: find.byType(Material)),
);
expect(segmentMButton.color, theme.colorScheme.secondaryContainer);
expect(segmentXLButton.color, theme.colorScheme.secondaryContainer);
@@ -120,18 +116,16 @@ void main() {
await tester.pumpAndSettle();
// Now neither M nor XL are selected.
segmentMButton = tester.widget<Material>(find.descendant(
of: findButton('M'),
matching: find.byType(Material),
));
segmentXLButton = tester.widget<Material>(find.descendant(
of: findButton('XL'),
matching: find.byType(Material),
));
segmentMButton = tester.widget<Material>(
find.descendant(of: findButton('M'), matching: find.byType(Material)),
);
segmentXLButton = tester.widget<Material>(
find.descendant(of: findButton('XL'), matching: find.byType(Material)),
);
expect(segmentMButton.color, Colors.transparent);
expect(segmentXLButton.color, Colors.transparent);
});
}
Set<MaterialState> enabled = <MaterialState>{ };
Set<MaterialState> enabled = <MaterialState>{};