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

@@ -21,10 +21,10 @@ void main() {
});
}
testWidgets('FilterChip displays the blue colored border when hovered', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStateBorderSideExampleApp(),
);
testWidgets('FilterChip displays the blue colored border when hovered', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.WidgetStateBorderSideExampleApp());
// Hover over the FilterChip.
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
@@ -35,10 +35,10 @@ void main() {
expect(findByBorderColor(Colors.blue), findsOneWidget);
});
testWidgets('FilterChip displays the green colored border when pressed', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStateBorderSideExampleApp(),
);
testWidgets('FilterChip displays the green colored border when pressed', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.WidgetStateBorderSideExampleApp());
// Press on the FilterChip.
final TestGesture gesture = await tester.createGesture();
@@ -49,18 +49,18 @@ void main() {
expect(findByBorderColor(Colors.green), findsOneWidget);
});
testWidgets('FilterChip displays the red colored border when selected', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStateBorderSideExampleApp(),
);
testWidgets('FilterChip displays the red colored border when selected', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.WidgetStateBorderSideExampleApp());
expect(findByBorderColor(Colors.red), findsOneWidget);
});
testWidgets('FilterChip displays the correct border color when not selected', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStateBorderSideExampleApp(),
);
testWidgets('FilterChip displays the correct border color when not selected', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.WidgetStateBorderSideExampleApp());
await tester.tap(find.byType(FilterChip));
await tester.pumpAndSettle();
@@ -68,9 +68,6 @@ void main() {
final ThemeData theme = Theme.of(tester.element(find.byType(FilterChip)));
// FilterChip's border color defaults to ColorScheme.outlineVariant.
expect(
findByBorderColor(theme.colorScheme.outlineVariant),
findsOneWidget,
);
expect(findByBorderColor(theme.colorScheme.outlineVariant), findsOneWidget);
});
}

View File

@@ -12,16 +12,10 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('ListTile displays correct mouse cursor when disabled', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStateMouseCursorExampleApp(),
);
await tester.pumpWidget(const example.WidgetStateMouseCursorExampleApp());
final TestGesture gesture = await tester.createGesture(
kind: PointerDeviceKind.mouse,
);
await gesture.addPointer(
location: tester.getCenter(find.byType(ListTile)),
);
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
await gesture.addPointer(location: tester.getCenter(find.byType(ListTile)));
addTearDown(gesture.removePointer);
expect(
@@ -31,9 +25,7 @@ void main() {
});
testWidgets('Switch enables ListTile', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStateMouseCursorExampleApp(),
);
await tester.pumpWidget(const example.WidgetStateMouseCursorExampleApp());
ListTile listTile = tester.widget(find.byType(ListTile));
expect(listTile.enabled, isFalse);
@@ -47,20 +39,14 @@ void main() {
});
testWidgets('ListTile displays correct mouse cursor when enabled', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStateMouseCursorExampleApp(),
);
await tester.pumpWidget(const example.WidgetStateMouseCursorExampleApp());
// Enable ListTile using Switch.
await tester.tap(find.byType(Switch));
await tester.pumpAndSettle();
final TestGesture gesture = await tester.createGesture(
kind: PointerDeviceKind.mouse,
);
await gesture.addPointer(
location: tester.getCenter(find.byType(ListTile)),
);
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
await gesture.addPointer(location: tester.getCenter(find.byType(ListTile)));
addTearDown(gesture.removePointer);
expect(

View File

@@ -5,8 +5,7 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/widgets/widget_state/widget_state_property.0.dart'
as example;
import 'package:flutter_api_samples/widgets/widget_state/widget_state_property.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
@@ -18,17 +17,13 @@ void main() {
}
testWidgets('Displays red colored text by default', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStatePropertyExampleApp(),
);
await tester.pumpWidget(const example.WidgetStatePropertyExampleApp());
expect(getTextColor(tester), Colors.red);
});
testWidgets('Displays blue colored text when button is hovered', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStatePropertyExampleApp(),
);
await tester.pumpWidget(const example.WidgetStatePropertyExampleApp());
expect(getTextColor(tester), Colors.red);
@@ -42,9 +37,7 @@ void main() {
});
testWidgets('Displays blue colored text when button is pressed', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStatePropertyExampleApp(),
);
await tester.pumpWidget(const example.WidgetStatePropertyExampleApp());
expect(getTextColor(tester), Colors.red);
@@ -58,9 +51,7 @@ void main() {
});
testWidgets('Displays blue colored text when button is focused', (WidgetTester tester) async {
await tester.pumpWidget(
const example.WidgetStatePropertyExampleApp(),
);
await tester.pumpWidget(const example.WidgetStatePropertyExampleApp());
expect(getTextColor(tester), Colors.red);