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

@@ -5,8 +5,7 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/widgets/image/image.error_builder.0.dart'
as example;
import 'package:flutter_api_samples/widgets/image/image.error_builder.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
@@ -17,24 +16,17 @@ void main() {
});
testWidgets('Has nonexistent url', (WidgetTester tester) async {
await tester.pumpWidget(
const example.ErrorBuilderExampleApp(),
);
await tester.pumpWidget(const example.ErrorBuilderExampleApp());
await tester.pumpAndSettle();
final Image image = tester.widget<Image>(find.byType(Image));
final NetworkImage imageProvider = image.image as NetworkImage;
expect(
imageProvider.url,
equals('https://example.does.not.exist/image.jpg'),
);
expect(imageProvider.url, equals('https://example.does.not.exist/image.jpg'));
});
testWidgets('errorBuilder returns text with emoji', (WidgetTester tester) async {
await tester.pumpWidget(
const example.ErrorBuilderExampleApp(),
);
await tester.pumpWidget(const example.ErrorBuilderExampleApp());
await tester.pumpAndSettle();
final Image image = tester.widget<Image>(find.byType(Image));

View File

@@ -5,8 +5,7 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/widgets/image/image.frame_builder.0.dart'
as example;
import 'package:flutter_api_samples/widgets/image/image.frame_builder.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
@@ -16,10 +15,10 @@ void main() {
HttpOverrides.global = null;
});
testWidgets('The frame builder returns an AnimatedOpacity when not synchronously loaded', (WidgetTester tester) async {
await tester.pumpWidget(
const example.FrameBuilderExampleApp(),
);
testWidgets('The frame builder returns an AnimatedOpacity when not synchronously loaded', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.FrameBuilderExampleApp());
await tester.pumpAndSettle();
final Image image = tester.widget<Image>(find.byType(Image));
@@ -29,17 +28,15 @@ void main() {
const Key key = Key('child');
expect(
frameBuilder(context, const SizedBox(key: key), null, false),
isA<AnimatedOpacity>().having(
(AnimatedOpacity opacity) => opacity.child!.key, 'key', key,
),
frameBuilder(context, const SizedBox(key: key), null, false),
isA<AnimatedOpacity>().having((AnimatedOpacity opacity) => opacity.child!.key, 'key', key),
);
});
testWidgets('The frame builder returns the child when synchronously loaded', (WidgetTester tester) async {
await tester.pumpWidget(
const example.FrameBuilderExampleApp(),
);
testWidgets('The frame builder returns the child when synchronously loaded', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.FrameBuilderExampleApp());
await tester.pumpAndSettle();
final Image image = tester.widget<Image>(find.byType(Image));
@@ -49,10 +46,8 @@ void main() {
const Key key = Key('child');
expect(
frameBuilder(context, const SizedBox(key: key), null, true),
isA<SizedBox>().having(
(SizedBox widget) => widget.key, 'key', key,
),
frameBuilder(context, const SizedBox(key: key), null, true),
isA<SizedBox>().having((SizedBox widget) => widget.key, 'key', key),
);
});
}

View File

@@ -5,8 +5,7 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/widgets/image/image.loading_builder.0.dart'
as example;
import 'package:flutter_api_samples/widgets/image/image.loading_builder.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
@@ -16,10 +15,10 @@ void main() {
HttpOverrides.global = null;
});
testWidgets('The loading builder returns the child when there is no loading progress', (WidgetTester tester) async {
await tester.pumpWidget(
const example.LoadingBuilderExampleApp(),
);
testWidgets('The loading builder returns the child when there is no loading progress', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.LoadingBuilderExampleApp());
await tester.pumpAndSettle();
final Image image = tester.widget<Image>(find.byType(Image));
@@ -34,10 +33,10 @@ void main() {
expect(find.byType(CircularProgressIndicator), findsNothing);
});
testWidgets('The loading builder returns a circular progress indicator when loading', (WidgetTester tester) async {
await tester.pumpWidget(
const example.LoadingBuilderExampleApp(),
);
testWidgets('The loading builder returns a circular progress indicator when loading', (
WidgetTester tester,
) async {
await tester.pumpWidget(const example.LoadingBuilderExampleApp());
await tester.pumpAndSettle();
final Image image = tester.widget<Image>(find.byType(Image));
@@ -51,10 +50,7 @@ void main() {
home: loadingBuilder(
context,
child,
const ImageChunkEvent(
cumulativeBytesLoaded: 1,
expectedTotalBytes: 10,
),
const ImageChunkEvent(cumulativeBytesLoaded: 1, expectedTotalBytes: 10),
),
),
);