From 13bd52bf9e25ea4aa1372821c9da37ac73b672b6 Mon Sep 17 00:00:00 2001 From: Harry Terkelsen Date: Thu, 29 Aug 2019 12:49:04 -0700 Subject: [PATCH] Add HtmlElementView (the Flutter Web platform view) (#37819) * Implement HtmlView, the platform view widget for Flutter Web * Document HtmlView constructor * Respond to review comments * - Rename to HtmlElementView - Assert running on web - Move test to Chrome-only file --- .../lib/src/widgets/platform_view.dart | 118 ++++++++++ .../test/services/fake_platform_views.dart | 91 ++++++++ .../test/widgets/html_element_view_test.dart | 210 ++++++++++++++++++ .../test/widgets/platform_view_test.dart | 1 - 4 files changed, 419 insertions(+), 1 deletion(-) create mode 100644 packages/flutter/test/widgets/html_element_view_test.dart diff --git a/packages/flutter/lib/src/widgets/platform_view.dart b/packages/flutter/lib/src/widgets/platform_view.dart index 6573aa0261..54a0667e62 100644 --- a/packages/flutter/lib/src/widgets/platform_view.dart +++ b/packages/flutter/lib/src/widgets/platform_view.dart @@ -296,6 +296,124 @@ class UiKitView extends StatefulWidget { State createState() => _UiKitViewState(); } +/// 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. +/// +/// {@macro flutter.widgets.platformViews.layout} +/// +/// Due to security restrictions with cross-origin `