buildView method
Widget
buildView(
- int creationId,
- PlatformViewCreatedCallback onPlatformViewCreated, {
- Map<
String, dynamic> params = const <String, dynamic>{},
override
Implementation
@override
Widget buildView(
int creationId,
PlatformViewCreatedCallback onPlatformViewCreated, {
Map<String, dynamic> params = const <String, dynamic>{},
}) {
if (defaultTargetPlatform == TargetPlatform.android) {
const viewType = 'oneplusdream/video_player_android';
return PlatformViewLink(
viewType: viewType,
surfaceFactory: (context, controller) {
return AndroidViewSurface(
controller: controller as AndroidViewController,
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
hitTestBehavior: PlatformViewHitTestBehavior.opaque,
);
},
onCreatePlatformView: (params) {
return PlatformViewsService.initSurfaceAndroidView(
id: params.id,
viewType: viewType,
layoutDirection: TextDirection.ltr,
creationParams: params,
creationParamsCodec: const StandardMessageCodec(),
onFocus: () {
params.onFocusChanged(true);
},
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..addOnPlatformViewCreatedListener(onPlatformViewCreated)
..create();
},
);
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
return UiKitView(
viewType: 'oneplusdream/video_player_ios',
onPlatformViewCreated: onPlatformViewCreated,
creationParams: params,
creationParamsCodec: const StandardMessageCodec(),
);
}
return Text(
'$defaultTargetPlatform is not yet supported by the maps plugin');
}