buildView method
Widget
buildView(
- Map<
String, dynamic> creationParams, - Set<
Factory< ? gestureRecognizers,OneSequenceGestureRecognizer> > - PlatformViewCreatedCallback onPlatformViewCreated
override
This method builds the appropriate platform view where the street view
can be rendered.
The viewId
is passed as a parameter from the framework on the
onPlatformViewCreated
callback.
Implementation
@override
Widget buildView(
Map<String, dynamic> creationParams,
Set<Factory<OneSequenceGestureRecognizer>>? gestureRecognizers,
PlatformViewCreatedCallback onPlatformViewCreated) {
// This is used in the platform side to register the view.
final String viewType = 'my_street_view';
if (defaultTargetPlatform == TargetPlatform.android) {
return AndroidView(
viewType: viewType,
onPlatformViewCreated: onPlatformViewCreated,
creationParams: creationParams,
gestureRecognizers: gestureRecognizers,
creationParamsCodec: const StandardMessageCodec());
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
return UiKitView(
viewType: viewType,
onPlatformViewCreated: onPlatformViewCreated,
creationParams: creationParams,
gestureRecognizers: gestureRecognizers,
creationParamsCodec: const StandardMessageCodec());
}
return Text(
'$defaultTargetPlatform is not yet supported by the maps plugin');
}