flutter web and iframe

1,055 views
Skip to first unread message

Madhan Rajan

unread,
Apr 13, 2020, 1:53:20 PM4/13/20
to Flutter Development (flutter-dev)
Hi, does anyone has luck with implementing iframes with flutter??

sukhbeer kumar

unread,
Apr 13, 2020, 2:12:28 PM4/13/20
to Madhan Rajan, Flutter Development (flutter-dev)
yes, please let me know what issue you are facing.
Thanks
 
sukhbeer kumar


On Mon, Apr 13, 2020 at 11:23 PM Madhan Rajan <madhanrajan....@gmail.com> wrote:
Hi, does anyone has luck with implementing iframes with flutter??

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/0baa0e4b-e032-4963-8127-2b26258adf1a%40googlegroups.com.

Madhan Rajan

unread,
Apr 13, 2020, 2:14:19 PM4/13/20
to Flutter Development (flutter-dev)
I am trhying to implement iframes with flutter web but so far webview does not work!

Madhan Rajan

unread,
Apr 13, 2020, 2:30:38 PM4/13/20
to Flutter Development (flutter-dev)

https://medium.com/flutter-community/flutter-web-and-iframe-f26399aa1e2a

import 'dart:html';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';

void main() {
 runApp(MyApp());
}

class MyApp extends StatelessWidget {
 // This widget is the root of your application.
 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     title: 'Flutter Demo',
     theme: ThemeData(
       // This is the theme of your application.
       //
       // Try running your application with "flutter run". You'll see the
       // application has a blue toolbar. Then, without quitting the app, try
       // changing the primarySwatch below to Colors.green and then invoke
       // "hot reload" (press "r" in the console where you ran "flutter run",
       // or simply save your changes to "hot reload" in a Flutter IDE).
       // Notice that the counter didn't reset back to zero; the application
       // is not restarted.
       primarySwatch: Colors.blue,
       // This makes the visual density adapt to the platform that you run
       // the app on. For desktop platforms, the controls will be smaller and
       // closer together (more dense) than on mobile platforms.
       visualDensity: VisualDensity.adaptivePlatformDensity,
     ),
     home: MyHomePage(),
   );
 }
}

class MyHomePage extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   // TODO: implement build
   return Scaffold(
     appBar: AppBar(
       title: Text("Test"),
     ),
     body: Center(
       child: WebView(),
     ),
   );
 }
}

class WebView extends StatefulWidget {
 String url;
 @override
 _WebViewState createState() => _WebViewState();
}

class _WebViewState extends State<WebView> {
 Widget _iframeWidget;
 final IFrameElement _iframeElement = IFrameElement();

  @override
 Widget build(BuildContext context) {
   return SizedBox(
     child: _iframeWidget,
     width: 500,
     height: 500,
   );
 }

  @override
 void initState() {
   // TODO: implement initState

    _iframeElement.src = "www.google.com";
   _iframeElement.width = '500';
   _iframeElement.height = '500';

    _iframeElement.style.border = 'none';

    ui.platformViewRegistry
       .registerViewFactory('iframeelement', (viewId) => _iframeElement);

    _iframeWidget =
       HtmlElementView(viewType: 'iframeelement', key: UniqueKey());

    super.initState();
 }
}

Madhan Rajan

unread,
Apr 13, 2020, 2:31:24 PM4/13/20
to Flutter Development (flutter-dev)
Here's the entire code!


On Monday, April 13, 2020 at 6:53:20 PM UTC+1, Madhan Rajan wrote:

Suzuki Tomohiro

