incognitoMode

This commit is contained in:
DASHU
2025-04-30 22:08:17 +08:00
parent 0f872941ee
commit 78e0b83e16
38 changed files with 163 additions and 91 deletions

View File

@@ -75,7 +75,7 @@ class _LongPressDialog extends State<LongPressDialog> {
},
));
list.add(LongPressDialogItem(
s.Open_with_Stealth_Mode,
s.Open_with_Incognito_Mode,
onTap: () {
webProvider.addTab(url: url);
},

View File

@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import '../../data/browser_history.dart';
import 'webview_controller_interface.dart';
@@ -7,7 +8,12 @@ class WebInfo {
String url;
WebInfo(this.id, this.url);
bool incognitoMode;
bool isSecure;
WebInfo(this.id, this.url,
{this.incognitoMode = false, this.isSecure = false});
WebviewControllerInterface? controller;
@@ -22,4 +28,12 @@ class WebInfo {
wi.browserHistory = browserHistory;
return wi;
}
Color? getBackgroundColor() {
if (incognitoMode) {
return Colors.grey;
} else {
return null;
}
}
}

View File

@@ -27,12 +27,15 @@ class WebViewComponent extends StatefulWidget {
Function(WebInfo, InAppWebViewController, String?) onTitleChanged;
Function(WebInfo, InAppWebViewController, WebUri? url) onLoadStart;
Function(WebInfo, InAppWebViewController) onLoadStop;
WebViewComponent(
this.webInfo,
this.onWebViewCreated,
this.onTitleChanged,
this.onLoadStart,
this.onLoadStop,
);
@@ -131,6 +134,8 @@ class _WebViewComponent extends State<WebViewComponent>
@override
Widget build(BuildContext context) {
settings.incognito = widget.webInfo.incognitoMode;
return Container(
child: InAppWebView(
initialUrlRequest: URLRequest(url: WebUri(widget.webInfo.url)),
@@ -146,7 +151,9 @@ class _WebViewComponent extends State<WebViewComponent>
onTitleChanged: (controller, title) {
widget.onTitleChanged(widget.webInfo, controller, title);
},
onLoadStart: (controller, url) async {},
onLoadStart: (controller, url) async {
widget.onLoadStart(widget.webInfo, controller, url);
},
onPermissionRequest: (controller, request) async {
return PermissionResponse(
resources: request.resources,

View File

@@ -134,7 +134,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("توقيع الحدث"),
"Stars": MessageLookupByLibrary.simpleMessage("حفظ العناوين"),
"Stealth": MessageLookupByLibrary.simpleMessage("خلسة"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("نوع الموضوع"),
"Url": MessageLookupByLibrary.simpleMessage("لينك ."),
"WEB": MessageLookupByLibrary.simpleMessage("صفحة ويب"),

View File

@@ -150,7 +150,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Подписване на събитие"),
"Stars": MessageLookupByLibrary.simpleMessage("запис на отметка"),
"Stealth": MessageLookupByLibrary.simpleMessage("невидими"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Вид тема"),
"Url": MessageLookupByLibrary.simpleMessage("връзка"),
"WEB": MessageLookupByLibrary.simpleMessage("уеб страница"),

View File

@@ -138,7 +138,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Podpis události"),
"Stars": MessageLookupByLibrary.simpleMessage("Uložit záložku"),
"Stealth": MessageLookupByLibrary.simpleMessage("Nevytnost"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Typ tématu"),
"Url": MessageLookupByLibrary.simpleMessage("odkaz"),
"WEB": MessageLookupByLibrary.simpleMessage("Webové stránky"),

View File

@@ -136,7 +136,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Signatur begivenhed"),
"Stars": MessageLookupByLibrary.simpleMessage("Gem bogmærker"),
"Stealth": MessageLookupByLibrary.simpleMessage("Skyldig"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Tematype"),
"Url": MessageLookupByLibrary.simpleMessage("Links"),
"WEB": MessageLookupByLibrary.simpleMessage("hjemmeside"),

View File

@@ -152,7 +152,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Signatur Ereignis"),
"Stars": MessageLookupByLibrary.simpleMessage("Lesezeichen speichern"),
"Stealth": MessageLookupByLibrary.simpleMessage("Unsichtbar"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Thementyp"),
"Url": MessageLookupByLibrary.simpleMessage("Links"),
"WEB": MessageLookupByLibrary.simpleMessage("Webseite"),

View File

@@ -146,7 +146,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Εκδήλωση υπογραφής"),
"Stars": MessageLookupByLibrary.simpleMessage("αποθήκευση σελιδοδείκτη"),
"Stealth": MessageLookupByLibrary.simpleMessage("Ακρυφότητα"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Τύπος θέματος"),
"Url": MessageLookupByLibrary.simpleMessage("σύνδεση"),
"WEB": MessageLookupByLibrary.simpleMessage("Ιστοσελίδα"),

View File

@@ -88,6 +88,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Get_Public_Key": MessageLookupByLibrary.simpleMessage("Get Public Key"),
"Get_Relays": MessageLookupByLibrary.simpleMessage("Get Relays"),
"Historys": MessageLookupByLibrary.simpleMessage("Historys"),
"Incognito": MessageLookupByLibrary.simpleMessage("Incognito"),
"Input_can_not_be_null": MessageLookupByLibrary.simpleMessage(
"Input can\'t be null",
),
@@ -109,8 +110,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Open_in_a_New_Tab": MessageLookupByLibrary.simpleMessage(
"Open in a New Tab",
),
"Open_with_Stealth_Mode": MessageLookupByLibrary.simpleMessage(
"Open with Stealth Mode",
"Open_with_Incognito_Mode": MessageLookupByLibrary.simpleMessage(
"Open with Incognito Mode",
),
"Pendding_connect_remote_apps": MessageLookupByLibrary.simpleMessage(
"Pendding connect remote apps",
@@ -135,7 +136,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Show_more_logs": MessageLookupByLibrary.simpleMessage("Show more logs"),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Sign Event"),
"Stars": MessageLookupByLibrary.simpleMessage("Stars"),
"Stealth": MessageLookupByLibrary.simpleMessage("Stealth"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("ThemeStyle"),
"Url": MessageLookupByLibrary.simpleMessage("Url"),
"WEB": MessageLookupByLibrary.simpleMessage("WEB"),

View File

@@ -150,7 +150,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Evento de firma"),
"Stars": MessageLookupByLibrary.simpleMessage("Guardar marcadores"),
"Stealth": MessageLookupByLibrary.simpleMessage("Sigiloso"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Tipo de tema"),
"Url": MessageLookupByLibrary.simpleMessage("Enlaces"),
"WEB": MessageLookupByLibrary.simpleMessage("Página web"),

View File

@@ -140,7 +140,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Allkirja sündmus"),
"Stars": MessageLookupByLibrary.simpleMessage("Järjehoidja salvestamine"),
"Stealth": MessageLookupByLibrary.simpleMessage("varjatus"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Teema tüüp"),
"Url": MessageLookupByLibrary.simpleMessage("lingid"),
"WEB": MessageLookupByLibrary.simpleMessage("Veebilehekülg"),

View File

@@ -142,7 +142,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Allekirjoittaa tapahtuma",
),
"Stars": MessageLookupByLibrary.simpleMessage("Tallenna kirjanmerkki"),
"Stealth": MessageLookupByLibrary.simpleMessage("Piiloton"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Teematyyppi"),
"Url": MessageLookupByLibrary.simpleMessage("Linkkejä"),
"WEB": MessageLookupByLibrary.simpleMessage("Verkkosivu"),

View File

@@ -154,7 +154,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Événements signés"),
"Stars": MessageLookupByLibrary.simpleMessage("Sauvegarder les signets"),
"Stealth": MessageLookupByLibrary.simpleMessage("Furtivité"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Type de thème"),
"Url": MessageLookupByLibrary.simpleMessage("Liens"),
"WEB": MessageLookupByLibrary.simpleMessage("Page Web"),

View File

@@ -150,7 +150,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Aláírási esemény"),
"Stars": MessageLookupByLibrary.simpleMessage("Könyvjelző mentése"),
"Stealth": MessageLookupByLibrary.simpleMessage("rejthetetlen"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Téma típusa"),
"Url": MessageLookupByLibrary.simpleMessage("hivatkozások"),
"WEB": MessageLookupByLibrary.simpleMessage("weboldal"),

View File

@@ -150,7 +150,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Show_more_logs": MessageLookupByLibrary.simpleMessage("Mostra altri log"),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Firma dell\' evento"),
"Stars": MessageLookupByLibrary.simpleMessage("Salva segnalibri"),
"Stealth": MessageLookupByLibrary.simpleMessage("Invisibile"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Tipo di argomento"),
"Url": MessageLookupByLibrary.simpleMessage("Collegamenti"),
"WEB": MessageLookupByLibrary.simpleMessage("Pagina web"),

View File

@@ -106,7 +106,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Show_more_logs": MessageLookupByLibrary.simpleMessage("詳細なログを表示"),
"Sign_Event": MessageLookupByLibrary.simpleMessage("署名イベント"),
"Stars": MessageLookupByLibrary.simpleMessage("ブックマークの保存"),
"Stealth": MessageLookupByLibrary.simpleMessage("身を隠す"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("トピック・タイプ"),
"Url": MessageLookupByLibrary.simpleMessage("リンク#リンク#"),
"WEB": MessageLookupByLibrary.simpleMessage("Webページ"),

View File

@@ -108,7 +108,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Show_more_logs": MessageLookupByLibrary.simpleMessage("추가 로그 표시"),
"Sign_Event": MessageLookupByLibrary.simpleMessage("서명 이벤트"),
"Stars": MessageLookupByLibrary.simpleMessage("책갈피 저장"),
"Stealth": MessageLookupByLibrary.simpleMessage("은신"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("주제 유형"),
"Url": MessageLookupByLibrary.simpleMessage("링크"),
"WEB": MessageLookupByLibrary.simpleMessage("웹 페이지"),

View File

@@ -140,7 +140,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Gebeurtenissen ondertekenen",
),
"Stars": MessageLookupByLibrary.simpleMessage("Bladwizers opslaan"),
"Stealth": MessageLookupByLibrary.simpleMessage("Onzichtbaar"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Type onderwerp"),
"Url": MessageLookupByLibrary.simpleMessage("Links"),
"WEB": MessageLookupByLibrary.simpleMessage("Webpagina"),

View File

@@ -148,7 +148,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Podpisanie zdarzenia"),
"Stars": MessageLookupByLibrary.simpleMessage("Zapisz zakładkę"),
"Stealth": MessageLookupByLibrary.simpleMessage("niewidzialny"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Typ tematu"),
"Url": MessageLookupByLibrary.simpleMessage("Linki"),
"WEB": MessageLookupByLibrary.simpleMessage("Strona internetowa"),

View File

@@ -144,7 +144,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Evento de assinatura"),
"Stars": MessageLookupByLibrary.simpleMessage("Salvar favoritos"),
"Stealth": MessageLookupByLibrary.simpleMessage("invisível"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Tipo de tema"),
"Url": MessageLookupByLibrary.simpleMessage("Ligação"),
"WEB": MessageLookupByLibrary.simpleMessage("Páginas Web"),

View File

@@ -152,7 +152,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Evenimente de semnare"),
"Stars": MessageLookupByLibrary.simpleMessage("Salvare marcare"),
"Stealth": MessageLookupByLibrary.simpleMessage("stealth"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Tip de subiect"),
"Url": MessageLookupByLibrary.simpleMessage("link"),
"WEB": MessageLookupByLibrary.simpleMessage("paginile web"),

View File

@@ -148,7 +148,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Событие подписи"),
"Stars": MessageLookupByLibrary.simpleMessage("Сохранить закладки"),
"Stealth": MessageLookupByLibrary.simpleMessage("Скрытие"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Тип темы"),
"Url": MessageLookupByLibrary.simpleMessage("Ссылки"),
"WEB": MessageLookupByLibrary.simpleMessage("Веб - страница"),

View File

@@ -142,7 +142,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Dogodek podpisa"),
"Stars": MessageLookupByLibrary.simpleMessage("shrani zaznamek"),
"Stealth": MessageLookupByLibrary.simpleMessage("nevidni"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Vrsta teme"),
"Url": MessageLookupByLibrary.simpleMessage("povezava"),
"WEB": MessageLookupByLibrary.simpleMessage("Spletna stran"),

View File

@@ -146,7 +146,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Show_more_logs": MessageLookupByLibrary.simpleMessage("Visa fler loggar"),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Signaturhändelse"),
"Stars": MessageLookupByLibrary.simpleMessage("Spara bokmärke"),
"Stealth": MessageLookupByLibrary.simpleMessage("Osymlig"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Ämnestyp"),
"Url": MessageLookupByLibrary.simpleMessage("länk"),
"WEB": MessageLookupByLibrary.simpleMessage("Webbplatser"),

View File

@@ -136,7 +136,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("กิจกรรมลายเซ็น"),
"Stars": MessageLookupByLibrary.simpleMessage("บันทึกที่คั่นหน้า"),
"Stealth": MessageLookupByLibrary.simpleMessage("ชิงทรัพย์"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("ประเภทหัวข้อ"),
"Url": MessageLookupByLibrary.simpleMessage("ลิงค์"),
"WEB": MessageLookupByLibrary.simpleMessage("เว็บเพจ"),

View File

@@ -124,7 +124,6 @@ class MessageLookup extends MessageLookupByLibrary {
),
"Sign_Event": MessageLookupByLibrary.simpleMessage("Sự kiện chữ ký"),
"Stars": MessageLookupByLibrary.simpleMessage("Lưu Đánh dấu"),
"Stealth": MessageLookupByLibrary.simpleMessage("Tàng hình"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("Loại chủ đề"),
"Url": MessageLookupByLibrary.simpleMessage("Liên kết"),
"WEB": MessageLookupByLibrary.simpleMessage("Trang web"),

View File

@@ -50,6 +50,8 @@ class MessageLookup extends MessageLookupByLibrary {
"Confirm": MessageLookupByLibrary.simpleMessage("确认"),
"ConnectType": MessageLookupByLibrary.simpleMessage("链接类型"),
"Connect_by": MessageLookupByLibrary.simpleMessage("链接"),
"Copy_Link": MessageLookupByLibrary.simpleMessage("复制链接"),
"Copy_Title": MessageLookupByLibrary.simpleMessage("复制标题"),
"Copy_success": MessageLookupByLibrary.simpleMessage("复制成功"),
"Custom": MessageLookupByLibrary.simpleMessage("自定义"),
"Dark": MessageLookupByLibrary.simpleMessage("深色"),
@@ -57,6 +59,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Decrypt44_name": MessageLookupByLibrary.simpleMessage("解密 (NIP-44)"),
"Decrypt_zap_event": MessageLookupByLibrary.simpleMessage("解密私密Zap"),
"Desktop": MessageLookupByLibrary.simpleMessage("桌面"),
"Download_image": MessageLookupByLibrary.simpleMessage("下载图片"),
"Downloads": MessageLookupByLibrary.simpleMessage("下载"),
"Edit": MessageLookupByLibrary.simpleMessage("编辑"),
"Encrypt04_name": MessageLookupByLibrary.simpleMessage("加密 (NIP-04)"),
@@ -71,6 +74,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Get_Public_Key": MessageLookupByLibrary.simpleMessage("获取公钥"),
"Get_Relays": MessageLookupByLibrary.simpleMessage("获取中继"),
"Historys": MessageLookupByLibrary.simpleMessage("历史"),
"Incognito": MessageLookupByLibrary.simpleMessage("无痕"),
"Input_can_not_be_null": MessageLookupByLibrary.simpleMessage("输入不能为空"),
"Input_search_url_des": MessageLookupByLibrary.simpleMessage("请输入搜索链接"),
"Keys_Manager": MessageLookupByLibrary.simpleMessage("秘钥管理"),
@@ -79,6 +83,10 @@ class MessageLookup extends MessageLookupByLibrary {
"Local_Relay": MessageLookupByLibrary.simpleMessage("本地中继"),
"Login": MessageLookupByLibrary.simpleMessage("登录"),
"Name": MessageLookupByLibrary.simpleMessage("名称"),
"Open_backgroundly": MessageLookupByLibrary.simpleMessage("后台打开"),
"Open_image_in_a_New_Tab": MessageLookupByLibrary.simpleMessage("新标签打开图片"),
"Open_in_a_New_Tab": MessageLookupByLibrary.simpleMessage("打开新标签"),
"Open_with_Incognito_Mode": MessageLookupByLibrary.simpleMessage("无痕模式打开"),
"Pendding_connect_remote_apps": MessageLookupByLibrary.simpleMessage(
"待链接的远程应用",
),
@@ -98,7 +106,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Show_more_logs": MessageLookupByLibrary.simpleMessage("显示更多日志"),
"Sign_Event": MessageLookupByLibrary.simpleMessage("签名事件"),
"Stars": MessageLookupByLibrary.simpleMessage("保存书签"),
"Stealth": MessageLookupByLibrary.simpleMessage("隐身"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("主题类型"),
"Url": MessageLookupByLibrary.simpleMessage("链接"),
"WEB": MessageLookupByLibrary.simpleMessage("网页"),

View File

@@ -98,7 +98,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Show_more_logs": MessageLookupByLibrary.simpleMessage("顯示更多日誌"),
"Sign_Event": MessageLookupByLibrary.simpleMessage("簽名事件"),
"Stars": MessageLookupByLibrary.simpleMessage("保存書簽"),
"Stealth": MessageLookupByLibrary.simpleMessage("隱身"),
"ThemeStyle": MessageLookupByLibrary.simpleMessage("主題類型"),
"Url": MessageLookupByLibrary.simpleMessage("鏈接"),
"WEB": MessageLookupByLibrary.simpleMessage("網頁"),

View File

@@ -70,9 +70,9 @@ class S {
return Intl.message('Refresh', name: 'Refresh', desc: '', args: []);
}
/// `Stealth`
String get Stealth {
return Intl.message('Stealth', name: 'Stealth', desc: '', args: []);
/// `Incognito`
String get Incognito {
return Intl.message('Incognito', name: 'Incognito', desc: '', args: []);
}
/// `Comming soon...`
@@ -665,11 +665,11 @@ class S {
);
}
/// `Open with Stealth Mode`
String get Open_with_Stealth_Mode {
/// `Open with Incognito Mode`
String get Open_with_Incognito_Mode {
return Intl.message(
'Open with Stealth Mode',
name: 'Open_with_Stealth_Mode',
'Open with Incognito Mode',
name: 'Open_with_Incognito_Mode',
desc: '',
args: [],
);

View File

@@ -2,7 +2,7 @@
"Back": "Back",
"Forward": "Forward",
"Refresh": "Refresh",
"Stealth": "Stealth",
"Incognito": "Incognito",
"Comming_soon": "Comming soon...",
"Bookmarks": "Bookmarks",
"Stars": "Stars",
@@ -88,7 +88,7 @@
"Copy_Title": "Copy Title",
"Copy_Link": "Copy Link",
"Open_in_a_New_Tab": "Open in a New Tab",
"Open_with_Stealth_Mode": "Open with Stealth Mode",
"Open_with_Incognito_Mode": "Open with Incognito Mode",
"Open_backgroundly": "Open backgroundly",
"Open_image_in_a_New_Tab": "Open image in a new tab",
"Download_image": "Download image"

View File

@@ -2,7 +2,7 @@
"Back": "后退",
"Forward": "前进",
"Refresh": "刷新",
"Stealth": "隐身",
"Incognito": "无痕",
"Comming_soon": "很快到达...",
"Bookmarks": "书签",
"Stars": "保存书签",
@@ -84,5 +84,12 @@
"About_Me": "关于我",
"Privacy": "隐私",
"Custom": "自定义",
"Input_search_url_des": "请输入搜索链接"
"Input_search_url_des": "请输入搜索链接",
"Copy_Title": "复制标题",
"Copy_Link": "复制链接",
"Open_in_a_New_Tab": "打开新标签",
"Open_with_Incognito_Mode": "无痕模式打开",
"Open_backgroundly": "后台打开",
"Open_image_in_a_New_Tab": "新标签打开图片",
"Download_image": "下载图片"
}

View File

@@ -79,9 +79,23 @@ class WebProvider extends ChangeNotifier {
}
}
void setIcognitoMode({bool? incognito}) {
var webInfo = currentWebInfo();
if (webInfo != null) {
if (incognito != null) {
webInfo.incognitoMode = incognito;
} else {
webInfo.incognitoMode = !(webInfo.incognitoMode);
}
updateWebInfo(webInfo);
}
}
void addTab({
String url = "",
bool openTab = true,
bool incognito = false,
}) {
if (StringUtil.isNotBlank(url)) {
var _currentWebInfo = currentWebInfo();
@@ -92,7 +106,8 @@ class WebProvider extends ChangeNotifier {
}
}
webInfos.add(WebInfo(_rndId(), url));
var webInfo = WebInfo(_rndId(), url, incognitoMode: incognito);
webInfos.add(webInfo);
if (openTab) {
index = webInfos.length - 1;
}
@@ -196,7 +211,9 @@ class WebProvider extends ChangeNotifier {
}
webInfo.browserHistory = browserHistory;
if (!webInfo.incognitoMode) {
BrowserHistoryDB.insert(browserHistory);
}
updateWebInfo(webInfo, updateUI: false);
} catch (e) {}

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:nostr_sdk/utils/string_util.dart';
import 'package:nowser/component/webview/web_info.dart';
import 'package:nowser/provider/web_provider.dart';
@@ -28,12 +29,23 @@ class _IndexWebBottomComponent extends State<IndexWebBottomComponent> {
var padding = mediaQuery.padding;
var maxWidth = mediaQuery.size.width;
var titleWidth = maxWidth / 2;
var themeData = Theme.of(context);
var mediumFontSize = themeData.textTheme.bodyMedium?.fontSize;
return Selector<WebProvider, WebInfo?>(builder: (context, webInfo, child) {
if (webInfo == null || StringUtil.isBlank(webInfo.url)) {
return Container();
}
var webStatusIcon =
Icon(Icons.lock, color: Colors.green, size: mediumFontSize);
if (webInfo.incognitoMode) {
webStatusIcon =
Icon(MaterialCommunityIcons.incognito, size: mediumFontSize);
} else if (!webInfo.isSecure) {
webStatusIcon = Icon(Icons.lock_open, size: mediumFontSize);
}
String title = "";
if (StringUtil.isNotBlank(webInfo.title)) {
title = webInfo.title!;
@@ -92,12 +104,23 @@ class _IndexWebBottomComponent extends State<IndexWebBottomComponent> {
bottom: Base.BASE_PADDING_HALF,
),
width: titleWidth,
child: Row(
children: [
Container(
margin: const EdgeInsets.only(
right: Base.BASE_PADDING_HALF),
child: webStatusIcon,
),
Expanded(
child: Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
),
),
),

View File

@@ -67,32 +67,43 @@ class _IndexWebComponent extends State<IndexWebComponent> {
webProvider.updateWebInfo(webInfo);
},
onTitleChanged,
(webInfo, controller, url) {
var urlStr = url.toString();
if (urlStr.startsWith("https")) {
webInfo.isSecure = true;
} else {
webInfo.isSecure = false;
}
},
(webInfo, controller) {
webInfo.controller = WebviewController(controller);
webProvider.onLoadStop(webInfo);
});
} else {
webComp = WebViewLinuxComponent(
webInfo,
(webInfo, controller) {
webComp = WebViewLinuxComponent(webInfo, (webInfo, controller) {
webInfo.controller = WebviewLinuxController(controller);
webProvider.updateWebInfo(webInfo);
},
(webInfo, controller, title) {
if (webInfo.controller is WebviewLinuxController && StringUtil.isNotBlank(title)) {
}, (webInfo, controller, title) {
if (webInfo.controller is WebviewLinuxController &&
StringUtil.isNotBlank(title)) {
(webInfo.controller as WebviewLinuxController).setTitle(title!);
webInfo.title = title;
webProvider.updateWebInfo(webInfo);
}
},
(webInfo, controller, url) {
if (webInfo.controller is WebviewLinuxController && StringUtil.isNotBlank(url)) {
}, (webInfo, controller, url) {
if (webInfo.controller is WebviewLinuxController &&
StringUtil.isNotBlank(url)) {
if (url!.startsWith("https")) {
webInfo.isSecure = true;
} else {
webInfo.isSecure = false;
}
print("url change! $url");
(webInfo.controller as WebviewLinuxController).setUrl(url!);
webInfo.url = url;
}
},
(webInfo, controller) async {
}, (webInfo, controller) async {
webInfo.controller ??= WebviewLinuxController(controller);
var title = await webInfo.controller!.getTitle();
webInfo.title = title;
@@ -100,14 +111,11 @@ class _IndexWebComponent extends State<IndexWebComponent> {
});
}
var main = webComp;
return Container(
padding: EdgeInsets.only(
top: padding.top,
),
child: main,
child: webComp,
);
}

View File

@@ -26,7 +26,9 @@ class _WebControlComponent extends State<WebControlComponent> {
Widget build(BuildContext context) {
var s = S.of(context);
var webProvider = Provider.of<WebProvider>(context);
var webInfo = webProvider.currentWebInfo;
var webInfo = webProvider.currentWebInfo();
var themeData = Theme.of(context);
Color mainColor = themeData.colorScheme.primary;
return Container(
child: Column(
@@ -78,13 +80,15 @@ class _WebControlComponent extends State<WebControlComponent> {
),
Expanded(
child: WebControlBtnComponent(
name: s.Stealth,
icon: const Icon(
name: s.Incognito,
icon: Icon(
Icons.disabled_visible_outlined,
size: 30,
color: webInfo?.incognitoMode == true ? mainColor : null,
),
onTap: () {
BotToast.showText(text: s.Comming_soon);
webProvider.setIcognitoMode();
widget.closeControl();
},
),
),

View File

@@ -279,6 +279,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.4.1"
flutter_font_icons:
dependency: "direct main"
description:
name: flutter_font_icons
sha256: d06eb0ab903d0e90a9a758de30892ea0d43221f03dad059970384e62479c787e
url: "https://pub.dev"
source: hosted
version: "2.2.7"
flutter_font_picker:
dependency: "direct main"
description:

View File

@@ -59,6 +59,7 @@ dependencies:
# searchfield: 1.2.0
searchfield: ^1.2.7
webview_cef: ^0.2.2
flutter_font_icons: ^2.2.7
dev_dependencies:
flutter_launcher_icons: ^0.13.1