interactive_webview icon indicating copy to clipboard operation
interactive_webview copied to clipboard

Can it be used with flutter_webview_plugin?

Open lyqiai opened this issue 5 years ago • 6 comments

it cant work for me. `import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; import 'package:interactive_webview/interactive_webview.dart';

const String url = 'http://192.168.1.3:3000';

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, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } }

class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key);

// This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect // how it looks.

// This class is the configuration for the state. It holds the values (in this // case the title) provided by the parent (in this case the App widget) and // used by the build method of the State. Fields in a Widget subclass are // always marked "final".

final String title;

@override _MyHomePageState createState() => _MyHomePageState(); }

class _MyHomePageState extends State<MyHomePage> { final _webView = new InteractiveWebView();

@override void initState() { super.initState(); init(); }

init() async { _webView.stateChanged.listen((state) { print('------------------------'); print(state); }); _webView.didReceiveMessage.listen((message) { print('-----------------------'); print(message.data.toString()); }); _webView.loadUrl(url); }

@override Widget build(BuildContext context) { return Scaffold( body: Padding( padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: Column( children: <Widget>[ Row( children: <Widget>[ RaisedButton( onPressed: () async {}, child: Text('back'), ), ], ), Expanded( child: WebviewScaffold( url: url, clearCache: true, )) ], ), ), ); } } `

lyqiai avatar Jun 23 '19 05:06 lyqiai

Sorry, what is not work for you? Can you please be more details?

duyduong avatar Jul 21 '19 09:07 duyduong

Sorry, what is not work for you? Can you please be more details?

I think what @lyqiai mean is : He wanted to use webkit.messageHandlers.native/window.native in flutter_webview_plugin loaded url. I also want to use your plugin @duyduong for communicating with flutter from the displayed webview.

t-walker-wei avatar Jul 22 '19 03:07 t-walker-wei

Sorry, u can't. My plugin used different web view instance. Maybe for next version, I will allow for display as an option

duyduong avatar Jul 22 '19 03:07 duyduong

Sorry, u can't. My plugin used different web view instance. Maybe for next version, I will allow for display as an option

It will be awesome if support display.And thank you.

t-walker-wei avatar Jul 23 '19 01:07 t-walker-wei

Notify u guys when it is ready for displaying

duyduong avatar Sep 10 '19 09:09 duyduong

Great plugin! if only could display, would be much better, thanks for the effort anyway

cgalvar avatar Sep 23 '20 20:09 cgalvar