Unverified Commit 0b087a89 authored by Chris Yang's avatar Chris Yang Committed by GitHub

PlatformViewLink: update cached surface to be Widget type (#38639)

parent ff0eca64
...@@ -678,7 +678,7 @@ class _PlatformViewLinkState extends State<PlatformViewLink> { ...@@ -678,7 +678,7 @@ class _PlatformViewLinkState extends State<PlatformViewLink> {
int _id; int _id;
PlatformViewController _controller; PlatformViewController _controller;
bool _platformViewCreated = false; bool _platformViewCreated = false;
PlatformViewSurface _surface; Widget _surface;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
......
...@@ -1968,7 +1968,6 @@ void main() { ...@@ -1968,7 +1968,6 @@ void main() {
testWidgets('PlatformViewLink Widget dispose', (WidgetTester tester) async { testWidgets('PlatformViewLink Widget dispose', (WidgetTester tester) async {
FakePlatformViewController disposedController; FakePlatformViewController disposedController;
final PlatformViewLink platformViewLink = PlatformViewLink(createPlatformViewController: (PlatformViewCreationParams params){ final PlatformViewLink platformViewLink = PlatformViewLink(createPlatformViewController: (PlatformViewCreationParams params){
params.onPlatformViewCreated(params.id);
disposedController = FakePlatformViewController(params.id); disposedController = FakePlatformViewController(params.id);
params.onPlatformViewCreated(params.id); params.onPlatformViewCreated(params.id);
return disposedController; return disposedController;
...@@ -2041,5 +2040,21 @@ void main() { ...@@ -2041,5 +2040,21 @@ void main() {
]), ]),
); );
}); });
testWidgets('PlatformViewLink can take any widget to return in the SurfaceFactory', (WidgetTester tester) async {
final PlatformViewLink platformViewLink = PlatformViewLink(createPlatformViewController: (PlatformViewCreationParams params){
params.onPlatformViewCreated(params.id);
return FakePlatformViewController(params.id);
}, surfaceFactory: (BuildContext context,PlatformViewController controller) {
return Container();
});
await tester.pumpWidget(platformViewLink);
final Container container = tester.allWidgets.firstWhere((Widget widget){
return widget is Container;
});
expect(container, isNotNull);
});
}); });
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment