Coder Social home page Coder Social logo

web_vuw's Introduction

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;

web_vuw's People

Contributors

bugsbunnybr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.