Skip to content

Commit 25134a1

Browse files
authored
Revert "Migrate some benchmarks to NNBD (flutter#75023)" (flutter#75053)
This reverts commit 49de01c.
1 parent 49de01c commit 25134a1

File tree

7 files changed

+28
-21
lines changed

7 files changed

+28
-21
lines changed

dev/benchmarks/platform_views_layout/lib/main.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ void main() {
1515

1616
class PlatformViewApp extends StatefulWidget {
1717
const PlatformViewApp({
18-
Key? key,
18+
Key key
1919
}) : super(key: key);
2020

2121
@override
2222
PlatformViewAppState createState() => PlatformViewAppState();
23+
24+
static PlatformViewAppState of(BuildContext context) => context.findAncestorStateOfType<PlatformViewAppState>();
2325
}
2426

2527
class PlatformViewAppState extends State<PlatformViewApp> {
@@ -40,7 +42,7 @@ class PlatformViewAppState extends State<PlatformViewApp> {
4042
}
4143

4244
class PlatformViewLayout extends StatelessWidget {
43-
const PlatformViewLayout({ Key? key }) : super(key: key);
45+
const PlatformViewLayout({ Key key }) : super(key: key);
4446

4547
@override
4648
Widget build(BuildContext context) {
@@ -70,12 +72,12 @@ class PlatformViewLayout extends StatelessWidget {
7072
}
7173

7274
class DummyPlatformView extends StatelessWidget {
73-
const DummyPlatformView({Key? key}) : super(key: key);
75+
const DummyPlatformView({Key key}) : super(key: key);
7476

7577
@override
7678
Widget build(BuildContext context) {
7779
const String viewType = 'benchmarks/platform_views_layout/DummyPlatformView';
78-
late Widget nativeView;
80+
Widget nativeView;
7981
if (Platform.isIOS) {
8082
nativeView = const UiKitView(
8183
viewType: viewType,
@@ -96,15 +98,15 @@ class DummyPlatformView extends StatelessWidget {
9698
}
9799

98100
class RotationContainer extends StatefulWidget {
99-
const RotationContainer({Key? key}) : super(key: key);
101+
const RotationContainer({Key key}) : super(key: key);
100102

101103
@override
102104
_RotationContainerState createState() => _RotationContainerState();
103105
}
104106

105107
class _RotationContainerState extends State<RotationContainer>
106108
with SingleTickerProviderStateMixin {
107-
late AnimationController _rotationController;
109+
AnimationController _rotationController;
108110

109111
@override
110112
void initState() {

dev/benchmarks/platform_views_layout/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: platform_views_layout
22
description: A benchmark for platform views.
33

44
environment:
5-
sdk: ">=2.12.0-0 <3.0.0"
5+
sdk: ">=2.2.0 <3.0.0"
66

77
dependencies:
88
flutter:

dev/benchmarks/platform_views_layout/test_driver/scroll_perf_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
77

88
void main() {
99
group('scrolling performance test', () {
10-
late FlutterDriver driver;
10+
FlutterDriver driver;
1111

1212
setUpAll(() async {
1313
driver = await FlutterDriver.connect();
@@ -16,7 +16,8 @@ void main() {
1616
});
1717

1818
tearDownAll(() async {
19-
driver.close();
19+
if (driver != null)
20+
driver.close();
2021
});
2122

2223
Future<void> testScrollPerf(String listKey, String summaryName) async {

dev/benchmarks/platform_views_layout_hybrid_composition/lib/android_platform_view.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ class AndroidPlatformView extends StatelessWidget {
1212
/// Creates a platform view for Android, which is rendered as a
1313
/// native view.
1414
const AndroidPlatformView({
15-
Key? key,
16-
required this.viewType,
17-
}) : super(key: key);
15+
Key key,
16+
@required this.viewType,
17+
}) : assert(viewType != null),
18+
super(key: key);
1819

1920
/// The unique identifier for the view type to be embedded by this widget.
2021
///

dev/benchmarks/platform_views_layout_hybrid_composition/lib/main.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ void main() {
1919

2020
class PlatformViewApp extends StatefulWidget {
2121
const PlatformViewApp({
22-
Key? key
22+
Key key
2323
}) : super(key: key);
2424

2525
@override
2626
PlatformViewAppState createState() => PlatformViewAppState();
27+
28+
static PlatformViewAppState of(BuildContext context) => context.findAncestorStateOfType<PlatformViewAppState>();
2729
}
2830

2931
class PlatformViewAppState extends State<PlatformViewApp> {
@@ -44,7 +46,7 @@ class PlatformViewAppState extends State<PlatformViewApp> {
4446
}
4547

4648
class PlatformViewLayout extends StatelessWidget {
47-
const PlatformViewLayout({ Key? key }) : super(key: key);
49+
const PlatformViewLayout({ Key key }) : super(key: key);
4850

4951
@override
5052
Widget build(BuildContext context) {
@@ -74,12 +76,12 @@ class PlatformViewLayout extends StatelessWidget {
7476
}
7577

7678
class DummyPlatformView extends StatelessWidget {
77-
const DummyPlatformView({Key? key}) : super(key: key);
79+
const DummyPlatformView({Key key}) : super(key: key);
7880

7981
@override
8082
Widget build(BuildContext context) {
8183
const String viewType = 'benchmarks/platform_views_layout_hybrid_composition/DummyPlatformView';
82-
late Widget nativeView;
84+
Widget nativeView;
8385
if (Platform.isIOS) {
8486
nativeView = const UiKitView(
8587
viewType: viewType,
@@ -101,15 +103,15 @@ class DummyPlatformView extends StatelessWidget {
101103
}
102104

103105
class RotationContainer extends StatefulWidget {
104-
const RotationContainer({Key? key}) : super(key: key);
106+
const RotationContainer({Key key}) : super(key: key);
105107

106108
@override
107109
_RotationContainerState createState() => _RotationContainerState();
108110
}
109111

110112
class _RotationContainerState extends State<RotationContainer>
111113
with SingleTickerProviderStateMixin {
112-
late AnimationController _rotationController;
114+
AnimationController _rotationController;
113115

114116
@override
115117
void initState() {

dev/benchmarks/platform_views_layout_hybrid_composition/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: platform_views_layout_hybrid_composition
22
description: A benchmark for platform views, using hybrid composition on android.
33

44
environment:
5-
sdk: ">=2.12.0-0 <3.0.0"
5+
sdk: ">=2.2.0 <3.0.0"
66

77
dependencies:
88
flutter:

dev/benchmarks/platform_views_layout_hybrid_composition/test_driver/scroll_perf_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
77

88
void main() {
99
group('scrolling performance test', () {
10-
late FlutterDriver driver;
10+
FlutterDriver driver;
1111

1212
setUpAll(() async {
1313
driver = await FlutterDriver.connect();
@@ -16,7 +16,8 @@ void main() {
1616
});
1717

1818
tearDownAll(() async {
19-
driver.close();
19+
if (driver != null)
20+
driver.close();
2021
});
2122

2223
Future<void> testScrollPerf(String listKey, String summaryName) async {

0 commit comments

Comments
 (0)