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

@@ -3,29 +3,30 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/material/date_picker/date_picker_theme_day_shape.0.dart' as example;
import 'package:flutter_api_samples/material/date_picker/date_picker_theme_day_shape.0.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('DatePickerThemeData.dayShape updates day selection shape decoration', (WidgetTester tester) async {
testWidgets('DatePickerThemeData.dayShape updates day selection shape decoration', (
WidgetTester tester,
) async {
final ThemeData theme = ThemeData();
final OutlinedBorder dayShape = RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0));
final OutlinedBorder dayShape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
);
const Color todayBackgroundColor = Colors.amber;
const Color todayForegroundColor = Colors.black;
const BorderSide todayBorder = BorderSide(width: 2);
ShapeDecoration? findDayDecoration(WidgetTester tester, String day) {
return tester.widget<Ink>(
find.ancestor(
of: find.text(day),
matching: find.byType(Ink)
),
).decoration as ShapeDecoration?;
return tester
.widget<Ink>(find.ancestor(of: find.text(day), matching: find.byType(Ink)))
.decoration
as ShapeDecoration?;
}
await tester.pumpWidget(
const example.DatePickerApp(),
);
await tester.pumpWidget(const example.DatePickerApp());
await tester.tap(find.text('Open Date Picker'));
await tester.pumpAndSettle();
@@ -33,7 +34,10 @@ void main() {
// Test the current day shape decoration.
ShapeDecoration dayShapeDecoration = findDayDecoration(tester, '15')!;
expect(dayShapeDecoration.color, todayBackgroundColor);
expect(dayShapeDecoration.shape, dayShape.copyWith(side: todayBorder.copyWith(color: todayForegroundColor)));
expect(
dayShapeDecoration.shape,
dayShape.copyWith(side: todayBorder.copyWith(color: todayForegroundColor)),
);
// Test the selected day shape decoration.
dayShapeDecoration = findDayDecoration(tester, '20')!;
@@ -47,6 +51,9 @@ void main() {
// Test the selected day shape decoration.
dayShapeDecoration = findDayDecoration(tester, '15')!;
expect(dayShapeDecoration.color, todayBackgroundColor);
expect(dayShapeDecoration.shape, dayShape.copyWith(side: todayBorder.copyWith(color: todayForegroundColor)));
expect(
dayShapeDecoration.shape,
dayShape.copyWith(side: todayBorder.copyWith(color: todayForegroundColor)),
);
});
}

View File

@@ -11,9 +11,7 @@ void main() {
const String datePickerTitle = 'Select date';
const String initialDate = 'Sun, Jul 25';
await tester.pumpWidget(
const example.DatePickerApp(),
);
await tester.pumpWidget(const example.DatePickerApp());
// The date picker is not shown initially.
expect(find.text(datePickerTitle), findsNothing);

View File

@@ -36,7 +36,7 @@ void main() {
expect(find.text(datePickerTitle), findsOneWidget);
expect(find.text('Fri, Jul 30'), findsOneWidget);
// Tap OK to confirm the selection and close the date picker.
// Tap OK to confirm the selection and close the date picker.
await tester.tap(find.text('OK'));
await tester.pumpAndSettle();

View File

@@ -10,9 +10,7 @@ void main() {
testWidgets('Can show date range picker', (WidgetTester tester) async {
const String datePickerTitle = 'Select range';
await tester.pumpWidget(
const example.DatePickerApp(),
);
await tester.pumpWidget(const example.DatePickerApp());
// The date range picker is not shown initially.
expect(find.text(datePickerTitle), findsNothing);