flutter_native_web 0.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new76

flutter_native_web

Native WebView as a widget in flutter

Inline WebView in flutter using AndroidView

Supported

  • Android

Note

  • Keypad is not working (No Support by flutter)
  • Don't use inside scrollview

Screenshot

Screenshot

How to Use


dependencies:
  flutter_native_web: "^0.1.2"
  

import 'package:flutter_native_web/flutterwebview.dart';


WebController webController;

FlutterWebView flutterWebView = new FlutterWebView(
  onWebCreated: onWebCreated,
);
 new Container(
    child: flutterWebViewString,
    height: 300.0,
    width: 500.0,
 ),
 void onWebCreated(webController) {
     this.webController = webController;
     this.webController.loadUrl("https://facebook.com");
     this.webController.onPageStarted.listen((url) =>
         print("Loading $url")
     );
     this.webController.onPageFinished.listen((url) =>
         print("Finished loading $url")
     );
 }

or

 String html = '<body>Hello world! <a href="www.html5rocks.com">HTML5 rocks!';

 void onWebCreated(webController) {
     this.webController = webController;
     this.webController.loadData(html);
     this.webController.onPageStarted.listen((url) =>
         print("Loading $url")
     );
     this.webController.onPageFinished.listen((url) =>
         print("Finished loading $url")
     );
 }

Android

Ensure the following permission is present in your Android Manifest file, located in `<project root>/android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET"/>

Coming soon

  • JSInterface
  • more (suggest)

0.1.2

  • Initial release
  • Full html support
  • only android supported

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:flutter_native_web/flutterwebview.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {

  WebController webController;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {

    FlutterWebView flutterWebView = new FlutterWebView(
      onWebCreated: onWebCreated,
    );

    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Native WebView as Widget'),
        ),
        body: new SingleChildScrollView(
          child: new Column(
            children: <Widget>[
              new Text('Native WebView as Widget\n\n'),
              new Container(
                child: flutterWebView,
                height: 300.0,
                width: 500.0,
              ),
            ],
          ),
        )
      ),
    );
  }

  void onWebCreated(webController) {
    this.webController = webController;
    this.webController.loadUrl("https://flutter.io/");
    this.webController.onPageStarted.listen((url) =>
        print("Loading $url")
    );
    this.webController.onPageFinished.listen((url) =>
        print("Finished loading $url")
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_native_web: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_native_web/flutterwebview.dart';
  
Version Uploaded Documentation Archive
0.1.2 Sep 11, 2018 Go to the documentation of flutter_native_web 0.1.2 Download flutter_native_web 0.1.2 archive
0.1.1 Sep 11, 2018 Go to the documentation of flutter_native_web 0.1.1 Download flutter_native_web 0.1.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
51
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]
76
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

Fix lib/flutterwebview.dart.

Analysis of lib/flutterwebview.dart reported 1 hint:

line 4 col 8: Unused import: 'package:flutter/gestures.dart'.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.47.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8