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

This commit is contained in:
Chris Yang 2019-08-16 11:23:21 -07:00 committed by GitHub
parent ff0eca6463
commit 0b087a898a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -678,7 +678,7 @@ class _PlatformViewLinkState extends State<PlatformViewLink> {
int _id;
PlatformViewController _controller;
bool _platformViewCreated = false;
PlatformViewSurface _surface;
Widget _surface;
@override
Widget build(BuildContext context) {

View File

@ -1968,7 +1968,6 @@ void main() {
testWidgets('PlatformViewLink Widget dispose', (WidgetTester tester) async {
FakePlatformViewController disposedController;
final PlatformViewLink platformViewLink = PlatformViewLink(createPlatformViewController: (PlatformViewCreationParams params){
params.onPlatformViewCreated(params.id);
disposedController = FakePlatformViewController(params.id);
params.onPlatformViewCreated(params.id);
return disposedController;
@ -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);
});
});
}