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

@@ -11,10 +11,7 @@ import 'package:flutter/services.dart';
class AndroidPlatformView extends StatelessWidget {
/// Creates a platform view for Android, which is rendered as a
/// native view.
const AndroidPlatformView({
super.key,
required this.viewType,
});
const AndroidPlatformView({super.key, required this.viewType});
/// The unique identifier for the view type to be embedded by this widget.
///
@@ -25,8 +22,7 @@ class AndroidPlatformView extends StatelessWidget {
Widget build(BuildContext context) {
return PlatformViewLink(
viewType: viewType,
surfaceFactory:
(BuildContext context, PlatformViewController controller) {
surfaceFactory: (BuildContext context, PlatformViewController controller) {
return AndroidViewSurface(
controller: controller as AndroidViewController,
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
@@ -35,11 +31,11 @@ class AndroidPlatformView extends StatelessWidget {
},
onCreatePlatformView: (PlatformViewCreationParams params) {
return PlatformViewsService.initExpensiveAndroidView(
id: params.id,
viewType: viewType,
layoutDirection: TextDirection.ltr,
creationParamsCodec: const StandardMessageCodec(),
)
id: params.id,
viewType: viewType,
layoutDirection: TextDirection.ltr,
creationParamsCodec: const StandardMessageCodec(),
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
},

View File

@@ -11,15 +11,11 @@ import 'android_platform_view.dart';
void main() {
enableFlutterDriverExtension();
runApp(
const PlatformViewApp()
);
runApp(const PlatformViewApp());
}
class PlatformViewApp extends StatefulWidget {
const PlatformViewApp({
super.key
});
const PlatformViewApp({super.key});
@override
PlatformViewAppState createState() => PlatformViewAppState();
@@ -37,7 +33,7 @@ class PlatformViewAppState extends State<PlatformViewApp> {
}
class PlatformViewLayout extends StatelessWidget {
const PlatformViewLayout({ super.key });
const PlatformViewLayout({super.key});
@override
Widget build(BuildContext context) {
@@ -52,12 +48,7 @@ class PlatformViewLayout extends StatelessWidget {
child: Material(
elevation: (index % 5 + 1).toDouble(),
color: Colors.white,
child: const Stack(
children: <Widget> [
DummyPlatformView(),
RotationContainer(),
],
),
child: const Stack(children: <Widget>[DummyPlatformView(), RotationContainer()]),
),
);
},
@@ -74,22 +65,13 @@ class DummyPlatformView extends StatelessWidget {
const String viewType = 'benchmarks/platform_views_layout_hybrid_composition/DummyPlatformView';
late Widget nativeView;
if (Platform.isIOS) {
nativeView = const UiKitView(
viewType: viewType,
);
nativeView = const UiKitView(viewType: viewType);
} else if (Platform.isAndroid) {
nativeView = const AndroidPlatformView(
viewType: viewType,
);
nativeView = const AndroidPlatformView(viewType: viewType);
} else {
assert(false, 'Invalid platform');
}
return Container(
color: Colors.purple,
height: 200.0,
width: 300.0,
child: nativeView,
);
return Container(color: Colors.purple, height: 200.0, width: 300.0, child: nativeView);
}
}
@@ -100,8 +82,7 @@ class RotationContainer extends StatefulWidget {
State<RotationContainer> createState() => _RotationContainerState();
}
class _RotationContainerState extends State<RotationContainer>
with SingleTickerProviderStateMixin {
class _RotationContainerState extends State<RotationContainer> with SingleTickerProviderStateMixin {
late AnimationController _rotationController;
@override
@@ -125,11 +106,7 @@ class _RotationContainerState extends State<RotationContainer>
Widget build(BuildContext context) {
return RotationTransition(
turns: Tween<double>(begin: 0.0, end: 1.0).animate(_rotationController),
child: Container(
color: Colors.purple,
width: 50.0,
height: 50.0,
),
child: Container(color: Colors.purple, width: 50.0, height: 50.0),
);
}
}

View File

@@ -9,7 +9,5 @@ import 'package:platform_views_layout_hybrid_composition/main.dart' as app;
void main() {
enableFlutterDriverExtension();
runApp(
const app.PlatformViewApp()
);
runApp(const app.PlatformViewApp());
}

View File

@@ -53,7 +53,10 @@ void main() {
test('platform_views_scroll_perf_hybrid_composition', () async {
// Disable frame sync, since there are ongoing animations.
await driver.runUnsynchronized(() async {
await testScrollPerf('platform-views-scroll', 'platform_views_scroll_perf_hybrid_composition');
await testScrollPerf(
'platform-views-scroll',
'platform_views_scroll_perf_hybrid_composition',
);
});
}, timeout: Timeout.none);
});