webview_all 0.2.1
webview_all: ^0.2.1 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.
Android | ✅ | SDK 20+ |
IOS | ✅ | SDK 9.0+ |
Web | ✅ | Not widely tested |
Linux | ✅ | |
macOS | ✅ | WKWebview |
Windows | ✅ |
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 const MaterialApp(
title: 'Webview All',
debugShowCheckedModeBanner: false,
home: MyBrowser(),
);
}
}
class MyBrowser extends StatefulWidget {
const MyBrowser({Key? key, this.title}) : super(key: key);
final String? title;
@override
_MyBrowserState createState() => _MyBrowserState();
}
- launch webview
class _MyBrowserState extends State<MyBrowser> {
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(child: Webview(url: "https://www.baidu.com")));
}
}
Detail #
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 webf plugin and only support simple webpage.