webview_all 0.1.2
webview_all: ^0.1.2 copied to clipboard
A webview component with full platform support, based on the existing package.
Webview for all Flutter Platform #
A webview widget with full platform support, based on the existing package.
Under rapid iteration, not recommended for now ⚠
On iOS the WebView widget is backed by a WKWebView.
On Android the WebView widget is backed by a WebView.
On web the WebView widget will use the webview_flutter_web plugin.
On desktop the WebView widget will use the desktop_webview_window plugin and open a new window to display the web page.
Android | ✅ | SDK 20+ |
IOS | ✅ | SDK 9.0+ |
Web | ✅ | Not widely tested |
Linux | ✅ | WebKitGTK-4.1 |
macOS | ✅ | WKWebview |
Windows | ✅ | Webview2 1.0.992.28 |
Usage #
-
Add
webview_all
as a dependency in your pubspec.yaml file. -
modify your
main.dart
.import 'package:flutter/material.dart'; import 'package:webview_all/webview_all.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Webview', theme: ThemeData( primarySwatch: Colors.blueGrey, ), home: const MyHomePage(title: 'Flutter Webview Demo'), debugShowCheckedModeBanner: false, ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override State<MyHomePage> createState() => _MyHomePageState(); }
-
launch webview
class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Webview(url: "https://flutter.dev/", appName: "Hello World")); } }
Linux Requirement #
sudo apt install webkit2gtk-4.1
Windows Requirement #
The backend of desktop_webview_window on Windows is WebView2, which requires WebView2 Runtime installed.
WebView2 Runtime is ship in box with Windows11, but it may not installed on Windows10 devices. So you need consider how to distribute the runtime to your users.
See more: https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution