Revert "Revert "Revert "Migrate some benchmarks to NNBD (#75023)" (#75053)" (#75265)" (#75331)

This reverts commit 1e8e414787b5a2b8487069c93fad2fdb3ff54ff4.
This commit is contained in:
Zachary Anderson 2021-02-03 09:49:02 -08:00 committed by GitHub
parent a1141d9f0f
commit 998d1c6523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 21 deletions

View File

@ -15,11 +15,13 @@ void main() {
class PlatformViewApp extends StatefulWidget { class PlatformViewApp extends StatefulWidget {
const PlatformViewApp({ const PlatformViewApp({
Key? key, Key key
}) : super(key: key); }) : super(key: key);
@override @override
PlatformViewAppState createState() => PlatformViewAppState(); PlatformViewAppState createState() => PlatformViewAppState();
static PlatformViewAppState of(BuildContext context) => context.findAncestorStateOfType<PlatformViewAppState>();
} }
class PlatformViewAppState extends State<PlatformViewApp> { class PlatformViewAppState extends State<PlatformViewApp> {
@ -40,7 +42,7 @@ class PlatformViewAppState extends State<PlatformViewApp> {
} }
class PlatformViewLayout extends StatelessWidget { class PlatformViewLayout extends StatelessWidget {
const PlatformViewLayout({ Key? key }) : super(key: key); const PlatformViewLayout({ Key key }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -70,12 +72,12 @@ class PlatformViewLayout extends StatelessWidget {
} }
class DummyPlatformView extends StatelessWidget { class DummyPlatformView extends StatelessWidget {
const DummyPlatformView({Key? key}) : super(key: key); const DummyPlatformView({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
const String viewType = 'benchmarks/platform_views_layout/DummyPlatformView'; const String viewType = 'benchmarks/platform_views_layout/DummyPlatformView';
late Widget nativeView; Widget nativeView;
if (Platform.isIOS) { if (Platform.isIOS) {
nativeView = const UiKitView( nativeView = const UiKitView(
viewType: viewType, viewType: viewType,
@ -96,7 +98,7 @@ class DummyPlatformView extends StatelessWidget {
} }
class RotationContainer extends StatefulWidget { class RotationContainer extends StatefulWidget {
const RotationContainer({Key? key}) : super(key: key); const RotationContainer({Key key}) : super(key: key);
@override @override
_RotationContainerState createState() => _RotationContainerState(); _RotationContainerState createState() => _RotationContainerState();
@ -104,7 +106,7 @@ class RotationContainer extends StatefulWidget {
class _RotationContainerState extends State<RotationContainer> class _RotationContainerState extends State<RotationContainer>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
late AnimationController _rotationController; AnimationController _rotationController;
@override @override
void initState() { void initState() {

View File

@ -2,7 +2,7 @@ name: platform_views_layout
description: A benchmark for platform views. description: A benchmark for platform views.
environment: environment:
sdk: ">=2.12.0-0 <3.0.0" sdk: ">=2.2.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:

View File

@ -7,7 +7,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() { void main() {
group('scrolling performance test', () { group('scrolling performance test', () {
late FlutterDriver driver; FlutterDriver driver;
setUpAll(() async { setUpAll(() async {
driver = await FlutterDriver.connect(); driver = await FlutterDriver.connect();
@ -16,7 +16,8 @@ void main() {
}); });
tearDownAll(() async { tearDownAll(() async {
driver.close(); if (driver != null)
driver.close();
}); });
Future<void> testScrollPerf(String listKey, String summaryName) async { Future<void> testScrollPerf(String listKey, String summaryName) async {

View File

@ -12,9 +12,10 @@ class AndroidPlatformView extends StatelessWidget {
/// Creates a platform view for Android, which is rendered as a /// Creates a platform view for Android, which is rendered as a
/// native view. /// native view.
const AndroidPlatformView({ const AndroidPlatformView({
Key? key, Key key,
required this.viewType, @required this.viewType,
}) : super(key: key); }) : assert(viewType != null),
super(key: key);
/// The unique identifier for the view type to be embedded by this widget. /// The unique identifier for the view type to be embedded by this widget.
/// ///

View File

@ -19,11 +19,13 @@ void main() {
class PlatformViewApp extends StatefulWidget { class PlatformViewApp extends StatefulWidget {
const PlatformViewApp({ const PlatformViewApp({
Key? key Key key
}) : super(key: key); }) : super(key: key);
@override @override
PlatformViewAppState createState() => PlatformViewAppState(); PlatformViewAppState createState() => PlatformViewAppState();
static PlatformViewAppState of(BuildContext context) => context.findAncestorStateOfType<PlatformViewAppState>();
} }
class PlatformViewAppState extends State<PlatformViewApp> { class PlatformViewAppState extends State<PlatformViewApp> {
@ -44,7 +46,7 @@ class PlatformViewAppState extends State<PlatformViewApp> {
} }
class PlatformViewLayout extends StatelessWidget { class PlatformViewLayout extends StatelessWidget {
const PlatformViewLayout({ Key? key }) : super(key: key); const PlatformViewLayout({ Key key }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -74,12 +76,12 @@ class PlatformViewLayout extends StatelessWidget {
} }
class DummyPlatformView extends StatelessWidget { class DummyPlatformView extends StatelessWidget {
const DummyPlatformView({Key? key}) : super(key: key); const DummyPlatformView({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
const String viewType = 'benchmarks/platform_views_layout_hybrid_composition/DummyPlatformView'; const String viewType = 'benchmarks/platform_views_layout_hybrid_composition/DummyPlatformView';
late Widget nativeView; Widget nativeView;
if (Platform.isIOS) { if (Platform.isIOS) {
nativeView = const UiKitView( nativeView = const UiKitView(
viewType: viewType, viewType: viewType,
@ -101,7 +103,7 @@ class DummyPlatformView extends StatelessWidget {
} }
class RotationContainer extends StatefulWidget { class RotationContainer extends StatefulWidget {
const RotationContainer({Key? key}) : super(key: key); const RotationContainer({Key key}) : super(key: key);
@override @override
_RotationContainerState createState() => _RotationContainerState(); _RotationContainerState createState() => _RotationContainerState();
@ -109,7 +111,7 @@ class RotationContainer extends StatefulWidget {
class _RotationContainerState extends State<RotationContainer> class _RotationContainerState extends State<RotationContainer>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
late AnimationController _rotationController; AnimationController _rotationController;
@override @override
void initState() { void initState() {

View File

@ -2,7 +2,7 @@ name: platform_views_layout_hybrid_composition
description: A benchmark for platform views, using hybrid composition on android. description: A benchmark for platform views, using hybrid composition on android.
environment: environment:
sdk: ">=2.12.0-0 <3.0.0" sdk: ">=2.2.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:

View File

@ -7,7 +7,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() { void main() {
group('scrolling performance test', () { group('scrolling performance test', () {
late FlutterDriver driver; FlutterDriver driver;
setUpAll(() async { setUpAll(() async {
driver = await FlutterDriver.connect(); driver = await FlutterDriver.connect();
@ -16,7 +16,8 @@ void main() {
}); });
tearDownAll(() async { tearDownAll(() async {
driver.close(); if (driver != null)
driver.close();
}); });
Future<void> testScrollPerf(String listKey, String summaryName) async { Future<void> testScrollPerf(String listKey, String summaryName) async {