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

@@ -24,9 +24,7 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
theme: ThemeData(primarySwatch: Colors.blue),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
@@ -47,50 +45,53 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title ?? ''),
appBar: AppBar(title: Text(widget.title ?? '')),
body: Column(
children: <Widget>[
TextButton(
key: const ValueKey<String>('platform_view_button'),
child: const Text('show platform view'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<MergeThreadTestPage>(
builder: (BuildContext context) => const MergeThreadTestPage(),
),
);
},
),
// Push this button to perform an animation, which ensure the threads are unmerged after the animation.
ElevatedButton(
key: const ValueKey<String>('unmerge_button'),
child: const Text('Tap to unmerge threads'),
onPressed: () {},
),
TextButton(
key: const ValueKey<String>('platform_view_focus_test'),
child: const Text('platform view focus test'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<FocusTestPage>(
builder: (BuildContext context) => const FocusTestPage(),
),
);
},
),
TextButton(
key: const ValueKey<String>('platform_view_z_order_test'),
child: const Text('platform view z order test'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<ZOrderTestPage>(
builder: (BuildContext context) => const ZOrderTestPage(),
),
);
},
),
],
),
body: Column(children: <Widget>[
TextButton(
key: const ValueKey<String>('platform_view_button'),
child: const Text('show platform view'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<MergeThreadTestPage>(
builder: (BuildContext context) => const MergeThreadTestPage()),
);
},
),
// Push this button to perform an animation, which ensure the threads are unmerged after the animation.
ElevatedButton(
key: const ValueKey<String>('unmerge_button'),
child: const Text('Tap to unmerge threads'),
onPressed: () {},
),
TextButton(
key: const ValueKey<String>('platform_view_focus_test'),
child: const Text('platform view focus test'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<FocusTestPage>(
builder: (BuildContext context) => const FocusTestPage()),
);
},
),
TextButton(
key: const ValueKey<String>('platform_view_z_order_test'),
child: const Text('platform view z order test'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<ZOrderTestPage>(
builder: (BuildContext context) => const ZOrderTestPage()),
);
},
),
]),
);
}
}
@@ -104,22 +105,11 @@ class MergeThreadTestPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Platform View Thread Merge Tests'),
),
appBar: AppBar(title: const Text('Platform View Thread Merge Tests')),
body: Column(
children: <Widget>[
const Expanded(
child: SizedBox(
width: 300,
child: UiKitView(viewType: 'platform_view'),
),
),
ElevatedButton(
key: button,
child: const Text('button'),
onPressed: (){},
),
const Expanded(child: SizedBox(width: 300, child: UiKitView(viewType: 'platform_view'))),
ElevatedButton(key: button, child: const Text('button'), onPressed: () {}),
],
),
);
@@ -135,7 +125,6 @@ class FocusTestPage extends StatefulWidget {
}
class _FocusTestPageState extends State<FocusTestPage> {
late TextEditingController _controller;
@override
@@ -148,19 +137,11 @@ class _FocusTestPageState extends State<FocusTestPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Platform View Focus Tests'),
),
appBar: AppBar(title: const Text('Platform View Focus Tests')),
body: Column(
children: <Widget>[
const SizedBox(
width: 300,
height: 50,
child: UiKitView(viewType: 'platform_text_field'),
),
TextField(
controller: _controller,
),
const SizedBox(width: 300, height: 50, child: UiKitView(viewType: 'platform_text_field')),
TextField(controller: _controller),
],
),
);
@@ -182,49 +163,50 @@ class _ZOrderTestPageState extends State<ZOrderTestPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Platform view z order test'),
),
appBar: AppBar(title: const Text('Platform view z order test')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Visibility(
visible: _showBackground,
child: const SizedBox(
width: 500,
height: 500,
child: UiKitView(
viewType: 'platform_view',
creationParamsCodec: StandardMessageCodec(),
),
)),
visible: _showBackground,
child: const SizedBox(
width: 500,
height: 500,
child: UiKitView(
viewType: 'platform_view',
creationParamsCodec: StandardMessageCodec(),
),
),
),
TextButton(
onPressed: () {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return const SizedBox(
width: 250,
height: 250,
child: UiKitView(
viewType: 'platform_button',
creationParamsCodec: StandardMessageCodec(),
),
);
});
onPressed: () {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return const SizedBox(
width: 250,
height: 250,
child: UiKitView(
viewType: 'platform_button',
creationParamsCodec: StandardMessageCodec(),
),
);
},
);
// XCUITest fails to query the background platform view,
// Since it is covered by the dialog prompt, which removes
// semantic nodes underneath.
// As a workaround, we show the background with a delay.
Future<void>.delayed(const Duration(seconds: 1)).then((void value) {
setState(() {
_showBackground = true;
});
// XCUITest fails to query the background platform view,
// Since it is covered by the dialog prompt, which removes
// semantic nodes underneath.
// As a workaround, we show the background with a delay.
Future<void>.delayed(const Duration(seconds: 1)).then((void value) {
setState(() {
_showBackground = true;
});
},
child: const Text('Show Alert')),
});
},
child: const Text('Show Alert'),
),
],
),
),

View File

@@ -16,11 +16,9 @@ void main() {
tearDownAll(() => driver.close());
test('Merge thread to create and remove platform views should not crash',
() async {
test('Merge thread to create and remove platform views should not crash', () async {
// Start pushing in a page with platform view, merge threads.
final SerializableFinder platformViewButton =
find.byValueKey('platform_view_button');
final SerializableFinder platformViewButton = find.byValueKey('platform_view_button');
await driver.waitFor(platformViewButton);
await driver.tap(platformViewButton);
@@ -42,11 +40,9 @@ void main() {
expect(driverHealth.status, HealthStatus.ok);
}, timeout: Timeout.none);
test('Merge thread to create and remove platform views should not crash',
() async {
test('Merge thread to create and remove platform views should not crash', () async {
// Start pushing in a page with platform view, merge threads.
final SerializableFinder platformViewButton =
find.byValueKey('platform_view_button');
final SerializableFinder platformViewButton = find.byValueKey('platform_view_button');
await driver.waitFor(platformViewButton);
await driver.tap(platformViewButton);
await driver.waitUntilNoTransientCallbacks();
@@ -57,8 +53,7 @@ void main() {
await driver.waitUntilNoTransientCallbacks();
// The animation of tapping a `ElevatedButton` should pump enough frames to un-merge the thread.
final SerializableFinder unmergeButton =
find.byValueKey('unmerge_button');
final SerializableFinder unmergeButton = find.byValueKey('unmerge_button');
await driver.waitFor(unmergeButton);
await driver.tap(unmergeButton);
await driver.waitUntilNoTransientCallbacks();