flutter之webview

您所在的位置:网站首页 flutter调用原生 flutter之webview

flutter之webview

2023-03-12 05:48| 来源: 网络整理| 查看: 265

flutter项目需要加载报表的解决方案

下载包 webview_flutter: ^0.3.19+7 实现公共的webview组件 class CustomWebView extends StatefulWidget { final String title; final String url; CustomWebView({ this.title, this.url, }); @override State createState() => _CustomWebView(); } class _CustomWebView extends State { String baseUrl = HttpManager().BASEURL; _CustomWebView(); @override Widget build(BuildContext context) { return Scaffold( appBar: CustomAppBar( titleText: '报表', actions: [ Container( margin: EdgeInsets.only( right: 10, ), child: CustomIcon( icon: Icons.share, color: CustomColor.white, size: 25, ontap: () { }, ), ) ], ), body: Builder(builder: (BuildContext context) { return WebView( initialUrl: '${baseUrl}${widget.url}', javascriptMode: JavascriptMode.unrestricted, onWebViewCreated: (WebViewController webViewController) {}, gestureNavigationEnabled: true, ); }), ); } }


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3