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
@@ -8,36 +8,30 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Custom list item uses Expanded widgets for the layout', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.CustomListItemApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.CustomListItemApp());
|
||||
|
||||
// The Expanded widget is used to control the size of the thumbnail.
|
||||
Expanded thumbnailExpanded = tester.widget(find.ancestor(
|
||||
of: find.byType(Container).first,
|
||||
matching: find.byType(Expanded),
|
||||
));
|
||||
Expanded thumbnailExpanded = tester.widget(
|
||||
find.ancestor(of: find.byType(Container).first, matching: find.byType(Expanded)),
|
||||
);
|
||||
expect(thumbnailExpanded.flex, 2);
|
||||
|
||||
// The Expanded widget is used to control the size of the text.
|
||||
Expanded textExpanded = tester.widget(find.ancestor(
|
||||
of: find.text('The Flutter YouTube Channel'),
|
||||
matching: find.byType(Expanded),
|
||||
));
|
||||
Expanded textExpanded = tester.widget(
|
||||
find.ancestor(of: find.text('The Flutter YouTube Channel'), matching: find.byType(Expanded)),
|
||||
);
|
||||
expect(textExpanded.flex, 3);
|
||||
|
||||
// The Expanded widget is used to control the size of the thumbnail.
|
||||
thumbnailExpanded = tester.widget(find.ancestor(
|
||||
of: find.byType(Container).last,
|
||||
matching: find.byType(Expanded),
|
||||
));
|
||||
thumbnailExpanded = tester.widget(
|
||||
find.ancestor(of: find.byType(Container).last, matching: find.byType(Expanded)),
|
||||
);
|
||||
expect(thumbnailExpanded.flex, 2);
|
||||
|
||||
// The Expanded widget is used to control the size of the text.
|
||||
textExpanded = tester.widget(find.ancestor(
|
||||
of: find.text('Announcing Flutter 1.0'),
|
||||
matching: find.byType(Expanded),
|
||||
));
|
||||
textExpanded = tester.widget(
|
||||
find.ancestor(of: find.text('Announcing Flutter 1.0'), matching: find.byType(Expanded)),
|
||||
);
|
||||
expect(textExpanded.flex, 3);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,30 +7,27 @@ import 'package:flutter_api_samples/material/list_tile/custom_list_item.1.dart'
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Custom list item uses AspectRatio and Expanded widgets for the layout', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.CustomListItemApp(),
|
||||
);
|
||||
testWidgets('Custom list item uses AspectRatio and Expanded widgets for the layout', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.CustomListItemApp());
|
||||
|
||||
// The AspectRatio widget is used to constrain the size of the thumbnail.
|
||||
AspectRatio thumbnailAspectRatio = tester.widget(find.ancestor(
|
||||
of: find.byType(Container).first,
|
||||
matching: find.byType(AspectRatio),
|
||||
));
|
||||
AspectRatio thumbnailAspectRatio = tester.widget(
|
||||
find.ancestor(of: find.byType(Container).first, matching: find.byType(AspectRatio)),
|
||||
);
|
||||
expect(thumbnailAspectRatio.aspectRatio, 1.0);
|
||||
|
||||
// The Expanded widget is used to control the size of the text.
|
||||
final Expanded textExpanded = tester.widget(find.ancestor(
|
||||
of: find.text('Flutter 1.0 Launch'),
|
||||
matching: find.byType(Expanded).at(0),
|
||||
));
|
||||
final Expanded textExpanded = tester.widget(
|
||||
find.ancestor(of: find.text('Flutter 1.0 Launch'), matching: find.byType(Expanded).at(0)),
|
||||
);
|
||||
expect(textExpanded.flex, 1);
|
||||
|
||||
// The AspectRatio widget is used to constrain the size of the thumbnail.
|
||||
thumbnailAspectRatio = tester.widget(find.ancestor(
|
||||
of: find.byType(Container).last,
|
||||
matching: find.byType(AspectRatio),
|
||||
));
|
||||
thumbnailAspectRatio = tester.widget(
|
||||
find.ancestor(of: find.byType(Container).last, matching: find.byType(AspectRatio)),
|
||||
);
|
||||
expect(thumbnailAspectRatio.aspectRatio, 1.0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,9 +10,7 @@ void main() {
|
||||
testWidgets('ListTile with Hero does not throw', (WidgetTester tester) async {
|
||||
const int totalTiles = 3;
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.ListTileApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ListTileApp());
|
||||
|
||||
expect(find.byType(ListTile), findsNWidgets(totalTiles));
|
||||
|
||||
|
||||
@@ -10,19 +10,14 @@ void main() {
|
||||
testWidgets('ListTiles wrapped in Card widgets', (WidgetTester tester) async {
|
||||
const int totalTiles = 7;
|
||||
|
||||
await tester.pumpWidget(
|
||||
const example.ListTileApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ListTileApp());
|
||||
|
||||
expect(find.byType(ListTile), findsNWidgets(totalTiles));
|
||||
|
||||
// The ListTile widget is wrapped in a Card widget.
|
||||
for (int i = 0; i < totalTiles; i++) {
|
||||
expect(
|
||||
find.ancestor(
|
||||
of: find.byType(ListTile).at(i),
|
||||
matching: find.byType(Card).at(i),
|
||||
),
|
||||
find.ancestor(of: find.byType(ListTile).at(i), matching: find.byType(Card).at(i)),
|
||||
findsOneWidget,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ import 'package:flutter_api_samples/material/list_tile/list_tile.2.dart' as exam
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('ListTile leading and trailing widgets are aligned appropriately', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ListTileApp(),
|
||||
);
|
||||
testWidgets('ListTile leading and trailing widgets are aligned appropriately', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.ListTileApp());
|
||||
|
||||
expect(find.byType(ListTile), findsNWidgets(3));
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ import 'package:flutter_api_samples/material/list_tile/list_tile.3.dart' as exam
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('ListTile color properties respect Material state color', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ListTileApp(),
|
||||
);
|
||||
testWidgets('ListTile color properties respect Material state color', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.ListTileApp());
|
||||
ListTile listTile = tester.widget(find.byType(ListTile));
|
||||
|
||||
// Enabled list tile uses black color for icon and headline.
|
||||
@@ -51,8 +51,5 @@ void main() {
|
||||
}
|
||||
|
||||
RenderParagraph _getTextRenderObject(WidgetTester tester, String text) {
|
||||
return tester.renderObject(find.descendant(
|
||||
of: find.byType(ListTile),
|
||||
matching: find.text(text),
|
||||
));
|
||||
return tester.renderObject(find.descendant(of: find.byType(ListTile), matching: find.text(text)));
|
||||
}
|
||||
|
||||
@@ -8,9 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Can choose different title alignments from popup menu', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ListTileApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ListTileApp());
|
||||
|
||||
Offset titleOffset = tester.getTopLeft(find.text('Headline Text'));
|
||||
Offset leadingOffset = tester.getTopLeft(find.byType(Checkbox));
|
||||
|
||||
@@ -8,9 +8,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('ListTile item can be selected', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ListTileApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ListTileApp());
|
||||
|
||||
expect(find.byType(ListTile), findsNWidgets(10));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user