日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android 隐藏webview地址栏,flutter - 在Flutter Webview中隐藏Url引用 - SO中文参考 - www.soinside.com...

發布時間:2025/3/15 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android 隐藏webview地址栏,flutter - 在Flutter Webview中隐藏Url引用 - SO中文参考 - www.soinside.com... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

flutter_inappwebview:

git:

url: https://github.com/pichillilorenzo/flutter_inappwebview.git

ref: master

工作演示

完整代碼import 'package:flutter/material.dart';

import 'package:flutter_inappwebview/flutter_inappwebview.dart';

class InAppWebViewExampleScreen extends StatefulWidget {

@override

_InAppWebViewExampleScreenState createState() =>

new _InAppWebViewExampleScreenState();

}

class _InAppWebViewExampleScreenState extends State {

InAppWebViewController webView;

String url = "";

double progress = 0;

@override

void initState() {

super.initState();

}

@override

void dispose() {

super.dispose();

}

@override

Widget build(BuildContext context) {

return Scaffold(

appBar: AppBar(title: Text("InAppWebView")),

//drawer: myDrawer(context: context),

body: SafeArea(

child: Column(children: [

Container(

padding: EdgeInsets.all(20.0),

child: Text(

"CURRENT URL\n${(url.length > 50) ? url.substring(0, 50) + "..." : url}"),

),

Container(

padding: EdgeInsets.all(10.0),

child: progress < 1.0

? LinearProgressIndicator(value: progress)

: Container()),

Expanded(

child: Container(

margin: const EdgeInsets.all(10.0),

decoration:

BoxDecoration(border: Border.all(color: Colors.blueAccent)),

child: InAppWebView(

initialUrl: "https://flutter.dev/", //"https://flutter.dev/",

//initialFile: "assets/index.html",

initialHeaders: {},

initialOptions: InAppWebViewWidgetOptions(

crossPlatform: InAppWebViewOptions(

debuggingEnabled: true,

)

),

onWebViewCreated: (InAppWebViewController controller) {

webView = controller;

},

onLoadStart: (InAppWebViewController controller, String url) {

print("onLoadStart $url");

setState(() {

this.url = url;

});

},

onLoadStop:

(InAppWebViewController controller, String url) async {

print("onLoadStop $url");

setState(() {

this.url = url;

});

/*var origins = await WebStorageManager.instance().android.getOrigins();

for (var origin in origins) {

print(origin);

print(await WebStorageManager.instance().android.getQuotaForOrigin(origin: origin.origin));

print(await WebStorageManager.instance().android.getUsageForOrigin(origin: origin.origin));

}

await WebStorageManager.instance().android.deleteAllData();

print("\n\nDELETED\n\n");

origins = await WebStorageManager.instance().android.getOrigins();

for (var origin in origins) {

print(origin);

await WebStorageManager.instance().android.deleteOrigin(origin: origin.origin);

}*/

/*var records = await WebStorageManager.instance().ios.fetchDataRecords(dataTypes: IOSWKWebsiteDataType.ALL);

for(var record in records) {

print(record);

}

await WebStorageManager.instance().ios.removeDataModifiedSince(dataTypes: IOSWKWebsiteDataType.ALL, date: DateTime(0));

print("\n\nDELETED\n\n");

records = await WebStorageManager.instance().ios.fetchDataRecords(dataTypes: IOSWKWebsiteDataType.ALL);

for(var record in records) {

print(record);

}*/

},

onProgressChanged:

(InAppWebViewController controller, int progress) {

setState(() {

this.progress = progress / 100;

});

},

/*onUpdateVisitedHistory: (InAppWebViewController controller, String url, bool androidIsReload) {

print("onUpdateVisitedHistory $url");

setState(() {

this.url = url;

});

},*/

),

),

),

ButtonBar(

alignment: MainAxisAlignment.center,

children: [

RaisedButton(

child: Icon(Icons.arrow_back),

onPressed: () {

if (webView != null) {

webView.goBack();

}

},

),

RaisedButton(

child: Icon(Icons.arrow_forward),

onPressed: () {

if (webView != null) {

webView.goForward();

}

},

),

RaisedButton(

child: Icon(Icons.refresh),

onPressed: () {

if (webView != null) {

webView.reload();

}

},

),

],

),

])));

}

}

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

// This widget is the root of your application.

@override

Widget build(BuildContext context) {

return MaterialApp(

title: 'Flutter Demo',

theme: ThemeData(

primarySwatch: Colors.blue,

),

home: InAppWebViewExampleScreen(),

);

}

}

總結

以上是生活随笔為你收集整理的android 隐藏webview地址栏,flutter - 在Flutter Webview中隐藏Url引用 - SO中文参考 - www.soinside.com...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。