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

@@ -21,7 +21,7 @@ web.NodeList findElements(String selector) {
fail(
'Failed to locate <flutter-view>. Possible reasons:\n'
' - The application failed to start'
' - `findElements` was called before the application started'
' - `findElements` was called before the application started',
);
}

View File

@@ -18,14 +18,17 @@ Future<void> runTestWithScreenshots({
int browserWidth = _kScreenshotWidth,
int browserHeight = _kScreenshotHeight,
}) async {
final WebFlutterDriver driver =
await FlutterDriver.connect() as WebFlutterDriver;
final WebFlutterDriver driver = await FlutterDriver.connect() as WebFlutterDriver;
(await driver.webDriver.window).setSize(Rectangle<int>(0, 0, browserWidth, browserHeight));
test.integrationDriver(
driver: driver,
onScreenshot: (String screenshotName, List<int> screenshotBytes, [Map<String, Object?>? args]) async {
onScreenshot: (
String screenshotName,
List<int> screenshotBytes, [
Map<String, Object?>? args,
]) async {
// TODO(yjbanov): implement, see https://github.com/flutter/flutter/issues/86120
return true;
},

View File

@@ -39,21 +39,18 @@ 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: ListView.builder(
itemCount: 1000,
itemBuilder: (BuildContext context, int index) => Padding(
padding: const EdgeInsets.all(20),
child: Container(
height: 100,
color: Colors.lightBlue,
child: Center(
child: Text('Item $index'),
itemBuilder:
(BuildContext context, int index) => Padding(
padding: const EdgeInsets.all(20),
child: Container(
height: 100,
color: Colors.lightBlue,
child: Center(child: Text('Item $index')),
),
),
),
),
),
floatingActionButton: FloatingActionButton.extended(
key: const Key('scroll-button'),
@@ -77,27 +74,27 @@ abstract class DeltaMode {
static const int kLine = 0x01;
}
void dispatchMouseWheelEvent(int mouseX, int mouseY,
int deltaMode, double deltaX, double deltaY) {
void dispatchMouseWheelEvent(int mouseX, int mouseY, int deltaMode, double deltaX, double deltaY) {
final web.EventTarget target = web.document.elementFromPoint(mouseX, mouseY)!;
target.dispatchEvent(web.MouseEvent('mouseover', web.MouseEventInit(
screenX: mouseX,
screenY: mouseY,
clientX: mouseX,
clientY: mouseY,
)));
target.dispatchEvent(
web.MouseEvent(
'mouseover',
web.MouseEventInit(screenX: mouseX, screenY: mouseY, clientX: mouseX, clientY: mouseY),
),
);
target.dispatchEvent(web.MouseEvent('mousemove', web.MouseEventInit(
screenX: mouseX,
screenY: mouseY,
clientX: mouseX,
clientY: mouseY,
)));
target.dispatchEvent(
web.MouseEvent(
'mousemove',
web.MouseEventInit(screenX: mouseX, screenY: mouseY, clientX: mouseX, clientY: mouseY),
),
);
target.dispatchEvent(web.WheelEvent('wheel', web.WheelEventInit(
deltaMode: deltaMode,
deltaX : deltaX,
deltaY : deltaY,
)));
target.dispatchEvent(
web.WheelEvent(
'wheel',
web.WheelEventInit(deltaMode: deltaMode, deltaX: deltaX, deltaY: deltaY),
),
);
}

View File

@@ -12,11 +12,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
key: Key('mainapp'),
title: 'Platform Test',
home: MyHomePage(),
);
return const MaterialApp(key: Key('mainapp'), title: 'Platform Test', home: MyHomePage());
}
}
@@ -31,20 +27,11 @@ class MyHomePage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
if (defaultTargetPlatform == TargetPlatform.macOS)
const Text(
'I am running on MacOS',
key: Key('macOSKey'),
),
const Text('I am running on MacOS', key: Key('macOSKey')),
if (defaultTargetPlatform == TargetPlatform.iOS)
const Text(
'I am running on MacOS',
key: Key('iOSKey'),
),
const Text('I am running on MacOS', key: Key('iOSKey')),
if (defaultTargetPlatform == TargetPlatform.android)
const Text(
'I am running on Android',
key: Key('androidKey'),
),
const Text('I am running on Android', key: Key('androidKey')),
],
),
),

View File

@@ -34,25 +34,19 @@ class _MyHomePageState extends State<MyHomePage> {
// Controller with no initial value;
final TextEditingController _emptyController = TextEditingController();
final TextEditingController _controller =
TextEditingController(text: 'Text1');
final TextEditingController _controller = TextEditingController(text: 'Text1');
final TextEditingController _controller2 =
TextEditingController(text: 'Text2');
final TextEditingController _controller2 = TextEditingController(text: 'Text2');
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title ?? ''),
),
appBar: AppBar(title: Text(widget.title ?? '')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Text Editing Test 1',
),
const Text('Text Editing Test 1'),
TextFormField(
key: const Key('empty-input'),
enabled: true,
@@ -62,9 +56,7 @@ class _MyHomePageState extends State<MyHomePage> {
labelText: 'Empty Input Field:',
),
),
const Text(
'Text Editing Test 2',
),
const Text('Text Editing Test 2'),
TextFormField(
key: const Key('input'),
enabled: true,
@@ -74,9 +66,7 @@ class _MyHomePageState extends State<MyHomePage> {
labelText: 'Text Input Field:',
),
),
const Text(
'Text Editing Test 3',
),
const Text('Text Editing Test 3'),
TextFormField(
key: const Key('input2'),
enabled: true,
@@ -90,10 +80,7 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() => infoText = 'enter pressed');
},
),
Text(
infoText,
key: const Key('text'),
),
Text(infoText, key: const Key('text')),
const Padding(
padding: EdgeInsets.all(12.0),
child: SelectableText(

View File

@@ -32,12 +32,8 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: const Center(
child: Text('TreeshakingThings'),
),
appBar: AppBar(title: Text(widget.title)),
body: const Center(child: Text('TreeshakingThings')),
);
}
}