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:
committed by
GitHub
parent
8e0993eda8
commit
5491c8c146
@@ -3,52 +3,56 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/chip/chip_attributes.avatar_box_constraints.0.dart' as example;
|
||||
import 'package:flutter_api_samples/material/chip/chip_attributes.avatar_box_constraints.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('RawChip.avatarBoxConstraints updates avatar size constraints', (WidgetTester tester) async {
|
||||
testWidgets('RawChip.avatarBoxConstraints updates avatar size constraints', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
const double border = 1.0;
|
||||
const double iconSize = 18.0;
|
||||
const double padding = 8.0;
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.AvatarBoxConstraintsApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.AvatarBoxConstraintsApp());
|
||||
|
||||
expect(tester.getSize(find.byType(RawChip).at(0)).width, equals(202.0));
|
||||
expect(tester.getSize(find.byType(RawChip).at(0)).height, equals(58.0));
|
||||
|
||||
Offset chipTopLeft = tester.getTopLeft(find.byWidget(tester.widget<Material>(
|
||||
find.descendant(
|
||||
of: find.byType(RawChip).at(0),
|
||||
matching: find.byType(Material),
|
||||
Offset chipTopLeft = tester.getTopLeft(
|
||||
find.byWidget(
|
||||
tester.widget<Material>(
|
||||
find.descendant(of: find.byType(RawChip).at(0), matching: find.byType(Material)),
|
||||
),
|
||||
),
|
||||
)));
|
||||
);
|
||||
Offset avatarCenter = tester.getCenter(find.byIcon(Icons.star).at(0));
|
||||
expect(chipTopLeft.dx, avatarCenter.dx - (iconSize / 2) - padding - border);
|
||||
|
||||
expect(tester.getSize(find.byType(RawChip).at(1)).width, equals(202.0));
|
||||
expect(tester.getSize(find.byType(RawChip).at(1)).height, equals(78.0));
|
||||
|
||||
chipTopLeft = tester.getTopLeft(find.byWidget(tester.widget<Material>(
|
||||
find.descendant(
|
||||
of: find.byType(RawChip).at(1),
|
||||
matching: find.byType(Material),
|
||||
chipTopLeft = tester.getTopLeft(
|
||||
find.byWidget(
|
||||
tester.widget<Material>(
|
||||
find.descendant(of: find.byType(RawChip).at(1), matching: find.byType(Material)),
|
||||
),
|
||||
),
|
||||
)));
|
||||
);
|
||||
avatarCenter = tester.getCenter(find.byIcon(Icons.star).at(1));
|
||||
expect(chipTopLeft.dx, avatarCenter.dx - (iconSize / 2) - padding - border);
|
||||
|
||||
expect(tester.getSize(find.byType(RawChip).at(2)).width, equals(202.0));
|
||||
expect(tester.getSize(find.byType(RawChip).at(2)).height, equals(78.0));
|
||||
|
||||
chipTopLeft = tester.getTopLeft(find.byWidget(tester.widget<Material>(
|
||||
find.descendant(
|
||||
of: find.byType(RawChip).at(2),
|
||||
matching: find.byType(Material),
|
||||
chipTopLeft = tester.getTopLeft(
|
||||
find.byWidget(
|
||||
tester.widget<Material>(
|
||||
find.descendant(of: find.byType(RawChip).at(2), matching: find.byType(Material)),
|
||||
),
|
||||
),
|
||||
)));
|
||||
);
|
||||
avatarCenter = tester.getCenter(find.byIcon(Icons.star).at(2));
|
||||
expect(chipTopLeft.dx, avatarCenter.dx - (iconSize / 2) - padding - border);
|
||||
});
|
||||
|
||||
@@ -3,14 +3,15 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/chip/chip_attributes.chip_animation_style.0.dart' as example;
|
||||
import 'package:flutter_api_samples/material/chip/chip_attributes.chip_animation_style.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('ChipAnimationStyle.enableAnimation overrides chip enable animation', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ChipAnimationStyleExampleApp(),
|
||||
);
|
||||
testWidgets('ChipAnimationStyle.enableAnimation overrides chip enable animation', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.ChipAnimationStyleExampleApp());
|
||||
|
||||
final RenderBox materialBox = tester.firstRenderObject<RenderBox>(
|
||||
find.descendant(
|
||||
@@ -42,10 +43,10 @@ void main() {
|
||||
expect(materialBox, paints..rrect(color: const Color(0xffffc107)));
|
||||
});
|
||||
|
||||
testWidgets('ChipAnimationStyle.selectAnimation overrides chip select animation', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ChipAnimationStyleExampleApp(),
|
||||
);
|
||||
testWidgets('ChipAnimationStyle.selectAnimation overrides chip select animation', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.ChipAnimationStyleExampleApp());
|
||||
|
||||
final RenderBox materialBox = tester.firstRenderObject<RenderBox>(
|
||||
find.descendant(
|
||||
@@ -77,10 +78,10 @@ void main() {
|
||||
expect(materialBox, paints..rrect(color: const Color(0xffffc107)));
|
||||
});
|
||||
|
||||
testWidgets('ChipAnimationStyle.avatarDrawerAnimation overrides chip checkmark animation', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ChipAnimationStyleExampleApp(),
|
||||
);
|
||||
testWidgets('ChipAnimationStyle.avatarDrawerAnimation overrides chip checkmark animation', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.ChipAnimationStyleExampleApp());
|
||||
|
||||
expect(tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, closeTo(152.6, 0.1));
|
||||
|
||||
@@ -105,10 +106,10 @@ void main() {
|
||||
expect(tester.getSize(find.widgetWithText(RawChip, 'Checked')).width, closeTo(152.6, 0.1));
|
||||
});
|
||||
|
||||
testWidgets('ChipAnimationStyle.deleteDrawerAnimation overrides chip delete icon animation', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ChipAnimationStyleExampleApp(),
|
||||
);
|
||||
testWidgets('ChipAnimationStyle.deleteDrawerAnimation overrides chip delete icon animation', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.ChipAnimationStyleExampleApp());
|
||||
|
||||
expect(tester.getSize(find.widgetWithText(RawChip, 'Deletable')).width, closeTo(180.9, 0.1));
|
||||
|
||||
|
||||
@@ -3,52 +3,56 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0.dart' as example;
|
||||
import 'package:flutter_api_samples/material/chip/deletable_chip_attributes.delete_icon_box_constraints.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('RawChip.deleteIconBoxConstraints updates delete icon size constraints', (WidgetTester tester) async {
|
||||
testWidgets('RawChip.deleteIconBoxConstraints updates delete icon size constraints', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
const double border = 1.0;
|
||||
const double iconSize = 18.0;
|
||||
const double padding = 8.0;
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.DeleteIconBoxConstraintsApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.DeleteIconBoxConstraintsApp());
|
||||
|
||||
expect(tester.getSize(find.byType(RawChip).at(0)).width, equals(202.0));
|
||||
expect(tester.getSize(find.byType(RawChip).at(0)).height, equals(58.0));
|
||||
|
||||
Offset chipToRight = tester.getTopRight(find.byWidget(tester.widget<Material>(
|
||||
find.descendant(
|
||||
of: find.byType(RawChip).at(0),
|
||||
matching: find.byType(Material),
|
||||
Offset chipToRight = tester.getTopRight(
|
||||
find.byWidget(
|
||||
tester.widget<Material>(
|
||||
find.descendant(of: find.byType(RawChip).at(0), matching: find.byType(Material)),
|
||||
),
|
||||
),
|
||||
)));
|
||||
);
|
||||
Offset deleteIconCenter = tester.getCenter(find.byIcon(Icons.cancel).at(0));
|
||||
expect(chipToRight.dx, deleteIconCenter.dx + (iconSize / 2) + padding + border);
|
||||
|
||||
expect(tester.getSize(find.byType(RawChip).at(1)).width, equals(202.0));
|
||||
expect(tester.getSize(find.byType(RawChip).at(1)).height, equals(78.0));
|
||||
|
||||
chipToRight = tester.getTopRight(find.byWidget(tester.widget<Material>(
|
||||
find.descendant(
|
||||
of: find.byType(RawChip).at(1),
|
||||
matching: find.byType(Material),
|
||||
chipToRight = tester.getTopRight(
|
||||
find.byWidget(
|
||||
tester.widget<Material>(
|
||||
find.descendant(of: find.byType(RawChip).at(1), matching: find.byType(Material)),
|
||||
),
|
||||
),
|
||||
)));
|
||||
);
|
||||
deleteIconCenter = tester.getCenter(find.byIcon(Icons.cancel).at(1));
|
||||
expect(chipToRight.dx, deleteIconCenter.dx + (iconSize / 2) + padding + border);
|
||||
|
||||
expect(tester.getSize(find.byType(RawChip).at(2)).width, equals(202.0));
|
||||
expect(tester.getSize(find.byType(RawChip).at(2)).height, equals(78.0));
|
||||
|
||||
chipToRight = tester.getTopRight(find.byWidget(tester.widget<Material>(
|
||||
find.descendant(
|
||||
of: find.byType(RawChip).at(2),
|
||||
matching: find.byType(Material),
|
||||
chipToRight = tester.getTopRight(
|
||||
find.byWidget(
|
||||
tester.widget<Material>(
|
||||
find.descendant(of: find.byType(RawChip).at(2), matching: find.byType(Material)),
|
||||
),
|
||||
),
|
||||
)));
|
||||
);
|
||||
deleteIconCenter = tester.getCenter(find.byIcon(Icons.cancel).at(2));
|
||||
expect(chipToRight.dx, deleteIconCenter.dx + (iconSize / 2) + padding + border);
|
||||
});
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/chip/deletable_chip_attributes.on_deleted.0.dart' as example;
|
||||
import 'package:flutter_api_samples/material/chip/deletable_chip_attributes.on_deleted.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Chip.onDeleted can be used to delete chips', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.OnDeletedExampleApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.OnDeletedExampleApp());
|
||||
|
||||
expect(find.widgetWithText(AppBar, 'DeletableChipAttributes.onDeleted Sample'), findsOne);
|
||||
expect(find.widgetWithText(Chip, 'Aaron Burr'), findsOne);
|
||||
|
||||
Reference in New Issue
Block a user