How to add Webview to Flutter?

I know that you can add WebView as a full page, but could not find any sample code for this. I assume that you can use PageView as a base, but don’t know how to call your own Android web browser and add it to PageView.

Can someone point me in the right direction?

+7
source share
4 answers

Flutter does not have built-in support for embedded WebView. Follow release 730 for updates.

You can still display web content in your application, but you will have to leave Flutter-land using a plug-in system.

, Frutter url_launcher.

- (, ), UIViewController ( iOS) Activity ( Android) API- .

+10

You can use https://pub.dartlang.org/packages/webview_flutter

example

import 'package:webview_flutter/webview_flutter.dart';

return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter WebView example'),
      ),
      body: const WebView(
        initialUrl: 'https://flutter.io',
        javascriptMode: JavascriptMode.unrestricted,
      ),
    );
+3
source

You can use the dart plugin below to display Webview. You can also find the dart plugin at this address: https://pub.dartlang.org/packages/flutter_webview_plugin

new MaterialApp(
      routes: {
        "/": (_) => new WebviewScaffold(
          url: "https://www.google.com",
          appBar: new AppBar(
            title: new Text("Widget webview"),
          ),
        ),
      },
    );
0
source

Source: https://habr.com/ru/post/1694528/


All Articles