flutter_webview_plugin icon indicating copy to clipboard operation
flutter_webview_plugin copied to clipboard

This plugin isn't working in flutter web. After launching the webview the spinner keeps on spinning with no errors.

Open simmi9 opened this issue 6 years ago • 10 comments

import 'package:flutter/material.dart'; import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';

String url = "https://google.com/";

void main() => runApp(MyApp());

class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Webview Example', theme: ThemeData.dark(), routes: { "/": () => Home(), "/webview": () => WebviewScaffold( url: url, appBar: AppBar( title: Text("WebView"), ), withJavascript: true, withLocalStorage: true, withZoom: true, ) }, ); } }

class Home extends StatefulWidget { @override HomeState createState() => HomeState(); }

class HomeState extends State { final webView = FlutterWebviewPlugin(); TextEditingController controller = TextEditingController(text: url);

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

webView.close();
controller.addListener(() {
  url = controller.text;
});

}

@override void dispose() { webView.dispose(); controller.dispose(); super.dispose(); }

@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("WebView"), ), body: Center( child: Column( children: [ Container( padding: EdgeInsets.all(10.0), child: TextField( controller: controller, ), ), RaisedButton( child: Text("Open Webview"), onPressed: () { Navigator.of(context).pushNamed("/webview"); }, ) ], ), )); } }

simmi9 avatar Feb 24 '20 15:02 simmi9

Same problem :(

shashwatadi avatar Feb 28 '20 21:02 shashwatadi

Same issue here.

These are the exceptions I get in the developer console:

Overflow on channel: flutter_webview_plugin. Messages on this channel are being discarded in FIFO fashion. The engine may not be running or you need to adjust the buffer size if of the channel.

errors.dart:147 Uncaught (in promise) Error: MissingPluginException(No implementation found for method launch on channel flutter_webview_plugin) at Object.throw_ [as throw] (errors.dart:196) at MethodChannel._invokeMethod (platform_channel.dart:154) at _invokeMethod.next (<anonymous>) at onValue (async_patch.dart:47) at _RootZone.runUnary (zone.dart:1381) at _FutureListener.thenAwait.handleValue (future_impl.dart:140) at handleValueCallback (future_impl.dart:682) at Function._propagateToListeners (future_impl.dart:711) at _Future.new.[_completeWithValue] (future_impl.dart:526) at async._AsyncCallbackEntry.new.callback (future_impl.dart:556) at Object._microtaskLoop (schedule_microtask.dart:43) at _startMicrotaskLoop (schedule_microtask.dart:52) at async_patch.dart:168

dazza5000 avatar Mar 02 '20 03:03 dazza5000

I switched to use an alternative approach and now just launch a new tab using url_launcher on web.

dazza5000 avatar Mar 08 '20 13:03 dazza5000

My use case is to provide additional features on top of the web view, so this alternative approach doesn't work for me @dazza5000. If anybody figures out any other way, I'll be obliged :)

shashwatadi avatar Mar 08 '20 13:03 shashwatadi

I build my own small plugin what implements this and on start it checks kIsWeb constant (comes from Flutter) and if its false, I use this plugin. However if it's true, I'm on Flutter Web and I can build some other way to manage what I'm trying to do.

From what I gather, web isn't implemented. Web required registerWith function for a plugin.

I think this really is a missing feature...however, this creates a webview for Android and iOS. What would that actually be on a browser? Iframe? Container with HTML content inside it?

Would be handy to have something like this implemented. Works very well for OAUTH2 login for example.

villematti avatar Mar 09 '20 18:03 villematti

I think iframeelement might be an acceptable web approach

dazza5000 avatar Mar 12 '20 21:03 dazza5000

Hi guys!

I'm really interested to help on this. @villematti do you have any update about your work?

achamorro-dev avatar Mar 21 '20 15:03 achamorro-dev

@ach4m0 Nothing progressive really. I ended up using that kIsWeb variable and that does work well enough in my current project.

I'm planing on getting back to this when I have more time.

villematti avatar Mar 25 '20 08:03 villematti

Hi , I need this to be fixed also. Stucked. PLEASE HELP, PLEASE FIX THIS .........thank You

anastasiyakisel avatar Apr 04 '20 07:04 anastasiyakisel

Hi , I need this to be fixed also. Stucked. PLEASE HELP, PLEASE FIX THIS .........thank You

For now you can use this plugin. However, there are some issues with iframes being rerendered (see #53253 ) but there is a partial fix that is under review.

jonaird avatar Apr 04 '20 07:04 jonaird