yin_webview 0.0.5 copy "yin_webview: ^0.0.5" to clipboard
yin_webview: ^0.0.5 copied to clipboard

discontinued
outdated

Custom webview plugin.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:yin_webview/YinWebViewPlugin.dart';

import 'package:yin_webview/yin_webview.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Webview',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String url = "https://www.baidu.com";

  ///内容视图
  Widget contentView() {
    List<Map<String, String>> cookies = new List();
    cookies.add({"k": "hkroles_develop", "v": "buyer%2Cseller%2Ccardseller"});
    cookies.add({"k": "hkuid_develop", "v": "1010004"});

    return new Center(
      child: new RaisedButton(
        child: new Text('打开'),
        onPressed: () {
          Navigator.push(
            context,
            new MaterialPageRoute(
              builder: (context) => new YinWebViewPlugin(
                    url: url,
                    actions: <Widget>[
                      IconButton(
                        icon: Icon(Icons.alarm),
                        tooltip: "Alarm",
                        onPressed: () {
                          print("Alarm");
                        },
                      ),
                      PopupMenuButton(
                        itemBuilder: (BuildContext context) =>
                        <PopupMenuItem<String>>[
                          PopupMenuItem<String>(child: Text("热度"), value: "hot",),
                          PopupMenuItem<String>(child: Text("最新"), value: "new",),
                        ],
                        onSelected: (String action) {
                          switch (action) {
                            case "hot":
                              print("hot");
                              break;
                            case "new":
                              print("new");
                              break;
                          }
                        },
                        onCanceled: () {
                          print("onCanceled");
                        },
                      )
                    ],
                    scrollBar: false,
                    cookieList: cookies,
                    loadUrl: (value) {
                      print('test url=$value');
                    },
                    plugin: (YinWebview bean) {
                      if (bean != null) {
                        bean.getCookies(url, (value) {
                          print('test cookies=$value');
                        });
                      }
                    },
                  ),
            ),
          );
        },
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: contentView(),
    );
  }

  @override
  void initState() {
    super.initState();
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Custom webview plugin.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on yin_webview