This reverts commit 61c30eed4f.
This commit is contained in:
@@ -16,8 +16,7 @@ found in the LICENSE file. -->
|
||||
android:launchMode="singleTop"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:exported="true">
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<meta-data
|
||||
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
|
||||
android:value="true" />
|
||||
@@ -29,5 +28,9 @@ found in the LICENSE file. -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
<!-- Hybrid composition -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedded_views_preview"
|
||||
android:value="true" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -17,7 +17,6 @@ class AndroidPlatformView extends StatelessWidget {
|
||||
const AndroidPlatformView({
|
||||
Key? key,
|
||||
this.onPlatformViewCreated,
|
||||
this.useHybridComposition = false,
|
||||
required this.viewType,
|
||||
}) : assert(viewType != null),
|
||||
super(key: key);
|
||||
@@ -32,9 +31,6 @@ class AndroidPlatformView extends StatelessWidget {
|
||||
/// May be null.
|
||||
final PlatformViewCreatedCallback? onPlatformViewCreated;
|
||||
|
||||
// Use hybrid composition.
|
||||
final bool useHybridComposition;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PlatformViewLink(
|
||||
@@ -48,27 +44,17 @@ class AndroidPlatformView extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
onCreatePlatformView: (PlatformViewCreationParams params) {
|
||||
print('useHybridComposition=$useHybridComposition');
|
||||
late AndroidViewController controller;
|
||||
if (useHybridComposition) {
|
||||
controller = PlatformViewsService.initExpensiveAndroidView(
|
||||
final AndroidViewController controller =
|
||||
PlatformViewsService.initSurfaceAndroidView(
|
||||
id: params.id,
|
||||
viewType: params.viewType,
|
||||
layoutDirection: TextDirection.ltr,
|
||||
);
|
||||
} else {
|
||||
controller = PlatformViewsService.initSurfaceAndroidView(
|
||||
id: params.id,
|
||||
viewType: params.viewType,
|
||||
layoutDirection: TextDirection.ltr,
|
||||
);
|
||||
}
|
||||
)
|
||||
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated);
|
||||
if (onPlatformViewCreated != null) {
|
||||
controller.addOnPlatformViewCreatedListener(onPlatformViewCreated!);
|
||||
}
|
||||
return controller
|
||||
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
|
||||
..create();
|
||||
return controller..create();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ class NestedViewEventBodyState extends State<NestedViewEventBody> {
|
||||
int? id;
|
||||
int nestedViewClickCount = 0;
|
||||
bool showPlatformView = true;
|
||||
bool useHybridComposition = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -56,7 +55,6 @@ class NestedViewEventBodyState extends State<NestedViewEventBody> {
|
||||
key: const ValueKey<String>('PlatformView'),
|
||||
viewType: 'simple_view',
|
||||
onPlatformViewCreated: onPlatformViewCreated,
|
||||
useHybridComposition: useHybridComposition,
|
||||
) : null,
|
||||
),
|
||||
if (_lastTestStatus != _LastTestStatus.pending) _statusWidget(),
|
||||
@@ -71,15 +69,6 @@ class NestedViewEventBodyState extends State<NestedViewEventBody> {
|
||||
onPressed: onTogglePlatformView,
|
||||
child: const Text('TOGGLE PLATFORM VIEW'),
|
||||
),
|
||||
ElevatedButton(
|
||||
key: const ValueKey<String>('ToggleHybridComposition'),
|
||||
child: const Text('TOGGLE HYBRID COMPOSITION'),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
useHybridComposition = !useHybridComposition;
|
||||
});
|
||||
},
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
ElevatedButton(
|
||||
|
||||
@@ -59,58 +59,10 @@ Future<void> main() async {
|
||||
}, timeout: Timeout.none);
|
||||
});
|
||||
|
||||
group('Flutter surface without hybrid composition', () {
|
||||
group('Flutter surface switch', () {
|
||||
setUpAll(() async {
|
||||
await driver.tap(find.byValueKey('NestedViewEventTile'));
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
await driver.waitFor(find.pageBack());
|
||||
await driver.tap(find.pageBack());
|
||||
});
|
||||
|
||||
test('Uses FlutterSurfaceView when Android view is on the screen', () async {
|
||||
await driver.waitFor(find.byValueKey('PlatformView'));
|
||||
|
||||
expect(
|
||||
await driver.requestData('hierarchy'),
|
||||
'|-FlutterView\n'
|
||||
' |-FlutterSurfaceView\n' // Flutter UI
|
||||
' |-ViewGroup\n' // Platform View
|
||||
' |-ViewGroup\n'
|
||||
);
|
||||
|
||||
// Hide platform view.
|
||||
final SerializableFinder togglePlatformView = find.byValueKey('TogglePlatformView');
|
||||
await driver.tap(togglePlatformView);
|
||||
await driver.waitForAbsent(find.byValueKey('PlatformView'));
|
||||
|
||||
expect(
|
||||
await driver.requestData('hierarchy'),
|
||||
'|-FlutterView\n'
|
||||
' |-FlutterSurfaceView\n' // Just the Flutter UI
|
||||
);
|
||||
|
||||
// Show platform view again.
|
||||
await driver.tap(togglePlatformView);
|
||||
await driver.waitFor(find.byValueKey('PlatformView'));
|
||||
|
||||
expect(
|
||||
await driver.requestData('hierarchy'),
|
||||
'|-FlutterView\n'
|
||||
' |-FlutterSurfaceView\n' // Flutter UI
|
||||
' |-ViewGroup\n' // Platform View
|
||||
' |-ViewGroup\n'
|
||||
);
|
||||
}, timeout: Timeout.none);
|
||||
});
|
||||
|
||||
group('Flutter surface with hybrid composition', () {
|
||||
setUpAll(() async {
|
||||
await driver.tap(find.byValueKey('NestedViewEventTile'));
|
||||
await driver.tap(find.byValueKey('ToggleHybridComposition'));
|
||||
await driver.tap(find.byValueKey('TogglePlatformView'));
|
||||
await driver.tap(find.byValueKey('TogglePlatformView'));
|
||||
final SerializableFinder wmListTile = find.byValueKey('NestedViewEventTile');
|
||||
await driver.tap(wmListTile);
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
|
||||
Reference in New Issue
Block a user