build method
此处是为了创建一个对应的平台View
Implementation
@override
Widget build(BuildContext context) {
if (channelType == BRTCCloudConfig.BRTC_VideoView_Texture) {
if (textureId != null) {
return Texture(textureId: textureId!);
}
return Container();
}
if (Platform.isAndroid) {
return AndroidView(
viewType: channelType.toString(),
onPlatformViewCreated: _onPlatformViewCreated,
gestureRecognizers: widget.gestureRecognizers,
creationParams: <String, dynamic>{
"x": videoParam!.x,
"y": videoParam!.y,
"width": videoParam!.width,
"height": videoParam!.height
},
creationParamsCodec: const StandardMessageCodec(),
);
} else if (Platform.isIOS) {
widget.uiKitView = UiKitView(
viewType: channelType.toString(),
onPlatformViewCreated: _onPlatformViewCreated,
gestureRecognizers: widget.gestureRecognizers,
creationParams: <String, dynamic>{
"x": videoParam!.x,
"y": videoParam!.y,
"width": videoParam!.width,
"height": videoParam!.height
},
creationParamsCodec: const StandardMessageCodec(),
);
return widget.uiKitView!;
} else {
return Center(
child: Text(
"This platform does not support `Platform View`",
style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),
),
);
}
}