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

网站制作公司站建设招生网站建设的意义

网站制作公司站建设,招生网站建设的意义,上海普陀网站建设,学习资料网flutter开发实战-webview插件flutter_inappwebview使用 在开发过程中#xff0c;经常遇到需要使用WebView#xff0c;Webview需要调用原生的插件来实现。常见的flutter的webview插件是webview_flutter#xff0c;flutter_inappwebview。之前整理了一下webview_flutter…flutter开发实战-webview插件flutter_inappwebview使用 在开发过程中经常遇到需要使用WebViewWebview需要调用原生的插件来实现。常见的flutter的webview插件是webview_flutterflutter_inappwebview。之前整理了一下webview_flutter查看https://blog.csdn.net/gloryFlow/article/details/131683122 这里我们使用flutter_inappwebview来加载网页。 一、引入flutter_inappwebview 使用flutter_inappwebview需要在pubspec.yaml引入插件。 # 浏览器flutter_inappwebview: 5.4.37二、使用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,Deprecated(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,Deprecated(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初始化设置的scriptinitialOptions初始化设置的配置onWebViewCreatedwebview创建后的callback回调onTitleChanged网页title变换的监听回调onLoadStart网页开始加载shouldOverrideUrlLoading确定路由是否可以替换比如可以控制某些连接不允许跳转。onLoadStop网页加载结束onProgressChanged页面加载进度progressonLoadError页面加载失败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;overrideStateWebViewInAppScreen createState() _WebViewInAppScreenState(); }class _WebViewInAppScreenState extends StateWebViewInAppScreen {final GlobalKey webViewKey GlobalKey();InAppWebViewController? webViewController;InAppWebViewOptions viewOptions InAppWebViewOptions(useShouldOverrideUrlLoading: true,mediaPlaybackRequiresUserGesture: true,applicationNameForUserAgent: dface-yjxdh-webview,);overridevoid initState() {// TODO: implement initStatesuper.initState();}overridevoid dispose() {// TODO: implement disposewebViewController?.clearCache();super.dispose();}// 设置页面标题void setWebPageTitle(data) {if (widget.onWebTitleLoaded ! null) {widget.onWebTitleLoaded!(data);}}// flutter调用H5方法void callJSMethod() {}overrideWidget build(BuildContext context) {return Column(children: Widget[Expanded(child: InAppWebView(key: webViewKey,initialUrlRequest: URLRequest(url: Uri.parse(widget.url)),initialUserScripts: UnmodifiableListViewUserScript([UserScript(source:document.cookietoken${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://www.pierceye.com/news/79408/

相关文章:

  • 网站建设领导小组网站备案信息核验单填写
  • 网站建设郑州公司健康湖州网站
  • 很多域名301定重到另一网站江苏建设厅
  • 宠物网站建设理念棋牌代理平台
  • 网站后台地址忘记了seo公司网站
  • 镇江网站建设制作方案响应式网站 哪些
  • 株洲网站建设网站建立公司网站要多少钱
  • wordpress子域名多站点坂田做网站建设好的网络公司
  • 山东裕达建设工程咨询有限公司网站长春网络优化哪个公司在做
  • php网站收录系统开发岗位职责
  • 学做婴儿衣服网站建站公司前景
  • 做流量网站要做哪一种公司网站建设457216336
  • 网站设计步骤包括哪些美容网站建设
  • 南宁手机网站设计策划河南省建设工程信息网站
  • 怎样查看网站的权重wordpress 滑块
  • 利用云服务器做网站怎么用手机做网站
  • html购物网站模板下载优质东莞网站制作公司
  • 请问的网站开发培训 有知道的吗分答网站
  • 成都网站建设公司排行做网站贵不
  • 常州网站建站设计参考网站推荐
  • 福建省建设执业资格管理注册中心网站找程序员的网站
  • 网站规划 时间网站建设栏目设置表格
  • 亚网互联网站设计英迈思做网站怎么样
  • 松江公司做网站汕头网站建设seo外包
  • 网站搜索引擎优化的方法建设网站毕业设计
  • 企业网站推广策划书吉安网站制作
  • 网站设计公司网站设计网站制作公司怎么赚钱
  • 做网站怎么申请百度推广wordpress多重查询
  • 精品课程网站建设方案电脑上如何做课程视频网站
  • 动漫公司网站建设设计师网站有哪些