web_browser 0.2.1 web_browser: ^0.2.1 copied to clipboard
Widgets for showing web pages and web content. Uses webview_flutter in Android/iOS and iframe in browsers.
Overview #
Web browser and HTML rendering widgets for Flutter application. Licensed under the Apache License 2.0.
In Android and iOS, this package uses webview_flutter,
which is maintained by Google. However, webview_flutter works only in Android and iOS. This
package works in browsers too by using <iframe>
and other HTML elements. The iframe relies on a
dart:ui API that is currently undocumented.
For easy cross-platform DOM manipulation, the package also exports package:web_browser/html.dart
,
which is a cross-platform dart:html taken from universal_html,
a sibling project of this package.
The main widgets in this package are:
- WebBrowser
- Shows any web page.
- By default, the widget gives you:
- Address bar
- "Share link" button
- "Back" button
- "Forward" button
- WebNode
- Shows any DOM node. DOM nodes work in Android and iOS too, thanks to universal_html.
Pull request are welcome! Please test your changes manually with the example application.
Links #
Known issues #
- Flickering in browsers (Flutter issue #51865)
Setting up #
1.Setup #
In pubspec.yaml:
dependencies:
web_browser: ^0.2.0
For iOS support, you should follow the usual webview_flutter
instructions, which means adding the following snippet in ios/Runner/Info.plist
:
<key>io.flutter.embedded_views_preview</key>
<true />
2. Try it #
import 'package:flutter/material.dart';
import 'package:web_browser/web_browser.dart';
void main() {
runApp(MaterialApp(
home: Scaffold(
body: SafeArea(
child: WebBrowser(
initialUrl: 'https://flutter.dev/',
javascriptEnabled: true,
),
),
),
));
}