Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can it be used with flutter_webview_plugin? #9

Open
lyqiai opened this issue Jun 23, 2019 · 6 comments
Open

Can it be used with flutter_webview_plugin? #9

lyqiai opened this issue Jun 23, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@lyqiai
Copy link

lyqiai commented Jun 23, 2019

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 {
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: [
Row(
children: [
RaisedButton(
onPressed: () async {},
child: Text('back'),
),
],
),
Expanded(
child: WebviewScaffold(
url: url,
clearCache: true,
))
],
),
),
);
}
}
`

@duyduong
Copy link
Owner

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

@t-walker-wei
Copy link

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.

@duyduong
Copy link
Owner

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

@t-walker-wei
Copy link

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.

@duyduong duyduong added the enhancement New feature or request label Sep 10, 2019
@duyduong
Copy link
Owner

Notify u guys when it is ready for displaying

@duyduong duyduong self-assigned this Sep 10, 2019
@cgalvar
Copy link

cgalvar commented Sep 23, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants