Flutter高仿微信系列共59篇,从Flutter客户端、Kotlin客户端、Web服务器、数据库表结构、Xmpp即时通讯服务器、视频通话服务器、腾讯云服务器全面讲解。
详情请查看
效果图:
实现代码:
/** * Author : wangning * Email : maoning20080809@163.com * Date : 2022/9/30 07:34 * Description : webview打开网页 */ class WebViewWidget extends StatefulWidget { String title = ""; String url = ""; WebViewWidget({required this.title, required this.url}); @override _WebViewState createState() => _WebViewState(); } class _WebViewState extends State<WebViewWidget> { @override void initState() { super.initState(); if (Platform.isAndroid) { WebView.platform = SurfaceAndroidWebView(); } } @override Widget build(BuildContext context) { return Scaffold( appBar: WnAppBar.getAppBar(context, Text(widget.title)), body: MaterialApp( home: WebView( initialUrl: widget.url, javascriptMode: JavascriptMode.unrestricted, onPageStarted: (String url) { }, onPageFinished: (String url) { }, onWebResourceError: (error) { print("${error.description}"); }, ), ), ); } }