Usage of a platform view widget

The usage of a platform widget is as simple as using an ordinary widget. Apart from the specific configuration previously provided for the iOS platform, there is nothing more needed. We just use it as a normal widget:

  @override
Widget build(BuildContext context) {
return MaterialApp(
home: Container(
alignment: Alignment.center,
color: Colors.red,
child: SizedBox(
height: 100,
child: HandsOnTextView(
text: "Text from Platform view",
),
),
),
);
}
Check the hands_on_platform_views example on GitHub for the complete plugin code. 

After that, the platform widget looks like any other widget:

Wrapping the platform view into SizedBox limits its dimensions; otherwise, it would take all of the available space. However, this is not mandatory; the AndroidView and UiKitView classes are responsible for making the platform views present into the widget hierarchy in other widgets.

It is important to note that embedding platform views is an expensive operation as the Flutter engine needs to manage the resources required by each of them. So, using platform views should be avoided when a Flutter equivalent is possible.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.127.232