PlatformViewLink: update cached surface to be Widget type (#38639)
This commit is contained in:
parent
ff0eca6463
commit
0b087a898a
@ -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() {
|
|||||||
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() {
|
|||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user