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
@@ -7,39 +7,38 @@ import 'package:flutter_api_samples/widgets/animated_list/animated_list.0.dart'
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'Items can be selected, added, and removed from AnimatedList',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.AnimatedListSample());
|
||||
testWidgets('Items can be selected, added, and removed from AnimatedList', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.AnimatedListSample());
|
||||
|
||||
expect(find.text('Item 0'), findsOne);
|
||||
expect(find.text('Item 1'), findsOne);
|
||||
expect(find.text('Item 2'), findsOne);
|
||||
expect(find.text('Item 0'), findsOne);
|
||||
expect(find.text('Item 1'), findsOne);
|
||||
expect(find.text('Item 2'), findsOne);
|
||||
|
||||
// Add an item at the end of the list.
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 3'), findsOne);
|
||||
// Add an item at the end of the list.
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 3'), findsOne);
|
||||
|
||||
// Select Item 1.
|
||||
await tester.tap(find.text('Item 1'));
|
||||
await tester.pumpAndSettle();
|
||||
// Select Item 1.
|
||||
await tester.tap(find.text('Item 1'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Add item at the top of the list.
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 4'), findsOne);
|
||||
// Add item at the top of the list.
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 4'), findsOne);
|
||||
|
||||
// Remove selected item.
|
||||
await tester.tap(find.byIcon(Icons.remove_circle));
|
||||
// Remove selected item.
|
||||
await tester.tap(find.byIcon(Icons.remove_circle));
|
||||
|
||||
// Item animation is not completed.
|
||||
await tester.pump();
|
||||
expect(find.text('Item 1'), findsOne);
|
||||
// Item animation is not completed.
|
||||
await tester.pump();
|
||||
expect(find.text('Item 1'), findsOne);
|
||||
|
||||
// When the animation completes, Item 1 disappears.
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 1'), findsNothing);
|
||||
},
|
||||
);
|
||||
// When the animation completes, Item 1 disappears.
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 1'), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,54 +3,54 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/widgets/animated_list/animated_list_separated.0.dart' as example;
|
||||
import 'package:flutter_api_samples/widgets/animated_list/animated_list_separated.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'Items can be selected, added, and removed from AnimatedList.separated',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.AnimatedListSeparatedSample());
|
||||
testWidgets('Items can be selected, added, and removed from AnimatedList.separated', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.AnimatedListSeparatedSample());
|
||||
|
||||
expect(find.text('Item 0'), findsOneWidget);
|
||||
expect(find.text('Separator 0'), findsOneWidget);
|
||||
expect(find.text('Item 1'), findsOneWidget);
|
||||
expect(find.text('Separator 1'), findsOneWidget);
|
||||
expect(find.text('Item 2'), findsOneWidget);
|
||||
expect(find.text('Item 0'), findsOneWidget);
|
||||
expect(find.text('Separator 0'), findsOneWidget);
|
||||
expect(find.text('Item 1'), findsOneWidget);
|
||||
expect(find.text('Separator 1'), findsOneWidget);
|
||||
expect(find.text('Item 2'), findsOneWidget);
|
||||
|
||||
// Add an item at the end of the list
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Separator 2'), findsOneWidget);
|
||||
expect(find.text('Item 3'), findsOneWidget);
|
||||
// Add an item at the end of the list
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Separator 2'), findsOneWidget);
|
||||
expect(find.text('Item 3'), findsOneWidget);
|
||||
|
||||
// Select Item 1.
|
||||
await tester.tap(find.text('Item 1'));
|
||||
await tester.pumpAndSettle();
|
||||
// Select Item 1.
|
||||
await tester.tap(find.text('Item 1'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Add item at the top of the list
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 4'), findsOneWidget);
|
||||
// Contrary to the behavior for insertion at other places,
|
||||
// the Separator for the last item of the list will be added
|
||||
// before that item instead of after it.
|
||||
expect(find.text('Separator 4'), findsOneWidget);
|
||||
// Add item at the top of the list
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 4'), findsOneWidget);
|
||||
// Contrary to the behavior for insertion at other places,
|
||||
// the Separator for the last item of the list will be added
|
||||
// before that item instead of after it.
|
||||
expect(find.text('Separator 4'), findsOneWidget);
|
||||
|
||||
// Remove selected item.
|
||||
await tester.tap(find.byIcon(Icons.remove_circle));
|
||||
// Remove selected item.
|
||||
await tester.tap(find.byIcon(Icons.remove_circle));
|
||||
|
||||
// Item animation is not completed.
|
||||
await tester.pump();
|
||||
expect(find.text('Item 1'), findsOneWidget);
|
||||
expect(find.text('Separator 1'), findsNothing);
|
||||
expect(find.text('Removing separator'), findsOneWidget);
|
||||
// Item animation is not completed.
|
||||
await tester.pump();
|
||||
expect(find.text('Item 1'), findsOneWidget);
|
||||
expect(find.text('Separator 1'), findsNothing);
|
||||
expect(find.text('Removing separator'), findsOneWidget);
|
||||
|
||||
// When the animation completes, Item 1 disappears.
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 1'), findsNothing);
|
||||
expect(find.text('Separator 1'), findsNothing);
|
||||
expect(find.text('Removing separator'), findsNothing);
|
||||
},
|
||||
);
|
||||
// When the animation completes, Item 1 disappears.
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 1'), findsNothing);
|
||||
expect(find.text('Separator 1'), findsNothing);
|
||||
expect(find.text('Removing separator'), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,39 +7,38 @@ import 'package:flutter_api_samples/widgets/animated_list/sliver_animated_list.0
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'Items can be selected, added, and removed from SliverAnimatedList',
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(const example.SliverAnimatedListSample());
|
||||
testWidgets('Items can be selected, added, and removed from SliverAnimatedList', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
await tester.pumpWidget(const example.SliverAnimatedListSample());
|
||||
|
||||
expect(find.text('Item 0'), findsOneWidget);
|
||||
expect(find.text('Item 1'), findsOneWidget);
|
||||
expect(find.text('Item 2'), findsOneWidget);
|
||||
expect(find.text('Item 0'), findsOneWidget);
|
||||
expect(find.text('Item 1'), findsOneWidget);
|
||||
expect(find.text('Item 2'), findsOneWidget);
|
||||
|
||||
// Add an item at the end of the list
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 3'), findsOneWidget);
|
||||
// Add an item at the end of the list
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 3'), findsOneWidget);
|
||||
|
||||
// Select Item 1.
|
||||
await tester.tap(find.text('Item 1'));
|
||||
await tester.pumpAndSettle();
|
||||
// Select Item 1.
|
||||
await tester.tap(find.text('Item 1'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Add item at the top of the list
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 4'), findsOneWidget);
|
||||
// Add item at the top of the list
|
||||
await tester.tap(find.byIcon(Icons.add_circle));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 4'), findsOneWidget);
|
||||
|
||||
// Remove selected item.
|
||||
await tester.tap(find.byIcon(Icons.remove_circle));
|
||||
// Remove selected item.
|
||||
await tester.tap(find.byIcon(Icons.remove_circle));
|
||||
|
||||
// Item animation is not completed.
|
||||
await tester.pump();
|
||||
expect(find.text('Item 1'), findsOneWidget);
|
||||
// Item animation is not completed.
|
||||
await tester.pump();
|
||||
expect(find.text('Item 1'), findsOneWidget);
|
||||
|
||||
// When the animation completes, Item 1 disappears.
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 1'), findsNothing);
|
||||
},
|
||||
);
|
||||
// When the animation completes, Item 1 disappears.
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Item 1'), findsNothing);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user