unread,
Apr 13, 2020, 2:49:08 PM4/13/20
to Flutter Development (flutter-dev)
(I don't use Flutter web)
Would you describe which part is not working for you? Screenshots?


--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

Madhan Rajan

unread,
Apr 13, 2020, 2:50:36 PM4/13/20
to Flutter Development (flutter-dev)
The webview doesn't seem to load


On Monday, April 13, 2020 at 6:53:20 PM UTC+1, Madhan Rajan wrote:

Souvik Dutta

unread,
Apr 13, 2020, 8:56:31 PM4/13/20
to Madhan Rajan, Flutter Development (flutter-dev)
Any other errors? I think internet problems might be the cause.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

Madhan Rajan

unread,
Apr 13, 2020, 9:02:33 PM4/13/20
to Flutter Development (flutter-dev)
That's the only error, I can't seem to connect the internet to the web view


On Tuesday, April 14, 2020 at 1:56:31 AM UTC+1, Souvik Dutta wrote:
Any other errors? I think internet problems might be the cause.

On Tue, 14 Apr, 2020, 12:20 am Madhan Rajan, <madhanrajan...@gmail.com> wrote:
The webview doesn't seem to load

On Monday, April 13, 2020 at 6:53:20 PM UTC+1, Madhan Rajan wrote:
Hi, does anyone has luck with implementing iframes with flutter??

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.

Souvik Dutta

unread,
Apr 13, 2020, 9:11:10 PM4/13/20
to Madhan Rajan, Flutter Development (flutter-dev)
Any stack trace in the run menu?

To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/de828a50-72df-4f13-92a7-c0ba947fc811%40googlegroups.com.

Madhan Rajan

unread,
Apr 13, 2020, 9:13:24 PM4/13/20
to Flutter Development (flutter-dev)
How do I get the stack trace?


On Tuesday, April 14, 2020 at 2:11:10 AM UTC+1, Souvik Dutta wrote:
Any stack trace in the run menu?

On Tue, 14 Apr, 2020, 6:32 am Madhan Rajan, <madhanrajan...@gmail.com> wrote:
That's the only error, I can't seem to connect the internet to the web view

On Tuesday, April 14, 2020 at 1:56:31 AM UTC+1, Souvik Dutta wrote:
Any other errors? I think internet problems might be the cause.

On Tue, 14 Apr, 2020, 12:20 am Madhan Rajan, <madhanrajan...@gmail.com> wrote:
The webview doesn't seem to load

On Monday, April 13, 2020 at 6:53:20 PM UTC+1, Madhan Rajan wrote:
Hi, does anyone has luck with implementing iframes with flutter??

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/728981bd-2c34-4e8f-b3f7-4b122b307dce%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.

Souvik Dutta

unread,
Apr 13, 2020, 9:14:57 PM4/13/20
to Madhan Rajan, Flutter Development (flutter-dev)
It is present in your run tab in android studio

To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/b883c3d4-78d8-4f96-8a22-4e7c40d4e8ac%40googlegroups.com.

Madhan Rajan

unread,
Apr 13, 2020, 9:17:36 PM4/13/20
to Flutter Development (flutter-dev)
Oh, I'm using vscode!


On Tuesday, April 14, 2020 at 2:14:57 AM UTC+1, Souvik Dutta wrote:
It is present in your run tab in android studio

On Tue, 14 Apr, 2020, 6:43 am Madhan Rajan, <madhanrajan...@gmail.com> wrote:
How do I get the stack trace?

On Tuesday, April 14, 2020 at 2:11:10 AM UTC+1, Souvik Dutta wrote:
Any stack trace in the run menu?

On Tue, 14 Apr, 2020, 6:32 am Madhan Rajan, <madhanrajan...@gmail.com> wrote:
That's the only error, I can't seem to connect the internet to the web view

On Tuesday, April 14, 2020 at 1:56:31 AM UTC+1, Souvik Dutta wrote:
Any other errors? I think internet problems might be the cause.

On Tue, 14 Apr, 2020, 12:20 am Madhan Rajan, <madhanrajan...@gmail.com> wrote:
The webview doesn't seem to load

On Monday, April 13, 2020 at 6:53:20 PM UTC+1, Madhan Rajan wrote:
Hi, does anyone has luck with implementing iframes with flutter??

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/728981bd-2c34-4e8f-b3f7-4b122b307dce%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/de828a50-72df-4f13-92a7-c0ba947fc811%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages