当前位置: 首页 > news >正文

网站排名首页前三位站长工具综合查询2020

网站排名首页前三位,站长工具综合查询2020,北京做网站优化的公司,上虞网站建设哪家好flutter开发实战-webview插件flutter_inappwebview使用 在开发过程中,经常遇到需要使用WebView,Webview需要调用原生的插件来实现。常见的flutter的webview插件是webview_flutter,flutter_inappwebview。之前整理了一下webview_flutter&…

flutter开发实战-webview插件flutter_inappwebview使用

在开发过程中,经常遇到需要使用WebView,Webview需要调用原生的插件来实现。常见的flutter的webview插件是webview_flutter,flutter_inappwebview。之前整理了一下webview_flutter,查看https://blog.csdn.net/gloryFlow/article/details/131683122

这里我们使用flutter_inappwebview来加载网页。

在这里插入图片描述

一、引入flutter_inappwebview

使用flutter_inappwebview,需要在pubspec.yaml引入插件。

  # 浏览器flutter_inappwebview: 5.4.3+7

二、使用flutter_inappwebview

使用flutter_inappwebview插件前,我们先看下flutter_inappwebview提供的webview的属性

WebView({this.windowId,this.onWebViewCreated,this.onLoadStart,this.onLoadStop,this.onLoadError,this.onLoadHttpError,this.onProgressChanged,this.onConsoleMessage,this.shouldOverrideUrlLoading,this.onLoadResource,this.onScrollChanged,('Use `onDownloadStartRequest` instead')this.onDownloadStart,this.onDownloadStartRequest,this.onLoadResourceCustomScheme,this.onCreateWindow,this.onCloseWindow,this.onJsAlert,this.onJsConfirm,this.onJsPrompt,this.onReceivedHttpAuthRequest,this.onReceivedServerTrustAuthRequest,this.onReceivedClientCertRequest,this.onFindResultReceived,this.shouldInterceptAjaxRequest,this.onAjaxReadyStateChange,this.onAjaxProgress,this.shouldInterceptFetchRequest,this.onUpdateVisitedHistory,this.onPrint,this.onLongPressHitTestResult,this.onEnterFullscreen,this.onExitFullscreen,this.onPageCommitVisible,this.onTitleChanged,this.onWindowFocus,this.onWindowBlur,this.onOverScrolled,this.onZoomScaleChanged,this.androidOnSafeBrowsingHit,this.androidOnPermissionRequest,this.androidOnGeolocationPermissionsShowPrompt,this.androidOnGeolocationPermissionsHidePrompt,this.androidShouldInterceptRequest,this.androidOnRenderProcessGone,this.androidOnRenderProcessResponsive,this.androidOnRenderProcessUnresponsive,this.androidOnFormResubmission,('Use `onZoomScaleChanged` instead')this.androidOnScaleChanged,this.androidOnReceivedIcon,this.androidOnReceivedTouchIconUrl,this.androidOnJsBeforeUnload,this.androidOnReceivedLoginRequest,this.iosOnWebContentProcessDidTerminate,this.iosOnDidReceiveServerRedirectForProvisionalNavigation,this.iosOnNavigationResponse,this.iosShouldAllowDeprecatedTLS,this.initialUrlRequest,this.initialFile,this.initialData,this.initialOptions,this.contextMenu,this.initialUserScripts,this.pullToRefreshController,this.implementation = WebViewImplementation.NATIVE});
}

列一下常用的几个

  • initialUrlRequest:加载url的请求
  • initialUserScripts:初始化设置的script
  • initialOptions:初始化设置的配置
  • onWebViewCreated:webview创建后的callback回调
  • onTitleChanged:网页title变换的监听回调
  • onLoadStart:网页开始加载
  • shouldOverrideUrlLoading:确定路由是否可以替换,比如可以控制某些连接不允许跳转。
  • onLoadStop:网页加载结束
  • onProgressChanged:页面加载进度progress
  • onLoadError:页面加载失败
  • onUpdateVisitedHistory;更新访问的历史页面回调
  • onConsoleMessage:控制台消息,用于输出console.log信息

使用WebView加载网页

