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
@@ -4,14 +4,13 @@
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_view.0.dart' as example;
|
||||
import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_view.0.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Content is reordered after a drag', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ReorderableApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ReorderableApp());
|
||||
|
||||
bool item1IsBeforeItem2() {
|
||||
final Iterable<Text> texts = tester.widgetList<Text>(find.byType(Text));
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_view.1.dart' as example;
|
||||
import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_view.1.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Dragged item color is updated', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ReorderableApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ReorderableApp());
|
||||
|
||||
final ThemeData theme = Theme.of(tester.element(find.byType(MaterialApp)));
|
||||
|
||||
@@ -19,10 +18,9 @@ void main() {
|
||||
final TestGesture drag = await tester.startGesture(tester.getCenter(find.text('Item 1')));
|
||||
await tester.pump(kLongPressTimeout + kPressTimeout);
|
||||
await tester.pumpAndSettle();
|
||||
final Material material = tester.widget<Material>(find.ancestor(
|
||||
of: find.text('Item 1'),
|
||||
matching: find.byType(Material),
|
||||
));
|
||||
final Material material = tester.widget<Material>(
|
||||
find.ancestor(of: find.text('Item 1'), matching: find.byType(Material)),
|
||||
);
|
||||
expect(material.color, theme.colorScheme.secondary);
|
||||
|
||||
// Ends the drag gesture.
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_view.2.dart' as example;
|
||||
import 'package:flutter_api_samples/material/reorderable_list/reorderable_list_view.2.dart'
|
||||
as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Dragged Card is elevated', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ReorderableApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ReorderableApp());
|
||||
|
||||
Card findCardOne() {
|
||||
return tester.widget<Card>(find.ancestor(of: find.text('Card 1'), matching: find.byType(Card)));
|
||||
return tester.widget<Card>(
|
||||
find.ancestor(of: find.text('Card 1'), matching: find.byType(Card)),
|
||||
);
|
||||
}
|
||||
|
||||
// Card has default elevation when not dragged.
|
||||
|
||||
@@ -17,9 +17,7 @@ void main() {
|
||||
}
|
||||
|
||||
testWidgets('Reorder list item', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ReorderableApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ReorderableApp());
|
||||
|
||||
expect(tester.getCenter(find.text('Item 3')).dy, 280.0);
|
||||
await longPressDrag(
|
||||
|
||||
@@ -17,9 +17,7 @@ void main() {
|
||||
}
|
||||
|
||||
testWidgets('Reorder list item', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.ReorderableApp(),
|
||||
);
|
||||
await tester.pumpWidget(const example.ReorderableApp());
|
||||
|
||||
expect(tester.getCenter(find.text('Item 3')).dy, 252.0);
|
||||
await longPressDrag(
|
||||
|
||||
Reference in New Issue
Block a user