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,9 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Application Exit example', (WidgetTester tester) async {
await tester.pumpWidget(
const example.ApplicationExitExample(),
);
await tester.pumpWidget(const example.ApplicationExitExample());
expect(find.text('No exit requested yet'), findsOneWidget);
expect(find.text('Do Not Allow Exit'), findsOneWidget);

View File

@@ -8,9 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Responds to key', (WidgetTester tester) async {
await tester.pumpWidget(
const example.KeyExampleApp(),
);
await tester.pumpWidget(const example.KeyExampleApp());
await tester.tap(find.text('Click to focus'));
await tester.pumpAndSettle();

View File

@@ -8,9 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Responds to key', (WidgetTester tester) async {
await tester.pumpWidget(
const example.KeyExampleApp(),
);
await tester.pumpWidget(const example.KeyExampleApp());
await tester.tap(find.text('Click to focus'));
await tester.pumpAndSettle();

View File

@@ -8,13 +8,17 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Uses Text Cursor', (WidgetTester tester) async {
await tester.pumpWidget(
const example.MouseCursorExampleApp(),
);
await tester.pumpWidget(const example.MouseCursorExampleApp());
expect(find.byType(MouseRegion), findsNWidgets(2)); // There's one in the MaterialApp
final Finder mouseRegionFinder = find.ancestor(of: find.byType(Container), matching: find.byType(MouseRegion));
final Finder mouseRegionFinder = find.ancestor(
of: find.byType(Container),
matching: find.byType(MouseRegion),
);
expect(mouseRegionFinder, findsOneWidget);
expect((tester.widget(mouseRegionFinder) as MouseRegion).cursor, equals(SystemMouseCursors.text));
expect(
(tester.widget(mouseRegionFinder) as MouseRegion).cursor,
equals(SystemMouseCursors.text),
);
});
}

View File

@@ -4,14 +4,15 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_api_samples/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart' as example;
import 'package:flutter_api_samples/services/system_chrome/system_chrome.set_system_u_i_overlay_style.0.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('AppBar.systemOverlayStyle can change system overlays styles.', (WidgetTester tester) async {
await tester.pumpWidget(
const example.SystemOverlayStyleApp(),
);
testWidgets('AppBar.systemOverlayStyle can change system overlays styles.', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.SystemOverlayStyleApp());
final SystemUiOverlayStyle? firstStyle = SystemChrome.latestStyle;

View File

@@ -4,14 +4,13 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_api_samples/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart' as example;
import 'package:flutter_api_samples/services/system_chrome/system_chrome.set_system_u_i_overlay_style.1.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('AnnotatedRegion can change system overlays style.', (WidgetTester tester) async {
await tester.pumpWidget(
const example.SystemOverlayStyleApp(),
);
await tester.pumpWidget(const example.SystemOverlayStyleApp());
final SystemUiOverlayStyle? firstStyle = SystemChrome.latestStyle;

View File

@@ -4,8 +4,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_api_samples/services/text_input/text_input_control.0.dart'
as example;
import 'package:flutter_api_samples/services/text_input/text_input_control.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
@@ -13,27 +12,33 @@ void main() {
await tester.pumpWidget(const example.TextInputControlExampleApp());
await tester.pumpAndSettle();
await tester.tap(find.descendant(
of: find.byType(example.MyVirtualKeyboard),
matching: find.widgetWithText(ElevatedButton, 'A'),
));
await tester.tap(
find.descendant(
of: find.byType(example.MyVirtualKeyboard),
matching: find.widgetWithText(ElevatedButton, 'A'),
),
);
await tester.pumpAndSettle();
expect(find.widgetWithText(TextField, 'A'), findsOneWidget);
await tester.tap(find.descendant(
of: find.byType(example.MyVirtualKeyboard),
matching: find.widgetWithText(ElevatedButton, 'B'),
));
await tester.tap(
find.descendant(
of: find.byType(example.MyVirtualKeyboard),
matching: find.widgetWithText(ElevatedButton, 'B'),
),
);
await tester.pumpAndSettle();
expect(find.widgetWithText(TextField, 'AB'), findsOneWidget);
await tester.sendKeyEvent(LogicalKeyboardKey.arrowLeft);
await tester.pumpAndSettle();
await tester.tap(find.descendant(
of: find.byType(example.MyVirtualKeyboard),
matching: find.widgetWithText(ElevatedButton, 'C'),
));
await tester.tap(
find.descendant(
of: find.byType(example.MyVirtualKeyboard),
matching: find.widgetWithText(ElevatedButton, 'C'),
),
);
await tester.pumpAndSettle();
expect(find.widgetWithText(TextField, 'ACB'), findsOneWidget);
});