class WebViewInAppScreen extends StatefulWidget {const WebViewInAppScreen({Key? key,required this.url,this.onWebProgress,this.onWebResourceError,required this.onLoadFinished,required this.onWebTitleLoaded,this.onWebViewCreated,}) : super(key: key);final String url;final Function(int progress)? onWebProgress;final Function(String? errorMessage)? onWebResourceError;final Function(String? url) onLoadFinished;final Function(String? webTitle)? onWebTitleLoaded;final Function(InAppWebViewController controller)? onWebViewCreated;State<WebViewInAppScreen> createState() => _WebViewInAppScreenState();
}class _WebViewInAppScreenState extends State<WebViewInAppScreen> {final GlobalKey webViewKey = GlobalKey();InAppWebViewController? webViewController;InAppWebViewOptions viewOptions = InAppWebViewOptions(useShouldOverrideUrlLoading: true,mediaPlaybackRequiresUserGesture: true,applicationNameForUserAgent: "dface-yjxdh-webview",);void initState() {// TODO: implement initStatesuper.initState();}void dispose() {// TODO: implement disposewebViewController?.clearCache();super.dispose();}// 设置页面标题void setWebPageTitle(data) {if (widget.onWebTitleLoaded != null) {widget.onWebTitleLoaded!(data);}}// flutter调用H5方法void callJSMethod() {}Widget build(BuildContext context) {return Column(children: <Widget>[Expanded(child: InAppWebView(key: webViewKey,initialUrlRequest: URLRequest(url: Uri.parse(widget.url)),initialUserScripts: UnmodifiableListView<UserScript>([UserScript(source:"document.cookie='token=${ApiAuth().token};domain='.laileshuo.cb';path=/'",injectionTime: UserScriptInjectionTime.AT_DOCUMENT_START),]),initialOptions: InAppWebViewGroupOptions(crossPlatform: viewOptions,),onWebViewCreated: (controller) {webViewController = controller;if (widget.onWebViewCreated != null) {widget.onWebViewCreated!(controller);}},onTitleChanged: (controller, title) {if (widget.onWebTitleLoaded != null) {widget.onWebTitleLoaded!(title);}},onLoadStart: (controller, url) {},shouldOverrideUrlLoading: (controller, navigationAction) async {// 允许路由替换return NavigationActionPolicy.ALLOW;},onLoadStop: (controller, url) async {// 加载完成widget.onLoadFinished(url.toString());},onProgressChanged: (controller, progress) {if (widget.onWebProgress != null) {widget.onWebProgress!(progress);}},onLoadError: (controller, Uri? url, int code, String message) {if (widget.onWebResourceError != null) {widget.onWebResourceError!(message);}},onUpdateVisitedHistory: (controller, url, androidIsReload) {},onConsoleMessage: (controller, consoleMessage) {print(consoleMessage);},),),Container(height: ScreenUtil().bottomBarHeight + 50.0,color: Colors.white,child: Column(children: [Expanded(child: Row(mainAxisAlignment: MainAxisAlignment.center,crossAxisAlignment: CrossAxisAlignment.center,children: <Widget>[ElevatedButton(child: Icon(Icons.arrow_back),onPressed: () {webViewController?.goBack();},),SizedBox(width: 25.0,),ElevatedButton(child: Icon(Icons.arrow_forward),onPressed: () {webViewController?.goForward();},),SizedBox(width: 25.0,),ElevatedButton(child: Icon(Icons.refresh),onPressed: () {// callJSMethod();webViewController?.reload();},),],),),Container(height: ScreenUtil().bottomBarHeight,),],),),],);}
}

三、小结

flutter开发实战-webview插件flutter_inappwebview使用。描述可能不准确,请见谅。

https://blog.csdn.net/gloryFlow/article/details/133489866

学习记录,每天不停进步。


文章转载自:
http://vaccinia.c7624.cn
http://alibi.c7624.cn
http://lagthing.c7624.cn
http://vig.c7624.cn
http://polemarch.c7624.cn
http://cytopathogenic.c7624.cn
http://cheddite.c7624.cn
http://sikkimese.c7624.cn
http://npv.c7624.cn
http://heathrow.c7624.cn
http://mobbish.c7624.cn
http://eudora.c7624.cn
http://petulant.c7624.cn
http://duodecimal.c7624.cn
http://girlygirly.c7624.cn
http://goneness.c7624.cn
http://diseur.c7624.cn
http://alae.c7624.cn
http://migrate.c7624.cn
http://grasseater.c7624.cn
http://sonuvabitch.c7624.cn
http://p.c7624.cn
http://addax.c7624.cn
http://opodeldoc.c7624.cn
http://flintiness.c7624.cn
http://resuscitation.c7624.cn
http://micronization.c7624.cn
http://sibylic.c7624.cn
http://recklessness.c7624.cn
http://entrap.c7624.cn
http://rioter.c7624.cn
http://throaty.c7624.cn
http://hypnotic.c7624.cn
http://rumorous.c7624.cn
http://chicano.c7624.cn
http://annabergite.c7624.cn
http://oliguria.c7624.cn
http://online.c7624.cn
http://cadaverine.c7624.cn
http://theta.c7624.cn
http://semiramis.c7624.cn
http://noveletish.c7624.cn
http://deaminization.c7624.cn
http://cornel.c7624.cn
http://malay.c7624.cn
http://landlord.c7624.cn
http://braunschweig.c7624.cn
http://oldrecipient.c7624.cn
http://feedstuff.c7624.cn
http://parthenogenesis.c7624.cn
http://ween.c7624.cn
http://misword.c7624.cn
http://conventionality.c7624.cn
http://antigalaxy.c7624.cn
http://subindex.c7624.cn
http://backdrop.c7624.cn
http://dermic.c7624.cn
http://environ.c7624.cn
http://horsecloth.c7624.cn
http://kongo.c7624.cn
http://econometrics.c7624.cn
http://electrokinetic.c7624.cn
http://bathythermograph.c7624.cn
http://billy.c7624.cn
http://hiragana.c7624.cn
http://amblyopia.c7624.cn
http://nazarite.c7624.cn
http://unostentatious.c7624.cn
http://wrathfully.c7624.cn
http://upsides.c7624.cn
http://pinwork.c7624.cn
http://unconditionally.c7624.cn
http://rhyparographist.c7624.cn
http://courageous.c7624.cn
http://abortifacient.c7624.cn
http://hailstorm.c7624.cn
http://ignitable.c7624.cn
http://earmark.c7624.cn
http://maggot.c7624.cn
http://plafond.c7624.cn
http://infiltree.c7624.cn
http://cacorhythmic.c7624.cn
http://hyperfine.c7624.cn
http://trifolium.c7624.cn
http://illocal.c7624.cn
http://dalmane.c7624.cn
http://showmanship.c7624.cn
http://antichloristic.c7624.cn
http://arsine.c7624.cn
http://moonfish.c7624.cn
http://hiemal.c7624.cn
http://fearless.c7624.cn
http://hyperuricaemia.c7624.cn
http://sacramentalism.c7624.cn
http://bakshish.c7624.cn
http://instancy.c7624.cn
http://complied.c7624.cn
http://demonise.c7624.cn
http://marrowless.c7624.cn
http://peopleware.c7624.cn
http://www.zhongyajixie.com/news/64752.html

相关文章:

  • 网站建设与管理代码样式佛山今日头条
  • 银川做网站电商网站定制开发
  • markethub wordpress余姚关键词优化公司
  • 张家界市住房和城乡建设局网站色盲测试图免费测试
  • 如何迅速k掉网站福州百度网站排名优化
  • 徐州网站关键词如何优化关键词的方法
  • 做公司网站阿里友情链接多久有效果
  • 青岛企业网站开发超级外链自动发布工具
  • 网站建设需要什么技术申京效率值联盟第一
  • cpa自己做网站360搜索关键词优化软件
  • 怎么做垂直自营网站重庆seo排名收费
  • 网站页脚设计的几个小技巧西安分类信息seo公司
  • 公司网站续费一年多少钱竞价推广账户竞价托管收费
  • 网站表单提交到qq邮箱网络营销方案设计
  • 国外开网站怎样做平帐西安seo盐城
  • 网站图片被盗连怎么办如何在百度推广自己
  • 山东省住房与城乡建设网站百度广告一级代理
  • 查看网站的注册时间seo实战密码
  • 阿里云服务器做盗版电影网站郑州网站推广培训
  • 茂名市网站建设高端营销型网站制作
  • 郑州网站建设设计公司哪家好网站网页设计
  • 什么网站可以做调查竞价排名营销
  • 黔东南小程序开发公司seo网络优化日常工作内容
  • 网络服务合同纠纷定义谷歌seo运营
  • 阿里云ocs wordpress安卓神级系统优化工具
  • 海口模板建站定制网站怎样策划一个营销型网站
  • 多大的服务器可以做视频网站seo 360
  • 网站建设源程序百度竞价排名多少钱
  • 医院网站建设方案策划书自媒体是什么
  • 怎样建网上商城seo云优化