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

@@ -12,8 +12,7 @@ import 'windows.dart';
void drawHelloWorld(ui.FlutterView view) {
final ui.ParagraphStyle style = ui.ParagraphStyle();
final ui.ParagraphBuilder paragraphBuilder = ui.ParagraphBuilder(style)
..addText('Hello world');
final ui.ParagraphBuilder paragraphBuilder = ui.ParagraphBuilder(style)..addText('Hello world');
final ui.Paragraph paragraph = paragraphBuilder.build();
paragraph.layout(const ui.ParagraphConstraints(width: 100.0));
@@ -24,9 +23,10 @@ void drawHelloWorld(ui.FlutterView view) {
canvas.drawParagraph(paragraph, ui.Offset.zero);
final ui.Picture picture = recorder.endRecording();
final ui.SceneBuilder sceneBuilder = ui.SceneBuilder()
..addPicture(ui.Offset.zero, picture)
..pop();
final ui.SceneBuilder sceneBuilder =
ui.SceneBuilder()
..addPicture(ui.Offset.zero, picture)
..pop();
view.render(sceneBuilder.build());
}
@@ -58,31 +58,33 @@ void main() async {
// Create a completer to send the window visibility result back to the
// integration test.
final Completer<String> visibilityCompleter = Completer<String>();
enableFlutterDriverExtension(handler: (String? message) async {
if (message == 'verifyWindowVisibility') {
return visibilityCompleter.future;
} else if (message == 'verifyTheme') {
final bool app = await isAppDarkModeEnabled();
final bool system = await isSystemDarkModeEnabled();
enableFlutterDriverExtension(
handler: (String? message) async {
if (message == 'verifyWindowVisibility') {
return visibilityCompleter.future;
} else if (message == 'verifyTheme') {
final bool app = await isAppDarkModeEnabled();
final bool system = await isSystemDarkModeEnabled();
return (app == system)
? 'success'
: 'error: app dark mode ($app) does not match system dark mode ($system)';
} else if (message == 'verifyStringConversion') {
// Use a test string that contains code points that fit in both 8 and 16 bits.
// The code points are passed a list of integers through the method channel,
// which will use the UTF16 to UTF8 utility function to convert them to a
// std::string, which should equate to the original expected string.
const String expected = 'ABCℵ';
final Int32List codePoints = Int32List.fromList(expected.codeUnits);
final String converted = await testStringConversion(codePoints);
return (converted == expected)
? 'success'
: 'error: conversion of UTF16 string to UTF8 failed, expected "${expected.codeUnits}" but got "${converted.codeUnits}"';
}
return (app == system)
? 'success'
: 'error: app dark mode ($app) does not match system dark mode ($system)';
} else if (message == 'verifyStringConversion') {
// Use a test string that contains code points that fit in both 8 and 16 bits.
// The code points are passed a list of integers through the method channel,
// which will use the UTF16 to UTF8 utility function to convert them to a
// std::string, which should equate to the original expected string.
const String expected = 'ABCℵ';
final Int32List codePoints = Int32List.fromList(expected.codeUnits);
final String converted = await testStringConversion(codePoints);
return (converted == expected)
? 'success'
: 'error: conversion of UTF16 string to UTF8 failed, expected "${expected.codeUnits}" but got "${converted.codeUnits}"';
}
throw 'Unrecognized message: $message';
});
throw 'Unrecognized message: $message';
},
);
try {
if (await isWindowVisible()) {

View File

@@ -6,8 +6,7 @@ import 'dart:typed_data';
import 'package:flutter/services.dart';
const MethodChannel _kMethodChannel =
MethodChannel('tests.flutter.dev/windows_startup_test');
const MethodChannel _kMethodChannel = MethodChannel('tests.flutter.dev/windows_startup_test');
/// Returns true if the application's window is visible.
Future<bool> isWindowVisible() async {
@@ -41,7 +40,10 @@ Future<bool> isSystemDarkModeEnabled() async {
/// Test conversion of a UTF16 string to UTF8 using the app template utils.
Future<String> testStringConversion(Int32List twoByteCodes) async {
final String? converted = await _kMethodChannel.invokeMethod<String?>('convertString', twoByteCodes);
final String? converted = await _kMethodChannel.invokeMethod<String?>(
'convertString',
twoByteCodes,
);
if (converted == null) {
throw 'Method channel unavailable.';
}