diff --git a/packages/flutter/lib/src/widgets/platform_view.dart b/packages/flutter/lib/src/widgets/platform_view.dart index 2ae217ebc9d..ae24e58757f 100644 --- a/packages/flutter/lib/src/widgets/platform_view.dart +++ b/packages/flutter/lib/src/widgets/platform_view.dart @@ -19,6 +19,8 @@ import 'framework.dart'; // PlatformViewController createFooWebView(PlatformViewCreationParams params) { return (null as dynamic) as PlatformViewController; } // Set> gestureRecognizers = >{}; // late PlatformViewController _controller; +// void myOnElementCreated(Object element) {} +// void myOnPlatformViewCreated(int viewId) {} /// Embeds an Android view in the Widget hierarchy. /// @@ -358,49 +360,291 @@ class AppKitView extends _DarwinView { State createState() => _AppKitViewState(); } -/// Callback signature for when the platform view's DOM element was created. +/// The signature of the function that gets called when the [HtmlElementView] +/// DOM element is created. /// /// [element] is the DOM element that was created. /// -/// Also see [HtmlElementView.fromTagName] that uses this callback -/// signature. +/// This callback is called before [element] is attached to the DOM, so it can +/// be modified as needed by the Flutter web application. +/// +/// See [HtmlElementView.fromTagName] that receives a callback of this type. +/// +/// {@template flutter.widgets.web.JSInterop.object} +/// Flutter uses type `Object` so this API doesn't force any JS interop API +/// implementation to Flutter users. This `element` can be cast to any compatible +/// JS interop type as needed. For example: `JSAny` (from `dart:js_interop`), +/// `HTMLElement` (from `package:web`) or any custom JS interop definition. +/// See "Next-generation JS interop": https://dart.dev/interop/js-interop +/// {@endtemplate} typedef ElementCreatedCallback = void Function(Object element); -/// Embeds an HTML element in the Widget hierarchy in Flutter Web. +/// Embeds an HTML element in the Widget hierarchy in Flutter web. /// -/// *NOTE*: This only works in Flutter Web. To embed web content on other -/// platforms, consider using the `flutter_webview` plugin. -/// -/// Embedding HTML is an expensive operation and should be avoided when a -/// Flutter equivalent is possible. -/// -/// The embedded HTML is painted just like any other Flutter widget and -/// transformations apply to it as well. This widget should only be used in -/// Flutter Web. +/// The embedded HTML is laid out like any other Flutter widget and +/// transformations (like opacity, and clipping) apply to it as well. /// /// {@macro flutter.widgets.AndroidView.layout} /// -/// Due to security restrictions with cross-origin `