web_vuw 0.2.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 86

web_vuw #

A plugin that can embedded (web view) with flutter widgets. #

The web view on iOS support by wkwebview

The web view on Android support by WebView

📣 important note

  • Android keyboard cannot be appear according to this flutter issue 19718
  • Not support scrollview

support

  • Can embedded in widget tree ✅
  • Pull to refresh (true / false) ✅
  • Add header ✅
  • Add userAgent ✅
  • Can handl all webview callback method ✅
  • Can call evaluateJavascript ✅
  • Can load HTML ✅

Demo #

alt-text-1

NOTE: For iOS you need to put the key => io.flutter.embedded_views_preview and the value YES in Info.plist

To use this plugin: #

    dependencies:
       flutter:
        sdk: flutter
       web_vuw:

How it works #

See Full example in example

Basic

    new WebVuw(
        initialUrl: 'www.url.com',
        enableJavascript: true,
        pullToRefresh: true,
        header: {
            .....
        }
        userAgent: 'userAgent',
        // to load html string
        // html: '<body><h1>this is web vuw</h1></body>',
        gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
            Factory<OneSequenceGestureRecognizer>(
                () => EagerGestureRecognizer(),
            ),
        ].toSet(),
        javaScriptMode: JavaScriptMode.unrestricted,
        onWebViewCreated: (WebVuwController webViewController) {
            _controller.complete(webViewController);
        }
    )

Listen to webview events #

First 1️⃣ 👇🏻 #


//    ...
    StreamSubscription _ssWebVuwEvents;

    @override
    Widget build(BuildContext context) {
        return FutureBuilder<WebVuwController>(
        future: _controller.future,
        builder:
            (BuildContext context, AsyncSnapshot<WebVuwController> snapshot) {
            final webViewReady = 
                snapshot.connectionState == ConnectionState.done;
            final controller = snapshot.data;

            if (webViewReady) {
                // You can now call the functions
                // controller.stopLoading();
                _ssWebVuwEvents = controller.onEvents().listen((events) {
                    print('Events 😎=> $events');
                });
            }
    ...

Second 2️⃣ 👇🏻 #

    @override
    void dispose() {
        if (_ssWebVuwEvents != null) _ssWebVuwEvents.cancel();
        super.dispose();
    }
    ..

Functions 👨🏻‍💻 #

Future<void> loadUrl(String url);
Future<bool> canGoBack();
Future<bool> canGoForward();
Future<void> goBack();
Future<void> goForward();
Future<void> stopLoading();
Future<void> reload();
Future<void> forward();
Future<dynamic> evaluateJavascript(String javascriptString);
 Future<void> loadHtml(String html);
Stream onEvents;

0.0.1 Release #

  • First release for lib

example/README.md

web_vuw_example #

Demonstrates how to use the web_vuw plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  web_vuw: ^0.2.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:web_vuw/web_vuw.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
73
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
86
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
flutter_test 0.0.0
Transitive dependencies
async 2.3.0 2.4.0
boolean_selector 1.0.5
charcode 1.1.2
collection 1.14.11 1.14.12
matcher 0.12.5
meta 1.1.7
path 1.6.4
pedantic 1.8.0+1
quiver 2.0.5
sky_engine 0.0.99
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
string_scanner 1.0.5
term_glyph 1.1.0
test_api 0.2.5 0.2.9
typed_data 1.1.6
vector_math 2.0.8