interactive_webview
interactive_webview copied to clipboard
Can it be used with flutter_webview_plugin?
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, )) ], ), ), ); } } `
Sorry, what is not work for you? Can you please be more details?
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.
Sorry, u can't. My plugin used different web view instance. Maybe for next version, I will allow for display as an option
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.
Notify u guys when it is ready for displaying
Great plugin! if only could display, would be much better, thanks for the effort anyway