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

discontinued

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.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-85D80675LJ436515U";
  String url = "https://m.debug.8591.com.hk";
  GlobalKey widgetKey = GlobalKey();

  ///内容视图
  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(
                key: widgetKey,
                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: test,
                plugin: (YinWebview bean) {
                  if (bean != null) {
                    bean.getCookies(url, (value) {
                      print('test cookies=$value');
                    });
                  }
                },
              ),
            ),
          );
        },
      ),
    );
  }

  bool test(String value) {
    return value.contains("m.facebook");
  }

  void dissmiss() async {
    (widgetKey.currentState as YinWebViewPluginState).close();
  }

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

  @override
  void initState() {
    super.initState();
  }
}
0
likes
15
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