g_webview_flutter 0.0.3 copy "g_webview_flutter: ^0.0.3" to clipboard
g_webview_flutter: ^0.0.3 copied to clipboard

outdated

G_webview_flutter is used to open the original H5 page on flutter to improve development efficiency

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:g_webview_flutter/g_webview_flutter.dart';

void main() {
  GWebviewFlutter.init(); // 初始化SDK
  runApp(MyApp());
}

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    // js代码如:
    String jsStr = "";
    jsStr = "javascript:function modifyText() {";
    jsStr += "var list=document.getElementById(\"header\");";
    jsStr += "var str=list.getElementsByTagName(\"div\");";
    jsStr += "for(var i=0;i<str.length;i++){";
    jsStr += "if(str[i].className==\"topclose\")";
    jsStr += "str[i].style.display=\"none\";";
    jsStr += "}";
    jsStr += "}";
    jsStr += "javascript:modifyText();";
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: GestureDetector(
            child: Text('Running on: '),
            onTap: () {
              GWebviewFlutter.openWebActivity(
                "http://pet.zoosnet.net/LR/Chatpre.aspx?lng=cn&id=PET83076163",
                title: "标题",
                jsLoaded: jsStr,
              );
            },
          ),
        ),
      ),
    );
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

G_webview_flutter is used to open the original H5 page on flutter to improve development efficiency

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on g_webview_flutter