diff --git a/analysis_options.yaml b/analysis_options.yaml index f9b3034..1bb9e87 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1 +1,8 @@ include: package:flutter_lints/flutter.yaml +analyzer: + exclude: + - lib/l10n/intl/** + +linter: + rules: + prefer_single_quotes: true \ No newline at end of file diff --git a/arb/intl_en.arb b/arb/intl_en.arb index 87009b8..74a0596 100644 --- a/arb/intl_en.arb +++ b/arb/intl_en.arb @@ -406,5 +406,20 @@ "import": "Import", "importFile": "Import from file", "importUrl": "Import from URL", - "autoSetSystemDns": "Auto set system DNS" + "autoSetSystemDns": "Auto set system DNS", + "details": "{label} details", + "creationTime": "Creation time", + "progress": "Progress", + "host": "Host", + "destination": "Destination", + "destinationGeoIP": "Destination GeoIP", + "destinationIPASN": "Destination IPASN", + "specialProxy": "Special proxy", + "specialRules": "special rules", + "remoteDestination": "Remote destination", + "networkType": "Network type", + "proxyChains": "Proxy chains", + "log": "Log", + "connection": "Connection", + "request": "Request" } \ No newline at end of file diff --git a/arb/intl_ja.arb b/arb/intl_ja.arb index 5ee7bce..3b89759 100644 --- a/arb/intl_ja.arb +++ b/arb/intl_ja.arb @@ -407,5 +407,20 @@ "import": "インポート", "importFile": "ファイルからインポート", "importUrl": "URLからインポート", - "autoSetSystemDns": "オートセットシステムDNS" + "autoSetSystemDns": "オートセットシステムDNS", + "details": "{label}詳細", + "creationTime": "作成時間", + "progress": "進捗", + "host": "ホスト", + "destination": "宛先", + "destinationGeoIP": "宛先地理情報", + "destinationIPASN": "宛先IP ASN", + "specialProxy": "特殊プロキシ", + "specialRules": "特殊ルール", + "remoteDestination": "リモート宛先", + "networkType": "ネットワーク種別", + "proxyChains": "プロキシチェーン", + "log": "ログ", + "connection": "接続", + "request": "リクエスト" } \ No newline at end of file diff --git a/arb/intl_ru.arb b/arb/intl_ru.arb index 6067193..d0fff2b 100644 --- a/arb/intl_ru.arb +++ b/arb/intl_ru.arb @@ -407,5 +407,20 @@ "import": "Импорт", "importFile": "Импорт из файла", "importUrl": "Импорт по URL", - "autoSetSystemDns": "Автоматическая настройка системного DNS" + "autoSetSystemDns": "Автоматическая настройка системного DNS", + "details": "Детали {}", + "creationTime": "Время создания", + "progress": "Прогресс", + "host": "Хост", + "destination": "Назначение", + "destinationGeoIP": "Геолокация назначения", + "destinationIPASN": "ASN назначения", + "specialProxy": "Специальный прокси", + "specialRules": "Специальные правила", + "remoteDestination": "Удалённое назначение", + "networkType": "Тип сети", + "proxyChains": "Цепочки прокси", + "log": "Журнал", + "connection": "Соединение", + "request": "Запрос" } \ No newline at end of file diff --git a/arb/intl_zh_CN.arb b/arb/intl_zh_CN.arb index 5baf1cd..4a4a624 100644 --- a/arb/intl_zh_CN.arb +++ b/arb/intl_zh_CN.arb @@ -407,5 +407,20 @@ "import": "导入", "importFile": "通过文件导入", "importUrl": "通过URL导入", - "autoSetSystemDns": "自动设置系统DNS" + "autoSetSystemDns": "自动设置系统DNS", + "details": "{label}详情", + "creationTime": "创建时间", + "progress": "进度", + "host": "主机", + "destination": "目标地址", + "destinationGeoIP": "目标地理定位", + "destinationIPASN": "目标IP ASN", + "specialProxy": "特殊代理", + "specialRules": "特殊规则", + "remoteDestination": "远程目标", + "networkType": "网络类型", + "proxyChains": "代理链", + "log": "日志", + "connection": "连接", + "request": "请求" } diff --git a/core/Clash.Meta b/core/Clash.Meta index 413467a..34ccd12 160000 --- a/core/Clash.Meta +++ b/core/Clash.Meta @@ -1 +1 @@ -Subproject commit 413467ae6b3665fa63d072f18dfccd871c9cda6a +Subproject commit 34ccd1202bc18f638787791b9503cd014e7f21e0 diff --git a/core/go.mod b/core/go.mod index ff86ea2..992a2bc 100644 --- a/core/go.mod +++ b/core/go.mod @@ -52,25 +52,25 @@ require ( github.com/metacubex/amneziawg-go v0.0.0-20240922133038-fdf3a4d5a4ab // indirect github.com/metacubex/bart v0.20.5 // indirect github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399 // indirect - github.com/metacubex/chacha v0.1.2 // indirect + github.com/metacubex/chacha v0.1.5 // indirect github.com/metacubex/fswatch v0.1.1 // indirect github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 // indirect github.com/metacubex/gvisor v0.0.0-20250324165734-5857f47bd43b // indirect github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 // indirect github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639 // indirect github.com/metacubex/randv2 v0.2.0 // indirect - github.com/metacubex/sing v0.5.3 // indirect + github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29 // indirect github.com/metacubex/sing-mux v0.3.2 // indirect github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f // indirect - github.com/metacubex/sing-shadowsocks v0.2.10 // indirect - github.com/metacubex/sing-shadowsocks2 v0.2.4 // indirect + github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92 // indirect + github.com/metacubex/sing-shadowsocks2 v0.2.5-0.20250621023950-93d605a2143d // indirect github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2 // indirect - github.com/metacubex/sing-tun v0.4.6-0.20250524142129-9d110c0af70c // indirect + github.com/metacubex/sing-tun v0.4.7-0.20250611091011-60774779fdd8 // indirect github.com/metacubex/sing-vmess v0.2.2 // indirect github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f // indirect github.com/metacubex/smux v0.0.0-20250503055512-501391591dee // indirect github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4 // indirect - github.com/metacubex/utls v1.7.3 // indirect + github.com/metacubex/utls v1.7.4-0.20250610022031-808d767c8c73 // indirect github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181 // indirect github.com/miekg/dns v1.1.63 // indirect github.com/mroth/weightedrand/v2 v2.1.0 // indirect diff --git a/core/go.sum b/core/go.sum index 6517b72..5334aac 100644 --- a/core/go.sum +++ b/core/go.sum @@ -101,8 +101,8 @@ github.com/metacubex/bart v0.20.5 h1:XkgLZ17QxfxkqKdGsojoM2Zu01mmHyyQSFzt2/calTM github.com/metacubex/bart v0.20.5/go.mod h1:DCcyfP4MC+Zy7sLK7XeGuMw+P5K9mIRsYOBgiE8icsI= github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399 h1:oBowHVKZycNtAFbZ6avaCSZJYeme2Nrj+4RpV2cNJig= github.com/metacubex/bbolt v0.0.0-20240822011022-aed6d4850399/go.mod h1:4xcieuIK+M4bGQmQYZVqEaIYqjS1ahO4kXG7EmDgEro= -github.com/metacubex/chacha v0.1.2 h1:QulCq3eVm3TO6+4nVIWJtmSe7BT2GMrgVHuAoqRQnlc= -github.com/metacubex/chacha v0.1.2/go.mod h1:Djn9bPZxLTXbJFSeyo0/qzEzQI+gUSSzttuzZM75GH8= +github.com/metacubex/chacha v0.1.5 h1:fKWMb/5c7ZrY8Uoqi79PPFxl+qwR7X/q0OrsAubyX2M= +github.com/metacubex/chacha v0.1.5/go.mod h1:Djn9bPZxLTXbJFSeyo0/qzEzQI+gUSSzttuzZM75GH8= github.com/metacubex/fswatch v0.1.1 h1:jqU7C/v+g0qc2RUFgmAOPoVvfl2BXXUXEumn6oQuxhU= github.com/metacubex/fswatch v0.1.1/go.mod h1:czrTT7Zlbz7vWft8RQu9Qqh+JoX+Nnb+UabuyN1YsgI= github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvOzK9ubNCCkQ+ldc4YSH/rILn53l/xGBFHHI= @@ -116,20 +116,20 @@ github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639/go.mod h1:Kc6 github.com/metacubex/randv2 v0.2.0 h1:uP38uBvV2SxYfLj53kuvAjbND4RUDfFJjwr4UigMiLs= github.com/metacubex/randv2 v0.2.0/go.mod h1:kFi2SzrQ5WuneuoLLCMkABtiBu6VRrMrWFqSPyj2cxY= github.com/metacubex/sing v0.5.2/go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w= -github.com/metacubex/sing v0.5.3 h1:QWdN16WFKMk06x4nzkc8SvZ7y2x+TLQrpkPoHs+WSVM= -github.com/metacubex/sing v0.5.3/go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w= +github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29 h1:SD9q025FNTaepuFXFOKDhnGLVu6PQYChBvw2ZYPXeLo= +github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29/go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w= github.com/metacubex/sing-mux v0.3.2 h1:nJv52pyRivHcaZJKk2JgxpaVvj1GAXG81scSa9N7ncw= github.com/metacubex/sing-mux v0.3.2/go.mod h1:3rt1soewn0O6j89GCLmwAQFsq257u0jf2zQSPhTL3Bw= github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f h1:mP3vIm+9hRFI0C0Vl3pE0NESF/L85FDbuB0tGgUii6I= github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f/go.mod h1:JPTpf7fpnojsSuwRJExhSZSy63pVbp3VM39+zj+sAJM= -github.com/metacubex/sing-shadowsocks v0.2.10 h1:Pr7LDbjMANIQHl07zWgl1vDuhpsfDQUpZ8cX6DPabfg= -github.com/metacubex/sing-shadowsocks v0.2.10/go.mod h1:MtRM0ZZjR0kaDOzy9zWSt6/4/UlrnsNBq+1FNAF4vBk= -github.com/metacubex/sing-shadowsocks2 v0.2.4 h1:Ec0x3hHR7xkld5Z09IGh16wtUUpBb2HgqZ9DExd8Q7s= -github.com/metacubex/sing-shadowsocks2 v0.2.4/go.mod h1:WP8+S0kqtnSbX1vlIpo5i8Irm/ijZITEPBcZ26B5unY= +github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92 h1:Y9ebcKya6ow7VHoESCN5+l4zZvg5eaL2IhI5LLCQxQA= +github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92/go.mod h1:/squZ38pXrYjqtg8qn+joVvwbpGNYQNp8yxKsMVbCto= +github.com/metacubex/sing-shadowsocks2 v0.2.5-0.20250621023950-93d605a2143d h1:Ey3A1tA8lVkRbK1FDmwuWj/57Nr8JMdpoVqe45mFzJg= +github.com/metacubex/sing-shadowsocks2 v0.2.5-0.20250621023950-93d605a2143d/go.mod h1:+ukTd0OPFglT3bnKAYTJWYPbuox6HYNXE235r5tHdUk= github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2 h1:gXU+MYPm7Wme3/OAY2FFzVq9d9GxPHOqu5AQfg/ddhI= github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2/go.mod h1:mbfboaXauKJNIHJYxQRa+NJs4JU9NZfkA+I33dS2+9E= -github.com/metacubex/sing-tun v0.4.6-0.20250524142129-9d110c0af70c h1:Y6jk7AH5BEg9Dsvczrf/KokYsvxeKSZZlCLHg+hC4ro= -github.com/metacubex/sing-tun v0.4.6-0.20250524142129-9d110c0af70c/go.mod h1:HDaHDL6onAX2ZGbAGUXKp++PohRdNb7Nzt6zxzhox+U= +github.com/metacubex/sing-tun v0.4.7-0.20250611091011-60774779fdd8 h1:4zWKqxTx75TbfW2EmlQ3hxM6RTRg2PYOAVMCnU4I61I= +github.com/metacubex/sing-tun v0.4.7-0.20250611091011-60774779fdd8/go.mod h1:2YywXPWW8Z97kTH7RffOeykKzU+l0aiKlglWV1PAS64= github.com/metacubex/sing-vmess v0.2.2 h1:nG6GIKF1UOGmlzs+BIetdGHkFZ20YqFVIYp5Htqzp+4= github.com/metacubex/sing-vmess v0.2.2/go.mod h1:CVDNcdSLVYFgTHQlubr88d8CdqupAUDqLjROos+H9xk= github.com/metacubex/sing-wireguard v0.0.0-20250503063753-2dc62acc626f h1:Sr/DYKYofKHKc4GF3qkRGNuj6XA6c0eqPgEDN+VAsYU= @@ -138,8 +138,8 @@ github.com/metacubex/smux v0.0.0-20250503055512-501391591dee h1:lp6hJ+4wCLZu113a github.com/metacubex/smux v0.0.0-20250503055512-501391591dee/go.mod h1:4bPD8HWx9jPJ9aE4uadgyN7D1/Wz3KmPy+vale8sKLE= github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4 h1:j1VRTiC9JLR4nUbSikx9OGdu/3AgFDqgcLj4GoqyQkc= github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw= -github.com/metacubex/utls v1.7.3 h1:yDcMEWojFh+t8rU9X0HPcZDPAoFze/rIIyssqivzj8A= -github.com/metacubex/utls v1.7.3/go.mod h1:oknYT0qTOwE4hjPmZOEpzVdefnW7bAdGLvZcqmk4TLU= +github.com/metacubex/utls v1.7.4-0.20250610022031-808d767c8c73 h1:HWKsf92BqLYqugATFIJ3hYiEBZ7JF6AoqyvqF39afuI= +github.com/metacubex/utls v1.7.4-0.20250610022031-808d767c8c73/go.mod h1:oknYT0qTOwE4hjPmZOEpzVdefnW7bAdGLvZcqmk4TLU= github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181 h1:hJLQviGySBuaynlCwf/oYgIxbVbGRUIKZCxdya9YrbQ= github.com/metacubex/wireguard-go v0.0.0-20240922131502-c182e7471181/go.mod h1:phewKljNYiTVT31Gcif8RiCKnTUOgVWFJjccqYM8s+Y= github.com/miekg/dns v1.1.63 h1:8M5aAw6OMZfFXTT7K5V0Eu5YiiL8l7nUAkyN6C9YwaY= diff --git a/lib/application.dart b/lib/application.dart index 3fd92bc..3baa1b0 100644 --- a/lib/application.dart +++ b/lib/application.dart @@ -62,7 +62,7 @@ class ApplicationState extends ConsumerState { }); } - _autoUpdateGroupTask() { + void _autoUpdateGroupTask() { _autoUpdateGroupTaskTimer = Timer(const Duration(milliseconds: 20000), () { WidgetsBinding.instance.addPostFrameCallback((_) { globalState.appController.updateGroupsDebounce(); @@ -71,14 +71,14 @@ class ApplicationState extends ConsumerState { }); } - _autoUpdateProfilesTask() { + void _autoUpdateProfilesTask() { _autoUpdateProfilesTaskTimer = Timer(const Duration(minutes: 20), () async { await globalState.appController.autoUpdateProfiles(); _autoUpdateProfilesTask(); }); } - _buildPlatformState(Widget child) { + Widget _buildPlatformState(Widget child) { if (system.isDesktop) { return WindowManager( child: TrayManager( @@ -97,13 +97,13 @@ class ApplicationState extends ConsumerState { ); } - _buildState(Widget child) { + Widget _buildState(Widget child) { return AppStateManager( child: ClashManager( child: ConnectivityManager( onConnectivityChanged: (results) async { if (!results.contains(ConnectivityResult.vpn)) { - await clashCore.closeConnections(); + clashCore.closeConnections(); } globalState.appController.updateLocalIp(); globalState.appController.addCheckIpNumDebounce(); @@ -114,7 +114,7 @@ class ApplicationState extends ConsumerState { ); } - _buildPlatformApp(Widget child) { + Widget _buildPlatformApp(Widget child) { if (system.isDesktop) { return WindowHeaderContainer( child: child, @@ -125,7 +125,7 @@ class ApplicationState extends ConsumerState { ); } - _buildApp(Widget child) { + Widget _buildApp(Widget child) { return MessageManager( child: ThemeManager( child: child, @@ -153,8 +153,12 @@ class ApplicationState extends ConsumerState { ], builder: (_, child) { return AppEnvManager( - child: _buildPlatformApp( - _buildApp(child!), + child: _buildApp( + AppSidebarContainer( + child: _buildPlatformApp( + child!, + ), + ), ), ); }, @@ -179,7 +183,7 @@ class ApplicationState extends ConsumerState { primaryColor: themeProps.primaryColor, ).toPureBlack(themeProps.pureBlack), ), - home: child, + home: child!, ); }, child: const HomePage(), diff --git a/lib/clash/core.dart b/lib/clash/core.dart index 650933f..ab916f2 100644 --- a/lib/clash/core.dart +++ b/lib/clash/core.dart @@ -17,7 +17,7 @@ class ClashCore { late ClashHandlerInterface clashInterface; ClashCore._internal() { - if (Platform.isAndroid) { + if (system.isAndroid) { clashInterface = clashLib!; } else { clashInterface = clashService!; @@ -84,7 +84,7 @@ class ClashCore { return await clashInterface.setState(state); } - shutdown() async { + Future shutdown() async { await clashInterface.shutdown(); } @@ -107,14 +107,14 @@ class ClashCore { if (proxies.isEmpty) return []; final groupNames = [ UsedProxy.GLOBAL.name, - ...(proxies[UsedProxy.GLOBAL.name]["all"] as List).where((e) { + ...(proxies[UsedProxy.GLOBAL.name]['all'] as List).where((e) { final proxy = proxies[e] ?? {}; return GroupTypeExtension.valueList.contains(proxy['type']); }) ]; final groupsRaw = groupNames.map((groupName) { final group = proxies[groupName]; - group["all"] = ((group["all"] ?? []) as List) + group['all'] = ((group['all'] ?? []) as List) .map( (name) => proxies[name], ) @@ -133,22 +133,22 @@ class ClashCore { return await clashInterface.changeProxy(changeProxyParams); } - Future> getConnections() async { + Future> getConnections() async { final res = await clashInterface.getConnections(); final connectionsData = json.decode(res) as Map; final connectionsRaw = connectionsData['connections'] as List? ?? []; - return connectionsRaw.map((e) => Connection.fromJson(e)).toList(); + return connectionsRaw.map((e) => TrackerInfo.fromJson(e)).toList(); } - closeConnection(String id) { + void closeConnection(String id) { clashInterface.closeConnection(id); } - closeConnections() { + void closeConnections() { clashInterface.closeConnections(); } - resetConnections() { + void resetConnections() { clashInterface.resetConnections(); } @@ -202,11 +202,11 @@ class ClashCore { return clashInterface.updateExternalProvider(providerName); } - startListener() async { + Future startListener() async { await clashInterface.startListener(); } - stopListener() async { + Future stopListener() async { await clashInterface.stopListener(); } @@ -260,23 +260,23 @@ class ClashCore { return int.parse(value); } - resetTraffic() { + void resetTraffic() { clashInterface.resetTraffic(); } - startLog() { + void startLog() { clashInterface.startLog(); } - stopLog() { + void stopLog() { clashInterface.stopLog(); } - requestGc() { - clashInterface.forceGc(); + Future requestGc() async { + await clashInterface.forceGc(); } - destroy() async { + Future destroy() async { await clashInterface.destroy(); } } diff --git a/lib/clash/interface.dart b/lib/clash/interface.dart index 444cd22..bf7a30c 100644 --- a/lib/clash/interface.dart +++ b/lib/clash/interface.dart @@ -57,11 +57,11 @@ mixin ClashInterface { FutureOr getMemory(); - resetTraffic(); + FutureOr resetTraffic(); - startLog(); + FutureOr startLog(); - stopLog(); + FutureOr stopLog(); Future crash(); @@ -89,7 +89,7 @@ mixin AndroidClashInterface { abstract class ClashHandlerInterface with ClashInterface { Map callbackCompleterMap = {}; - handleResult(ActionResult result) async { + Future handleResult(ActionResult result) async { final completer = callbackCompleterMap[result.id]; try { switch (result.method) { @@ -105,13 +105,13 @@ abstract class ClashHandlerInterface with ClashInterface { return; } } catch (e) { - commonPrint.log("${result.id} error $e"); + commonPrint.log('${result.id} error $e'); } } - sendMessage(String message); + void sendMessage(String message); - reStart(); + FutureOr reStart(); FutureOr destroy(); @@ -122,14 +122,14 @@ abstract class ClashHandlerInterface with ClashInterface { FutureOr Function()? onTimeout, T? defaultValue, }) async { - final id = "${method.name}#${utils.id}"; + final id = '${method.name}#${utils.id}'; callbackCompleterMap[id] = Completer(); dynamic mDefaultValue = defaultValue; if (mDefaultValue == null) { if (T == String) { - mDefaultValue = ""; + mDefaultValue = ''; } else if (T == bool) { mDefaultValue = false; } else if (T == Map) { @@ -290,8 +290,8 @@ abstract class ClashHandlerInterface with ClashInterface { return invoke( method: ActionMethod.sideLoadExternalProvider, data: json.encode({ - "providerName": providerName, - "data": data, + 'providerName': providerName, + 'data': data, }), ); } @@ -382,9 +382,9 @@ abstract class ClashHandlerInterface with ClashInterface { @override Future asyncTestDelay(String url, String proxyName) { final delayParams = { - "proxy-name": proxyName, - "timeout": httpTimeoutDuration.inMilliseconds, - "test-url": url, + 'proxy-name': proxyName, + 'timeout': httpTimeoutDuration.inMilliseconds, + 'test-url': url, }; return invoke( method: ActionMethod.asyncTestDelay, diff --git a/lib/clash/lib.dart b/lib/clash/lib.dart index 9cebf14..b15a50a 100644 --- a/lib/clash/lib.dart +++ b/lib/clash/lib.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:ffi'; -import 'dart:io'; import 'dart:isolate'; import 'dart:ui'; @@ -30,7 +29,7 @@ class ClashLib extends ClashHandlerInterface with AndroidClashInterface { return _canSendCompleter.future; } - _initService() async { + Future _initService() async { await service?.destroy(); _registerMainPort(receiverPort.sendPort); receiverPort.listen((message) { @@ -52,7 +51,7 @@ class ClashLib extends ClashHandlerInterface with AndroidClashInterface { await service?.init(); } - _registerMainPort(SendPort sendPort) { + void _registerMainPort(SendPort sendPort) { IsolateNameServer.removePortNameMapping(mainIsolate); IsolateNameServer.registerPortWithName(sendPort, mainIsolate); } @@ -139,7 +138,7 @@ class ClashLibHandler { late final DynamicLibrary lib; ClashLibHandler._internal() { - lib = DynamicLibrary.open("libclash.so"); + lib = DynamicLibrary.open('libclash.so'); clashFFI = ClashFFI(lib); clashFFI.initNativeApiBridge( NativeApi.initializeApiDLData, @@ -169,19 +168,19 @@ class ClashLibHandler { return completer.future; } - attachMessagePort(int messagePort) { + void attachMessagePort(int messagePort) { clashFFI.attachMessagePort( messagePort, ); } - updateDns(String dns) { + void updateDns(String dns) { final dnsChar = dns.toNativeUtf8().cast(); clashFFI.updateDns(dnsChar); malloc.free(dnsChar); } - setState(CoreState state) { + void setState(CoreState state) { final stateChar = json.encode(state).toNativeUtf8().cast(); clashFFI.setState(stateChar); malloc.free(stateChar); @@ -221,12 +220,12 @@ class ClashLibHandler { return Traffic.fromMap(json.decode(trafficString)); } - startListener() async { + Future startListener() async { clashFFI.startListener(); return true; } - stopListener() async { + Future stopListener() async { clashFFI.stopListener(); return true; } @@ -287,7 +286,7 @@ class ClashLibHandler { } ClashLib? get clashLib => - Platform.isAndroid && !globalState.isService ? ClashLib() : null; + system.isAndroid && !globalState.isService ? ClashLib() : null; ClashLibHandler? get clashLibHandler => - Platform.isAndroid && globalState.isService ? ClashLibHandler() : null; + system.isAndroid && globalState.isService ? ClashLibHandler() : null; diff --git a/lib/clash/message.dart b/lib/clash/message.dart index 5a81f41..06794ab 100644 --- a/lib/clash/message.dart +++ b/lib/clash/message.dart @@ -23,7 +23,7 @@ class ClashMessage { listener.onDelay(Delay.fromJson(m.data)); break; case AppMessageType.request: - listener.onRequest(Connection.fromJson(m.data)); + listener.onRequest(TrackerInfo.fromJson(m.data)); break; case AppMessageType.loaded: listener.onLoaded(m.data); diff --git a/lib/clash/service.dart b/lib/clash/service.dart index b104eaf..04de6fe 100644 --- a/lib/clash/service.dart +++ b/lib/clash/service.dart @@ -28,9 +28,9 @@ class ClashService extends ClashHandlerInterface { reStart(); } - _initServer() async { + Future _initServer() async { runZonedGuarded(() async { - final address = !Platform.isWindows + final address = !system.isWindows ? InternetAddress( unixSocketPath, type: InternetAddressType.unix, @@ -83,10 +83,10 @@ class ClashService extends ClashHandlerInterface { await shutdown(); } final serverSocket = await serverCompleter.future; - final arg = Platform.isWindows - ? "${serverSocket.port}" + final arg = system.isWindows + ? '${serverSocket.port}' : serverSocket.address.address; - if (Platform.isWindows && await system.checkIsAdmin()) { + if (system.isWindows && await system.checkIsAdmin()) { final isSuccess = await request.startCoreByHelper(arg); if (isSuccess) { return; @@ -122,8 +122,8 @@ class ClashService extends ClashHandlerInterface { socket.writeln(message); } - _deleteSocketFile() async { - if (!Platform.isWindows) { + Future _deleteSocketFile() async { + if (!system.isWindows) { final file = File(unixSocketPath); if (await file.exists()) { await file.delete(); @@ -131,7 +131,7 @@ class ClashService extends ClashHandlerInterface { } } - _destroySocket() async { + Future _destroySocket() async { if (socketCompleter.isCompleted) { final lastSocket = await socketCompleter.future; await lastSocket.close(); @@ -141,7 +141,7 @@ class ClashService extends ClashHandlerInterface { @override shutdown() async { - if (Platform.isWindows) { + if (system.isWindows) { await request.stopCoreByHelper(); } await _destroySocket(); diff --git a/lib/common/android.dart b/lib/common/android.dart index c2ffdd3..09aa7bf 100644 --- a/lib/common/android.dart +++ b/lib/common/android.dart @@ -1,14 +1,14 @@ -import 'dart:io'; - import 'package:fl_clash/plugins/app.dart'; import 'package:fl_clash/state.dart'; +import 'system.dart'; + class Android { - init() async { + Future init() async { app?.onExit = () async { await globalState.appController.savePreferences(); }; } } -final android = Platform.isAndroid ? Android() : null; +final android = system.isAndroid ? Android() : null; diff --git a/lib/common/archive.dart b/lib/common/archive.dart index b2c6630..ab0512a 100644 --- a/lib/common/archive.dart +++ b/lib/common/archive.dart @@ -1,10 +1,11 @@ import 'dart:convert'; import 'dart:io'; + import 'package:archive/archive_io.dart'; import 'package:path/path.dart'; extension ArchiveExt on Archive { - addDirectoryToArchive(String dirPath, String parentPath) { + void addDirectoryToArchive(String dirPath, String parentPath) { final dir = Directory(dirPath); final entities = dir.listSync(recursive: false); for (final entity in entities) { @@ -19,7 +20,7 @@ extension ArchiveExt on Archive { } } - add(String name, T raw) { + void add(String name, T raw) { final data = json.encode(raw); addFile( ArchiveFile(name, data.length, data), diff --git a/lib/common/color.dart b/lib/common/color.dart index 2a71752..90f5b5b 100644 --- a/lib/common/color.dart +++ b/lib/common/color.dart @@ -23,6 +23,10 @@ extension ColorExtension on Color { return withAlpha(77); } + Color get opacity12 { + return withAlpha(31); + } + Color get opacity15 { return withAlpha(38); } diff --git a/lib/common/common.dart b/lib/common/common.dart index ab98059..35eb626 100644 --- a/lib/common/common.dart +++ b/lib/common/common.dart @@ -37,4 +37,3 @@ export 'text.dart'; export 'tray.dart'; export 'utils.dart'; export 'window.dart'; -export 'windows.dart'; diff --git a/lib/common/constant.dart b/lib/common/constant.dart index 3a29a22..99a2bf0 100644 --- a/lib/common/constant.dart +++ b/lib/common/constant.dart @@ -1,4 +1,3 @@ -import 'dart:io'; import 'dart:math'; import 'dart:ui'; @@ -8,13 +7,13 @@ import 'package:fl_clash/enum/enum.dart'; import 'package:fl_clash/models/models.dart'; import 'package:flutter/material.dart'; -const appName = "FlClash"; -const appHelperService = "FlClashHelperService"; -const coreName = "clash.meta"; +const appName = 'FlClash'; +const appHelperService = 'FlClashHelperService'; +const coreName = 'clash.meta'; const browserUa = - "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"; -const packageName = "com.follow.clash"; -final unixSocketPath = "/tmp/FlClashSocket_${Random().nextInt(10000)}.sock"; + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'; +const packageName = 'com.follow.clash'; +final unixSocketPath = '/tmp/FlClashSocket_${Random().nextInt(10000)}.sock'; const helperPort = 47890; const maxTextScale = 1.4; const minTextScale = 0.8; @@ -31,25 +30,25 @@ const animateDuration = Duration(milliseconds: 100); const midDuration = Duration(milliseconds: 200); const commonDuration = Duration(milliseconds: 300); const defaultUpdateDuration = Duration(days: 1); -const mmdbFileName = "geoip.metadb"; -const asnFileName = "ASN.mmdb"; -const geoIpFileName = "GeoIP.dat"; -const geoSiteFileName = "GeoSite.dat"; +const mmdbFileName = 'geoip.metadb'; +const asnFileName = 'ASN.mmdb'; +const geoIpFileName = 'GeoIP.dat'; +const geoSiteFileName = 'GeoSite.dat'; final double kHeaderHeight = system.isDesktop - ? !Platform.isMacOS + ? !system.isMacOS ? 40 : 28 : 0; -const profilesDirectoryName = "profiles"; -const localhost = "127.0.0.1"; -const clashConfigKey = "clash_config"; -const configKey = "config"; +const profilesDirectoryName = 'profiles'; +const localhost = '127.0.0.1'; +const clashConfigKey = 'clash_config'; +const configKey = 'config'; const double dialogCommonWidth = 300; -const repository = "chen08209/FlClash"; -const defaultExternalController = "127.0.0.1:9090"; +const repository = 'chen08209/FlClash'; +const defaultExternalController = '127.0.0.1:9090'; const maxMobileWidth = 600; const maxLaptopWidth = 840; -const defaultTestUrl = "https://www.gstatic.com/generate_204"; +const defaultTestUrl = 'https://www.gstatic.com/generate_204'; final commonFilter = ImageFilter.blur( sigmaX: 5, sigmaY: 5, @@ -57,7 +56,7 @@ final commonFilter = ImageFilter.blur( ); const navigationItemListEquality = ListEquality(); -const connectionListEquality = ListEquality(); +const trackerInfoListEquality = ListEquality(); const stringListEquality = ListEquality(); const intListEquality = ListEquality(); const logListEquality = ListEquality(); @@ -78,9 +77,9 @@ const viewModeColumnsMap = { ViewMode.desktop: [4, 3], }; -// const proxiesStoreKey = PageStorageKey('proxies'); -// const toolsStoreKey = PageStorageKey('tools'); -// const profilesStoreKey = PageStorageKey('profiles'); +const proxiesListStoreKey = PageStorageKey('proxies_list'); +const toolsStoreKey = PageStorageKey('tools'); +const profilesStoreKey = PageStorageKey('profiles'); const defaultPrimaryColor = 0XFFD8C0C3; @@ -88,11 +87,11 @@ double getWidgetHeight(num lines) { return max(lines * 84 + (lines - 1) * 16, 0).ap; } -const maxLength = 150; +const maxLength = 1000; -final mainIsolate = "FlClashMainIsolate"; +final mainIsolate = 'FlClashMainIsolate'; -final serviceIsolate = "FlClashServiceIsolate"; +final serviceIsolate = 'FlClashServiceIsolate'; const defaultPrimaryColors = [ 0xFF795548, @@ -104,7 +103,7 @@ const defaultPrimaryColors = [ 0XFF665390, ]; -const scriptTemplate = """ +const scriptTemplate = ''' const main = (config) => { return config; -}"""; +}'''; diff --git a/lib/common/context.dart b/lib/common/context.dart index 70751b9..0fcc25d 100644 --- a/lib/common/context.dart +++ b/lib/common/context.dart @@ -7,11 +7,11 @@ extension BuildContextExtension on BuildContext { return findAncestorStateOfType(); } - showNotifier(String text) { + Future? showNotifier(String text) { return findAncestorStateOfType()?.message(text); } - showSnackBar( + void showSnackBar( String message, { SnackBarAction? action, }) { @@ -72,3 +72,18 @@ extension BuildContextExtension on BuildContext { return state; } } + +class BackHandleInherited extends InheritedWidget { + final Function handleBack; + + const BackHandleInherited( + {super.key, required this.handleBack, required super.child}); + + static BackHandleInherited? of(BuildContext context) => + context.dependOnInheritedWidgetOfExactType(); + + @override + bool updateShouldNotify(BackHandleInherited oldWidget) { + return handleBack != oldWidget.handleBack; + } +} diff --git a/lib/common/datetime.dart b/lib/common/datetime.dart index d514320..f4c3434 100644 --- a/lib/common/datetime.dart +++ b/lib/common/datetime.dart @@ -17,26 +17,34 @@ extension DateTimeExtension on DateTime { final difference = currentDateTime.difference(this); final days = difference.inDays; if (days >= 365) { - return "${(days / 365).floor()} ${appLocalizations.years}${appLocalizations.ago}"; + return '${(days / 365).floor()} ${appLocalizations.years}${appLocalizations.ago}'; } if (days >= 30) { - return "${(days / 30).floor()} ${appLocalizations.months}${appLocalizations.ago}"; + return '${(days / 30).floor()} ${appLocalizations.months}${appLocalizations.ago}'; } if (days >= 1) { - return "$days ${appLocalizations.days}${appLocalizations.ago}"; + return '$days ${appLocalizations.days}${appLocalizations.ago}'; } final hours = difference.inHours; if (hours >= 1) { - return "$hours ${appLocalizations.hours}${appLocalizations.ago}"; + return '$hours ${appLocalizations.hours}${appLocalizations.ago}'; } final minutes = difference.inMinutes; if (minutes >= 1) { - return "$minutes ${appLocalizations.minutes}${appLocalizations.ago}"; + return '$minutes ${appLocalizations.minutes}${appLocalizations.ago}'; } return appLocalizations.just; } String get show { - return toIso8601String().substring(0, 10); + return toString().substring(0, 10); + } + + String get showFull { + return toString().substring(0, 19); + } + + String get showTime { + return toString().substring(10, 19); } } diff --git a/lib/common/dav_client.dart b/lib/common/dav_client.dart index aef4f7c..d3b5c11 100644 --- a/lib/common/dav_client.dart +++ b/lib/common/dav_client.dart @@ -38,18 +38,18 @@ class DAVClient { } } - get root => "/$appName"; + String get root => '/$appName'; - get backupFile => "$root/$fileName"; + String get backupFile => '$root/$fileName'; - backup(Uint8List data) async { - await client.mkdir("$root"); - await client.write("$backupFile", data); + Future backup(Uint8List data) async { + await client.mkdir(root); + await client.write(backupFile, data); return true; } Future> recovery() async { - await client.mkdir("$root"); + await client.mkdir(root); final data = await client.read(backupFile); return data; } diff --git a/lib/common/fixed.dart b/lib/common/fixed.dart index 55e8ef0..68525d4 100644 --- a/lib/common/fixed.dart +++ b/lib/common/fixed.dart @@ -1,5 +1,7 @@ import 'iterable.dart'; +typedef ValueCallback = T Function(); + class FixedList { final int maxLength; final List _list; @@ -7,12 +9,12 @@ class FixedList { FixedList(this.maxLength, {List? list}) : _list = (list ?? [])..truncate(maxLength); - add(T item) { + void add(T item) { _list.add(item); _list.truncate(maxLength); } - clear() { + void clear() { _list.clear(); } @@ -38,7 +40,7 @@ class FixedMap { _map = map ?? {}; } - updateCacheValue(K key, V Function() callback) { + V updateCacheValue(K key, ValueCallback callback) { final realValue = _map.updateCacheValue( key, callback, @@ -47,21 +49,21 @@ class FixedMap { return realValue; } - clear() { + void clear() { _map.clear(); } - updateMaxLength(int size) { + void updateMaxLength(int size) { maxLength = size; _adjustMap(); } - updateMap(Map map) { + void updateMap(Map map) { _map = map; _adjustMap(); } - _adjustMap() { + void _adjustMap() { if (_map.length > maxLength) { _map = Map.fromEntries( map.entries.toList()..truncate(maxLength), diff --git a/lib/common/function.dart b/lib/common/function.dart index 7003c5f..800a72f 100644 --- a/lib/common/function.dart +++ b/lib/common/function.dart @@ -5,7 +5,7 @@ import 'package:fl_clash/enum/enum.dart'; class Debouncer { final Map _operations = {}; - call( + void call( FunctionTag tag, Function func, { List? args, @@ -28,7 +28,7 @@ class Debouncer { ); } - cancel(dynamic tag) { + void cancel(dynamic tag) { _operations[tag]?.cancel(); _operations[tag] = null; } @@ -37,7 +37,7 @@ class Debouncer { class Throttler { final Map _operations = {}; - call( + bool call( FunctionTag tag, Function func, { List? args, @@ -61,7 +61,7 @@ class Throttler { return false; } - cancel(dynamic tag) { + void cancel(dynamic tag) { _operations[tag]?.cancel(); _operations[tag] = null; } @@ -81,7 +81,7 @@ Future retry({ } attempts++; } - throw "unknown error"; + throw 'unknown error'; } final debouncer = Debouncer(); diff --git a/lib/common/future.dart b/lib/common/future.dart index d61f264..f101476 100644 --- a/lib/common/future.dart +++ b/lib/common/future.dart @@ -4,7 +4,7 @@ import 'dart:ui'; import 'package:fl_clash/common/common.dart'; extension CompleterExt on Completer { - safeFuture({ + Future safeFuture({ Duration? timeout, VoidCallback? onLast, FutureOr Function()? onTimeout, diff --git a/lib/common/http.dart b/lib/common/http.dart index 0fe22a3..3e57160 100644 --- a/lib/common/http.dart +++ b/lib/common/http.dart @@ -6,13 +6,13 @@ import 'package:fl_clash/state.dart'; class FlClashHttpOverrides extends HttpOverrides { static String handleFindProxy(Uri url) { if ([localhost].contains(url.host)) { - return "DIRECT"; + return 'DIRECT'; } final port = globalState.config.patchClashConfig.mixedPort; final isStart = globalState.appState.runTime != null; - commonPrint.log("find $url proxy:$isStart"); - if (!isStart) return "DIRECT"; - return "PROXY localhost:$port"; + commonPrint.log('find $url proxy:$isStart'); + if (!isStart) return 'DIRECT'; + return 'PROXY localhost:$port'; } @override diff --git a/lib/common/icons.dart b/lib/common/icons.dart index 6faca51..9f9fb42 100644 --- a/lib/common/icons.dart +++ b/lib/common/icons.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; -class IconsExt{ - static const IconData target = - IconData(0xe900, fontFamily: "Icons"); -} \ No newline at end of file +class IconsExt { + static const IconData target = IconData(0xe900, fontFamily: 'Icons'); +} diff --git a/lib/common/iterable.dart b/lib/common/iterable.dart index 9cd7033..f1c217d 100644 --- a/lib/common/iterable.dart +++ b/lib/common/iterable.dart @@ -47,7 +47,9 @@ extension IterableExt on Iterable { extension ListExt on List { void truncate(int maxLength) { - assert(maxLength > 0); + if (maxLength == 0) { + return; + } if (length > maxLength) { removeRange(0, length - maxLength); } @@ -70,11 +72,19 @@ extension ListExt on List { return res; } - List safeSublist(int start) { + List safeSublist(int start, [int? end]) { if (start <= 0) return this; if (start > length) return []; + if (end != null) { + return sublist(start, end.clamp(start, length)); + } return sublist(start); } + + T safeGet(int index) { + if (length > index) return this[index]; + return last; + } } extension DoubleListExt on List { @@ -104,10 +114,10 @@ extension DoubleListExt on List { } extension MapExt on Map { - updateCacheValue(K key, V Function() callback) { + V updateCacheValue(K key, V Function() callback) { if (this[key] == null) { this[key] = callback(); } - return this[key]; + return this[key]!; } } diff --git a/lib/common/keyboard.dart b/lib/common/keyboard.dart index 6572767..be2ee42 100644 --- a/lib/common/keyboard.dart +++ b/lib/common/keyboard.dart @@ -1,8 +1,8 @@ -import 'dart:io'; - import 'package:flutter/services.dart'; import 'package:uni_platform/uni_platform.dart'; +import 'system.dart'; + final Map _knownKeyLabels = { PhysicalKeyboardKey.keyA: 'A', @@ -79,14 +79,14 @@ final Map _knownKeyLabels = PhysicalKeyboardKey.arrowLeft: '←', PhysicalKeyboardKey.arrowDown: '↓', PhysicalKeyboardKey.arrowUp: '↑', - PhysicalKeyboardKey.controlLeft: "CTRL", + PhysicalKeyboardKey.controlLeft: 'CTRL', PhysicalKeyboardKey.shiftLeft: 'SHIFT', - PhysicalKeyboardKey.altLeft: "ALT", - PhysicalKeyboardKey.metaLeft: Platform.isMacOS ? '⌘' : 'WIN', - PhysicalKeyboardKey.controlRight: "CTRL", + PhysicalKeyboardKey.altLeft: 'ALT', + PhysicalKeyboardKey.metaLeft: system.isMacOS ? '⌘' : 'WIN', + PhysicalKeyboardKey.controlRight: 'CTRL', PhysicalKeyboardKey.shiftRight: 'SHIFT', - PhysicalKeyboardKey.altRight: "ALT", - PhysicalKeyboardKey.metaRight: Platform.isMacOS ? '⌘' : 'WIN', + PhysicalKeyboardKey.altRight: 'ALT', + PhysicalKeyboardKey.metaRight: system.isMacOS ? '⌘' : 'WIN', PhysicalKeyboardKey.fn: 'FN', }; @@ -101,6 +101,3 @@ extension KeyboardKeyExt on KeyboardKey { return _knownKeyLabels[physicalKey] ?? physicalKey?.debugName ?? 'Unknown'; } } - - - diff --git a/lib/common/launch.dart b/lib/common/launch.dart index 5a6c541..02ddcd2 100644 --- a/lib/common/launch.dart +++ b/lib/common/launch.dart @@ -34,8 +34,8 @@ class AutoLaunch { return await launchAtStartup.disable(); } - updateStatus(bool isAutoLaunch) async { - if(kDebugMode){ + Future updateStatus(bool isAutoLaunch) async { + if (kDebugMode) { return; } if (await isEnable == isAutoLaunch) return; diff --git a/lib/common/link.dart b/lib/common/link.dart index 3e6d2da..719e8b2 100644 --- a/lib/common/link.dart +++ b/lib/common/link.dart @@ -15,8 +15,9 @@ class LinkManager { _appLinks = AppLinks(); } - initAppLinksListen(installConfigCallBack) async { - commonPrint.log("initAppLinksListen"); + Future initAppLinksListen( + Function(String url) installConfigCallBack) async { + commonPrint.log('initAppLinksListen'); destroy(); subscription = _appLinks.uriLinkStream.listen( (uri) { @@ -32,7 +33,7 @@ class LinkManager { ); } - destroy() { + void destroy() { if (subscription != null) { subscription?.cancel(); subscription = null; diff --git a/lib/common/measure.dart b/lib/common/measure.dart index fbeabf5..063889e 100644 --- a/lib/common/measure.dart +++ b/lib/common/measure.dart @@ -33,10 +33,10 @@ class Measure { double get bodyMediumHeight { return _measureMap.updateCacheValue( - "bodyMediumHeight", + 'bodyMediumHeight', () => computeTextSize( Text( - "X", + 'X', style: context.textTheme.bodyMedium, ), ).height, @@ -45,10 +45,10 @@ class Measure { double get bodyLargeHeight { return _measureMap.updateCacheValue( - "bodyLargeHeight", + 'bodyLargeHeight', () => computeTextSize( Text( - "X", + 'X', style: context.textTheme.bodyLarge, ), ).height, @@ -57,10 +57,10 @@ class Measure { double get bodySmallHeight { return _measureMap.updateCacheValue( - "bodySmallHeight", + 'bodySmallHeight', () => computeTextSize( Text( - "X", + 'X', style: context.textTheme.bodySmall, ), ).height, @@ -69,10 +69,10 @@ class Measure { double get labelSmallHeight { return _measureMap.updateCacheValue( - "labelSmallHeight", + 'labelSmallHeight', () => computeTextSize( Text( - "X", + 'X', style: context.textTheme.labelSmall, ), ).height, @@ -81,10 +81,10 @@ class Measure { double get labelMediumHeight { return _measureMap.updateCacheValue( - "labelMediumHeight", + 'labelMediumHeight', () => computeTextSize( Text( - "X", + 'X', style: context.textTheme.labelMedium, ), ).height, @@ -93,10 +93,10 @@ class Measure { double get titleLargeHeight { return _measureMap.updateCacheValue( - "titleLargeHeight", + 'titleLargeHeight', () => computeTextSize( Text( - "X", + 'X', style: context.textTheme.titleLarge, ), ).height, @@ -105,10 +105,10 @@ class Measure { double get titleMediumHeight { return _measureMap.updateCacheValue( - "titleMediumHeight", + 'titleMediumHeight', () => computeTextSize( Text( - "X", + 'X', style: context.textTheme.titleMedium, ), ).height, diff --git a/lib/common/mixin.dart b/lib/common/mixin.dart index 7fe72fb..17ed5e7 100644 --- a/lib/common/mixin.dart +++ b/lib/common/mixin.dart @@ -1,7 +1,4 @@ -import 'package:fl_clash/models/models.dart'; -import 'package:flutter/material.dart'; import 'package:riverpod/riverpod.dart'; -import 'context.dart'; mixin AutoDisposeNotifierMixin on AutoDisposeNotifier { set value(T value) { @@ -17,37 +14,31 @@ mixin AutoDisposeNotifierMixin on AutoDisposeNotifier { return res; } - onUpdate(T value) {} + void onUpdate(T value) {} } -mixin PageMixin on State { - void onPageShow() { - initPageState(); - } - - initPageState() { - WidgetsBinding.instance.addPostFrameCallback((_) { - final commonScaffoldState = context.commonScaffoldState; - commonScaffoldState?.actions = actions; - commonScaffoldState?.floatingActionButton = floatingActionButton; - commonScaffoldState?.onKeywordsUpdate = onKeywordsUpdate; - commonScaffoldState?.updateSearchState( - (_) => onSearch != null - ? AppBarSearchState( - onSearch: onSearch!, - ) - : null, - ); - }); - } - - void onPageHidden() {} - - List get actions => []; - - Widget? get floatingActionButton => null; - - Function(String)? get onSearch => null; - - Function(List)? get onKeywordsUpdate => null; -} +// mixin PageMixin on State { +// initPageState() { +// WidgetsBinding.instance.addPostFrameCallback((_) { +// final commonScaffoldState = context.commonScaffoldState; +// commonScaffoldState?.actions = actions; +// commonScaffoldState?.floatingActionButton = floatingActionButton; +// commonScaffoldState?.onKeywordsUpdate = onKeywordsUpdate; +// commonScaffoldState?.updateSearchState( +// (_) => onSearch != null +// ? AppBarSearchState( +// onSearch: onSearch!, +// ) +// : null, +// ); +// }); +// } +// +// List get actions => []; +// +// Widget? get floatingActionButton => null; +// +// Function(String)? get onSearch => null; +// +// Function(List)? get onKeywordsUpdate => null; +// } diff --git a/lib/common/navigation.dart b/lib/common/navigation.dart index a82bdae..0519e26 100644 --- a/lib/common/navigation.dart +++ b/lib/common/navigation.dart @@ -1,7 +1,9 @@ import 'package:fl_clash/enum/enum.dart'; import 'package:fl_clash/models/models.dart'; +import 'package:fl_clash/providers/providers.dart'; import 'package:fl_clash/views/views.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; class Navigation { static Navigation? _instance; @@ -11,62 +13,69 @@ class Navigation { bool hasProxies = false, }) { return [ - const NavigationItem( + NavigationItem( keep: false, icon: Icon(Icons.space_dashboard), label: PageLabel.dashboard, - view: DashboardView( + builder: (_) => const DashboardView( key: GlobalObjectKey(PageLabel.dashboard), ), ), NavigationItem( icon: const Icon(Icons.article), label: PageLabel.proxies, - view: const ProxiesView( - key: GlobalObjectKey( - PageLabel.proxies, + builder: (_) => ProviderScope( + overrides: [ + queryProvider.overrideWith( + () => Query(), + ), + ], + child: const ProxiesView( + key: GlobalObjectKey( + PageLabel.proxies, + ), ), ), modes: hasProxies ? [NavigationItemMode.mobile, NavigationItemMode.desktop] : [], ), - const NavigationItem( + NavigationItem( icon: Icon(Icons.folder), label: PageLabel.profiles, - view: ProfilesView( + builder: (_) => const ProfilesView( key: GlobalObjectKey( PageLabel.profiles, ), ), ), - const NavigationItem( + NavigationItem( icon: Icon(Icons.view_timeline), label: PageLabel.requests, - view: RequestsView( + builder: (_) => const RequestsView( key: GlobalObjectKey( PageLabel.requests, ), ), - description: "requestsDesc", + description: 'requestsDesc', modes: [NavigationItemMode.desktop, NavigationItemMode.more], ), - const NavigationItem( + NavigationItem( icon: Icon(Icons.ballot), label: PageLabel.connections, - view: ConnectionsView( + builder: (_) => const ConnectionsView( key: GlobalObjectKey( PageLabel.connections, ), ), - description: "connectionsDesc", + description: 'connectionsDesc', modes: [NavigationItemMode.desktop, NavigationItemMode.more], ), - const NavigationItem( + NavigationItem( icon: Icon(Icons.storage), label: PageLabel.resources, - description: "resourcesDesc", - view: ResourcesView( + description: 'resourcesDesc', + builder: (_) => const ResourcesView( key: GlobalObjectKey( PageLabel.resources, ), @@ -76,20 +85,20 @@ class Navigation { NavigationItem( icon: const Icon(Icons.adb), label: PageLabel.logs, - view: const LogsView( + builder: (_) => const LogsView( key: GlobalObjectKey( PageLabel.logs, ), ), - description: "logsDesc", + description: 'logsDesc', modes: openLogs ? [NavigationItemMode.desktop, NavigationItemMode.more] : [], ), - const NavigationItem( + NavigationItem( icon: Icon(Icons.construction), label: PageLabel.tools, - view: ToolsView( + builder: (_) => const ToolsView( key: GlobalObjectKey( PageLabel.tools, ), diff --git a/lib/common/navigator.dart b/lib/common/navigator.dart index b2b3d56..a7d05c1 100644 --- a/lib/common/navigator.dart +++ b/lib/common/navigator.dart @@ -2,7 +2,6 @@ import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/enum/enum.dart'; import 'package:fl_clash/models/models.dart'; import 'package:fl_clash/state.dart'; -import 'package:fl_clash/widgets/dialog.dart'; import 'package:flutter/material.dart'; class BaseNavigator { @@ -21,20 +20,20 @@ class BaseNavigator { ); } - static Future modal(BuildContext context, Widget child) async { - if (globalState.appState.viewMode != ViewMode.mobile) { - return await globalState.showCommonDialog( - child: CommonModal( - child: child, - ), - ); - } - return await Navigator.of(context).push( - CommonRoute( - builder: (context) => child, - ), - ); - } + // static Future modal(BuildContext context, Widget child) async { + // if (globalState.appState.viewMode != ViewMode.mobile) { + // return await globalState.showCommonDialog( + // child: CommonModal( + // child: child, + // ), + // ); + // } + // return await Navigator.of(context).push( + // CommonRoute( + // builder: (context) => child, + // ), + // ); + // } } class CommonDesktopRoute extends PageRoute { diff --git a/lib/common/num.dart b/lib/common/num.dart index 7166509..1d26018 100644 --- a/lib/common/num.dart +++ b/lib/common/num.dart @@ -3,7 +3,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; extension NumExt on num { - String fixed({decimals = 2}) { + String fixed({int decimals = 2}) { String formatted = toStringAsFixed(decimals); if (formatted.contains('.')) { formatted = formatted.replaceAll(RegExp(r'0*$'), ''); @@ -20,7 +20,7 @@ extension NumExt on num { } extension DoubleExt on double { - moreOrEqual(double value) { + bool moreOrEqual(double value) { return this > value || (value - this).abs() < precisionErrorTolerance + 1; } } @@ -46,7 +46,7 @@ extension OffsetExt on Offset { } extension RectExt on Rect { - doRectIntersect(Rect rect) { + bool doRectIntersect(Rect rect) { return left < rect.right && right > rect.left && top < rect.bottom && diff --git a/lib/common/package.dart b/lib/common/package.dart index f864a5c..2560187 100644 --- a/lib/common/package.dart +++ b/lib/common/package.dart @@ -6,8 +6,8 @@ import 'common.dart'; extension PackageInfoExtension on PackageInfo { String get ua => [ - "$appName/v$version", - "clash-verge", - "Platform/${Platform.operatingSystem}", - ].join(" "); + '$appName/v$version', + 'clash-verge', + 'Platform/${Platform.operatingSystem}', + ].join(' '); } diff --git a/lib/common/path.dart b/lib/common/path.dart index 21be3b3..da019d7 100644 --- a/lib/common/path.dart +++ b/lib/common/path.dart @@ -31,7 +31,7 @@ class AppPath { } String get executableExtension { - return Platform.isWindows ? ".exe" : ""; + return system.isWindows ? '.exe' : ''; } String get executableDirPath { @@ -40,11 +40,11 @@ class AppPath { } String get corePath { - return join(executableDirPath, "FlClashCore$executableExtension"); + return join(executableDirPath, 'FlClashCore$executableExtension'); } String get helperPath { - return join(executableDirPath, "$appHelperService$executableExtension"); + return join(executableDirPath, '$appHelperService$executableExtension'); } Future get downloadDirPath async { @@ -59,12 +59,12 @@ class AppPath { Future get lockFilePath async { final directory = await dataDir.future; - return join(directory.path, "FlClash.lock"); + return join(directory.path, 'FlClash.lock'); } Future get sharedPreferencesPath async { final directory = await dataDir.future; - return join(directory.path, "shared_preferences.json"); + return join(directory.path, 'shared_preferences.json'); } Future get profilesPath async { @@ -74,14 +74,14 @@ class AppPath { Future getProfilePath(String id) async { final directory = await profilesPath; - return join(directory, "$id.yaml"); + return join(directory, '$id.yaml'); } Future getProvidersDirPath(String id) async { final directory = await profilesPath; return join( directory, - "providers", + 'providers', id, ); } @@ -94,7 +94,7 @@ class AppPath { final directory = await profilesPath; return join( directory, - "providers", + 'providers', id, type, url.toMd5(), diff --git a/lib/common/picker.dart b/lib/common/picker.dart index fb72190..2c3d1aa 100644 --- a/lib/common/picker.dart +++ b/lib/common/picker.dart @@ -20,9 +20,9 @@ class Picker { final path = await FilePicker.platform.saveFile( fileName: fileName, initialDirectory: await appPath.downloadDirPath, - bytes: Platform.isAndroid ? bytes : null, + bytes: system.isAndroid ? bytes : null, ); - if (!Platform.isAndroid && path != null) { + if (!system.isAndroid && path != null) { final file = await File(path).create(recursive: true); await file.writeAsBytes(bytes); } diff --git a/lib/common/preferences.dart b/lib/common/preferences.dart index 8cc63ce..dd40bde 100644 --- a/lib/common/preferences.dart +++ b/lib/common/preferences.dart @@ -49,12 +49,12 @@ class Preferences { false; } - clearClashConfig() async { + Future clearClashConfig() async { final preferences = await sharedPreferencesCompleter.future; preferences?.remove(clashConfigKey); } - clearPreferences() async { + Future clearPreferences() async { final sharedPreferencesIns = await sharedPreferencesCompleter.future; sharedPreferencesIns?.clear(); } diff --git a/lib/common/print.dart b/lib/common/print.dart index 4e63a2d..2ba89f1 100644 --- a/lib/common/print.dart +++ b/lib/common/print.dart @@ -12,8 +12,8 @@ class CommonPrint { return _instance!; } - log(String? text) { - final payload = "[FlClash] $text"; + void log(String? text) { + final payload = '[APP] $text'; debugPrint(payload); if (!globalState.isInit) { return; diff --git a/lib/common/render.dart b/lib/common/render.dart index 6c9192c..cb004f7 100644 --- a/lib/common/render.dart +++ b/lib/common/render.dart @@ -16,12 +16,12 @@ class Render { return _instance!; } - active() { + void active() { resume(); pause(); } - pause() { + void pause() { throttler.call( FunctionTag.renderPause, _pause, @@ -29,7 +29,7 @@ class Render { ); } - resume() { + void resume() { throttler.cancel(FunctionTag.renderPause); _resume(); } @@ -41,7 +41,7 @@ class Render { _drawFrame = _dispatcher.onDrawFrame; _dispatcher.onBeginFrame = null; _dispatcher.onDrawFrame = null; - commonPrint.log("pause"); + commonPrint.log('pause'); } void _resume() { @@ -50,7 +50,7 @@ class Render { _dispatcher.onBeginFrame = _beginFrame; _dispatcher.onDrawFrame = _drawFrame; _dispatcher.scheduleFrame(); - commonPrint.log("resume"); + commonPrint.log('resume'); } } diff --git a/lib/common/request.dart b/lib/common/request.dart index 9585596..2fb2489 100644 --- a/lib/common/request.dart +++ b/lib/common/request.dart @@ -19,7 +19,7 @@ class Request { _dio = Dio( BaseOptions( headers: { - "User-Agent": browserUa, + 'User-Agent': browserUa, }, ), ); @@ -69,7 +69,7 @@ class Request { Future?> checkForUpdate() async { final response = await _dio.get( - "https://api.github.com/repos/$repository/releases/latest", + 'https://api.github.com/repos/$repository/releases/latest', options: Options( responseType: ResponseType.json, ), @@ -85,16 +85,22 @@ class Request { } final Map)> _ipInfoSources = { - "https://ipwho.is/": IpInfo.fromIpwhoIsJson, - "https://api.ip.sb/geoip/": IpInfo.fromIpSbJson, - "https://ipapi.co/json/": IpInfo.fromIpApiCoJson, - "https://ipinfo.io/json/": IpInfo.fromIpInfoIoJson, + 'https://ipwho.is/': IpInfo.fromIpwhoIsJson, + 'https://api.ip.sb/geoip/': IpInfo.fromIpSbJson, + 'https://ipapi.co/json/': IpInfo.fromIpApiCoJson, + 'https://ipinfo.io/json/': IpInfo.fromIpInfoIoJson, }; Future> checkIp({CancelToken? cancelToken}) async { var failureCount = 0; final futures = _ipInfoSources.entries.map((source) async { final Completer> completer = Completer(); + handleFailRes() { + if (!completer.isCompleted && failureCount == _ipInfoSources.length) { + completer.complete(Result.success(null)); + } + } + final future = Dio().get>( source.key, cancelToken: cancelToken, @@ -107,15 +113,14 @@ class Request { completer.complete(Result.success(source.value(res.data!))); } else { failureCount++; - if (failureCount == _ipInfoSources.length) { - completer.complete(Result.success(null)); - } + handleFailRes(); } }).catchError((e) { failureCount++; - if (e == DioExceptionType.cancel) { - completer.complete(Result.error("cancelled")); + if (e is DioException && e.type == DioExceptionType.cancel) { + completer.complete(Result.error('cancelled')); } + handleFailRes(); }); return completer.future; }); @@ -128,7 +133,7 @@ class Request { try { final response = await _dio .get( - "http://$localhost:$helperPort/ping", + 'http://$localhost:$helperPort/ping', options: Options( responseType: ResponseType.plain, ), @@ -151,10 +156,10 @@ class Request { try { final response = await _dio .post( - "http://$localhost:$helperPort/start", + 'http://$localhost:$helperPort/start', data: json.encode({ - "path": appPath.corePath, - "arg": arg, + 'path': appPath.corePath, + 'arg': arg, }), options: Options( responseType: ResponseType.plain, @@ -179,7 +184,7 @@ class Request { try { final response = await _dio .post( - "http://$localhost:$helperPort/stop", + 'http://$localhost:$helperPort/stop', options: Options( responseType: ResponseType.plain, ), diff --git a/lib/common/scroll.dart b/lib/common/scroll.dart index 828bdcc..0996326 100644 --- a/lib/common/scroll.dart +++ b/lib/common/scroll.dart @@ -35,7 +35,7 @@ class ShowBarScrollBehavior extends BaseScrollBehavior { Widget child, ScrollableDetails details, ) { - return CommonAutoHiddenScrollBar( + return CommonScrollBar( controller: details.controller, child: child, ); @@ -88,6 +88,54 @@ class NextClampingScrollPhysics extends ClampingScrollPhysics { } } +// class CacheScrollPositionController extends ScrollController { +// final String key; +// +// CacheScrollPositionController({ +// required this.key, +// double initialScrollOffset = 0.0, +// super.keepScrollOffset = true, +// super.debugLabel, +// super.onAttach, +// super.onDetach, +// }); +// +// @override +// ScrollPosition createScrollPosition( +// ScrollPhysics physics, +// ScrollContext context, +// ScrollPosition? oldPosition, +// ) { +// return ScrollPositionWithSingleContext( +// physics: physics, +// context: context, +// initialPixels: +// globalState.scrollPositionCache[key] ?? initialScrollOffset, +// keepScrollOffset: keepScrollOffset, +// oldPosition: oldPosition, +// debugLabel: debugLabel, +// ); +// } +// +// double? get cacheOffset => globalState.scrollPositionCache[key]; +// +// _handleScroll() { +// globalState.scrollPositionCache[key] = position.pixels; +// } +// +// @override +// void attach(ScrollPosition position) { +// super.attach(position); +// addListener(_handleScroll); +// } +// +// @override +// void detach(ScrollPosition position) { +// removeListener(_handleScroll); +// super.detach(position); +// } +// } + class ReverseScrollController extends ScrollController { ReverseScrollController({ super.initialScrollOffset, diff --git a/lib/common/string.dart b/lib/common/string.dart index 4c30097..7b4a093 100644 --- a/lib/common/string.dart +++ b/lib/common/string.dart @@ -48,7 +48,7 @@ extension StringExtension on String { } bool get isSvg { - return endsWith(".svg"); + return endsWith('.svg'); } bool get isRegex { diff --git a/lib/common/system.dart b/lib/common/system.dart index 5dbfc49..aa9390f 100644 --- a/lib/common/system.dart +++ b/lib/common/system.dart @@ -1,16 +1,18 @@ +import 'dart:ffi'; import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; +import 'package:ffi/ffi.dart'; import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/enum/enum.dart'; import 'package:fl_clash/plugins/app.dart'; import 'package:fl_clash/state.dart'; import 'package:fl_clash/widgets/input.dart'; import 'package:flutter/services.dart'; +import 'package:path/path.dart'; class System { static System? _instance; - List? originDns; System._internal(); @@ -19,25 +21,32 @@ class System { return _instance!; } - bool get isDesktop => - Platform.isWindows || Platform.isMacOS || Platform.isLinux; + bool get isDesktop => isWindows || isMacOS || isLinux; + + bool get isWindows => Platform.isWindows; + + bool get isMacOS => Platform.isMacOS; + + bool get isAndroid => Platform.isAndroid; + + bool get isLinux => Platform.isLinux; Future get version async { final deviceInfo = await DeviceInfoPlugin().deviceInfo; return switch (Platform.operatingSystem) { - "macos" => (deviceInfo as MacOsDeviceInfo).majorVersion, - "android" => (deviceInfo as AndroidDeviceInfo).version.sdkInt, - "windows" => (deviceInfo as WindowsDeviceInfo).majorVersion, + 'macos' => (deviceInfo as MacOsDeviceInfo).majorVersion, + 'android' => (deviceInfo as AndroidDeviceInfo).version.sdkInt, + 'windows' => (deviceInfo as WindowsDeviceInfo).majorVersion, String() => 0 }; } Future checkIsAdmin() async { final corePath = appPath.corePath.replaceAll(' ', '\\\\ '); - if (Platform.isWindows) { + if (system.isWindows) { final result = await windows?.checkService(); return result == WindowsHelperServiceStatus.running; - } else if (Platform.isMacOS) { + } else if (system.isMacOS) { final result = await Process.run('stat', ['-f', '%Su:%Sg %Sp', corePath]); final output = result.stdout.trim(); if (output.startsWith('root:admin') && output.contains('rws')) { @@ -56,7 +65,7 @@ class System { } Future authorizeCore() async { - if (Platform.isAndroid) { + if (system.isAndroid) { return AuthorizeCode.error; } final corePath = appPath.corePath.replaceAll(' ', '\\\\ '); @@ -65,7 +74,7 @@ class System { return AuthorizeCode.none; } - if (Platform.isWindows) { + if (system.isWindows) { final result = await windows?.registerService(); if (result == true) { return AuthorizeCode.success; @@ -73,13 +82,13 @@ class System { return AuthorizeCode.error; } - if (Platform.isMacOS) { + if (system.isMacOS) { final shell = 'chown root:admin $corePath; chmod +sx $corePath'; final arguments = [ - "-e", + '-e', 'do shell script "$shell" with administrator privileges', ]; - final result = await Process.run("osascript", arguments); + final result = await Process.run('osascript', arguments); if (result.exitCode != 0) { return AuthorizeCode.error; } @@ -88,12 +97,13 @@ class System { final shell = Platform.environment['SHELL'] ?? 'bash'; final password = await globalState.showCommonDialog( child: InputDialog( + obscureText: true, title: appLocalizations.pleaseInputAdminPassword, value: '', ), ); final arguments = [ - "-c", + '-c', 'echo "$password" | sudo -S chown root:root "$corePath" && echo "$password" | sudo -S chmod +sx "$corePath"' ]; final result = await Process.run(shell, arguments); @@ -105,15 +115,223 @@ class System { return AuthorizeCode.error; } - Future getMacOSDefaultServiceName() async { - if (!Platform.isMacOS) { - return null; + Future back() async { + await app?.moveTaskToBack(); + await window?.hide(); + } + + Future exit() async { + if (system.isAndroid) { + await SystemNavigator.pop(); } + await window?.close(); + } +} + +final system = System(); + +class Windows { + static Windows? _instance; + late DynamicLibrary _shell32; + + Windows._internal() { + _shell32 = DynamicLibrary.open('shell32.dll'); + } + + factory Windows() { + _instance ??= Windows._internal(); + return _instance!; + } + + bool runas(String command, String arguments) { + final commandPtr = command.toNativeUtf16(); + final argumentsPtr = arguments.toNativeUtf16(); + final operationPtr = 'runas'.toNativeUtf16(); + + final shellExecute = _shell32.lookupFunction< + Int32 Function( + Pointer hwnd, + Pointer lpOperation, + Pointer lpFile, + Pointer lpParameters, + Pointer lpDirectory, + Int32 nShowCmd), + int Function( + Pointer hwnd, + Pointer lpOperation, + Pointer lpFile, + Pointer lpParameters, + Pointer lpDirectory, + int nShowCmd)>('ShellExecuteW'); + + final result = shellExecute( + nullptr, + operationPtr, + commandPtr, + argumentsPtr, + nullptr, + 1, + ); + + calloc.free(commandPtr); + calloc.free(argumentsPtr); + calloc.free(operationPtr); + + commonPrint.log('windows runas: $command $arguments resultCode:$result'); + + if (result < 42) { + return false; + } + return true; + } + + Future _killProcess(int port) async { + final result = await Process.run('netstat', ['-ano']); + final lines = result.stdout.toString().trim().split('\n'); + for (final line in lines) { + if (!line.contains(':$port') || !line.contains('LISTENING')) { + continue; + } + final parts = line.trim().split(RegExp(r'\s+')); + final pid = int.tryParse(parts.last); + if (pid != null) { + await Process.run('taskkill', ['/PID', pid.toString(), '/F']); + } + } + } + + Future checkService() async { + // final qcResult = await Process.run('sc', ['qc', appHelperService]); + // final qcOutput = qcResult.stdout.toString(); + // if (qcResult.exitCode != 0 || !qcOutput.contains(appPath.helperPath)) { + // return WindowsHelperServiceStatus.none; + // } + final result = await Process.run('sc', ['query', appHelperService]); + if (result.exitCode != 0) { + return WindowsHelperServiceStatus.none; + } + final output = result.stdout.toString(); + if (output.contains('RUNNING') && await request.pingHelper()) { + return WindowsHelperServiceStatus.running; + } + return WindowsHelperServiceStatus.presence; + } + + Future registerService() async { + final status = await checkService(); + + if (status == WindowsHelperServiceStatus.running) { + return true; + } + + await _killProcess(helperPort); + + final command = [ + '/c', + if (status == WindowsHelperServiceStatus.presence) ...[ + 'sc', + 'delete', + appHelperService, + '/force', + '&&', + ], + 'sc', + 'create', + appHelperService, + 'binPath= "${appPath.helperPath}"', + 'start= auto', + '&&', + 'sc', + 'start', + appHelperService, + ].join(' '); + + final res = runas('cmd.exe', command); + + await Future.delayed( + Duration(milliseconds: 300), + ); + + return res; + } + + Future registerTask(String appName) async { + final taskXml = ''' + + + + + InteractiveToken + HighestAvailable + + + + + + + Parallel + false + false + false + false + false + + false + false + + true + true + false + false + false + PT72H + 7 + + + + "${Platform.resolvedExecutable}" + + +'''; + final taskPath = join(await appPath.tempPath, 'task.xml'); + await File(taskPath).create(recursive: true); + await File(taskPath) + .writeAsBytes(taskXml.encodeUtf16LeWithBom, flush: true); + final commandLine = [ + '/Create', + '/TN', + appName, + '/XML', + '%s', + '/F', + ].join(' '); + return runas( + 'schtasks', + commandLine.replaceFirst('%s', taskPath), + ); + } +} + +final windows = system.isWindows ? Windows() : null; + +class MacOS { + static MacOS? _instance; + + List? originDns; + + MacOS._internal(); + + factory MacOS() { + _instance ??= MacOS._internal(); + return _instance!; + } + + Future get defaultServiceName async { final result = await Process.run('route', ['-n', 'get', 'default']); final output = result.stdout.toString(); final deviceLine = output .split('\n') - .firstWhere((s) => s.contains('interface:'), orElse: () => ""); + .firstWhere((s) => s.contains('interface:'), orElse: () => ''); final lineSplits = deviceLine.trim().split(' '); if (lineSplits.length != 2) { return null; @@ -125,15 +343,15 @@ class System { ); final serviceResultOutput = serviceResult.stdout.toString(); final currentService = serviceResultOutput.split('\n\n').firstWhere( - (s) => s.contains("Device: $device"), - orElse: () => "", + (s) => s.contains('Device: $device'), + orElse: () => '', ); if (currentService.isEmpty) { return null; } - final currentServiceNameLine = currentService.split("\n").firstWhere( + final currentServiceNameLine = currentService.split('\n').firstWhere( (line) => RegExp(r'^\(\d+\).*').hasMatch(line), - orElse: () => ""); + orElse: () => ''); final currentServiceNameLineSplits = currentServiceNameLine.trim().split(' '); if (currentServiceNameLineSplits.length < 2) { @@ -142,11 +360,8 @@ class System { return currentServiceNameLineSplits[1]; } - Future?> getMacOSOriginDns() async { - if (!Platform.isMacOS) { - return null; - } - final deviceServiceName = await getMacOSDefaultServiceName(); + Future?> get systemDns async { + final deviceServiceName = await defaultServiceName; if (deviceServiceName == null) { return null; } @@ -158,16 +373,13 @@ class System { if (output.startsWith("There aren't any DNS Servers set on")) { originDns = []; } else { - originDns = output.split("\n"); + originDns = output.split('\n'); } return originDns; } - setMacOSDns(bool restore) async { - if (!Platform.isMacOS) { - return; - } - final serviceName = await getMacOSDefaultServiceName(); + Future updateDns(bool restore) async { + final serviceName = await defaultServiceName; if (serviceName == null) { return; } @@ -175,11 +387,11 @@ class System { if (restore) { nextDns = originDns; } else { - final originDns = await system.getMacOSOriginDns(); + final originDns = await systemDns; if (originDns == null) { return; } - final needAddDns = "223.5.5.5"; + final needAddDns = '223.5.5.5'; if (originDns.contains(needAddDns)) { return; } @@ -194,22 +406,10 @@ class System { '-setdnsservers', serviceName, if (nextDns.isNotEmpty) ...nextDns, - if (nextDns.isEmpty) "Empty", + if (nextDns.isEmpty) 'Empty', ], ); } - - back() async { - await app?.moveTaskToBack(); - await window?.hide(); - } - - exit() async { - if (Platform.isAndroid) { - await SystemNavigator.pop(); - } - await window?.close(); - } } -final system = System(); +final macOS = system.isMacOS ? MacOS() : null; diff --git a/lib/common/theme.dart b/lib/common/theme.dart index 97e3912..2760082 100644 --- a/lib/common/theme.dart +++ b/lib/common/theme.dart @@ -13,7 +13,7 @@ class CommonTheme { Color get darkenSecondaryContainer { return _colorMap.updateCacheValue( - "darkenSecondaryContainer", + 'darkenSecondaryContainer', () => context.colorScheme.secondaryContainer .blendDarken(context, factor: 0.1), ); @@ -21,7 +21,7 @@ class CommonTheme { Color get darkenSecondaryContainerLighter { return _colorMap.updateCacheValue( - "darkenSecondaryContainerLighter", + 'darkenSecondaryContainerLighter', () => context.colorScheme.secondaryContainer .blendDarken(context, factor: 0.1) .opacity60, @@ -30,7 +30,7 @@ class CommonTheme { Color get darken2SecondaryContainer { return _colorMap.updateCacheValue( - "darken2SecondaryContainer", + 'darken2SecondaryContainer', () => context.colorScheme.secondaryContainer .blendDarken(context, factor: 0.2), ); @@ -38,7 +38,7 @@ class CommonTheme { Color get darken3PrimaryContainer { return _colorMap.updateCacheValue( - "darken3PrimaryContainer", + 'darken3PrimaryContainer', () => context.colorScheme.primaryContainer .blendDarken(context, factor: 0.3), ); diff --git a/lib/common/tray.dart b/lib/common/tray.dart index 8c80aa6..9f96216 100644 --- a/lib/common/tray.dart +++ b/lib/common/tray.dart @@ -11,6 +11,7 @@ import 'package:tray_manager/tray_manager.dart'; import 'app_localizations.dart'; import 'constant.dart'; +import 'system.dart'; import 'window.dart'; class Tray { @@ -18,7 +19,7 @@ class Tray { required Brightness? brightness, bool force = false, }) async { - if (Platform.isAndroid) { + if (system.isAndroid) { return; } if (Platform.isLinux || force) { @@ -38,11 +39,11 @@ class Tray { } } - update({ + Future update({ required TrayState trayState, bool focus = false, }) async { - if (Platform.isAndroid) { + if (system.isAndroid) { return; } if (!Platform.isLinux) { @@ -80,7 +81,7 @@ class Tray { ); } menuItems.add(MenuItem.separator()); - if (Platform.isMacOS) { + if (system.isMacOS) { for (final group in trayState.groups) { List subMenuItems = []; for (final proxy in group.all) { @@ -169,8 +170,8 @@ class Tray { } } - updateTrayTitle([Traffic? traffic]) async { - // if (!Platform.isMacOS) { + Future updateTrayTitle([Traffic? traffic]) async { + // if (!system.isMacOS) { // return; // } // if (traffic == null) { @@ -183,11 +184,10 @@ class Tray { } Future _copyEnv(int port) async { - final url = "http://127.0.0.1:$port"; + final url = 'http://127.0.0.1:$port'; - final cmdline = Platform.isWindows - ? "set \$env:all_proxy=$url" - : "export all_proxy=$url"; + final cmdline = + system.isWindows ? 'set \$env:all_proxy=$url' : 'export all_proxy=$url'; await Clipboard.setData( ClipboardData( diff --git a/lib/common/utils.dart b/lib/common/utils.dart index c26bc72..44677b0 100644 --- a/lib/common/utils.dart +++ b/lib/common/utils.dart @@ -23,11 +23,11 @@ class Utils { final random = Random(); final randomStr = String.fromCharCodes(List.generate(8, (_) => random.nextInt(26) + 97)); - return "$timestamp$randomStr"; + return '$timestamp$randomStr'; } String getDateStringLast2(int value) { - var valueRaw = "0$value"; + var valueRaw = '0$value'; return valueRaw.substring( valueRaw.length - 2, ); @@ -73,7 +73,7 @@ class Utils { var inMinutes = difference.inMinutes; var inSeconds = difference.inSeconds; - return "${getDateStringLast2(inHours)}:${getDateStringLast2(inMinutes)}:${getDateStringLast2(inSeconds)}"; + return '${getDateStringLast2(inHours)}:${getDateStringLast2(inMinutes)}:${getDateStringLast2(inSeconds)}'; } String getTimeText(int? timeStamp) { @@ -83,17 +83,17 @@ class Utils { final diff = timeStamp / 1000; final inHours = (diff / 3600).floor(); if (inHours > 99) { - return "99:59:59"; + return '99:59:59'; } final inMinutes = (diff / 60 % 60).floor(); final inSeconds = (diff % 60).floor(); - return "${getDateStringLast2(inHours)}:${getDateStringLast2(inMinutes)}:${getDateStringLast2(inSeconds)}"; + return '${getDateStringLast2(inHours)}:${getDateStringLast2(inMinutes)}:${getDateStringLast2(inSeconds)}'; } Locale? getLocaleForString(String? localString) { if (localString == null) return null; - var localSplit = localString.split("_"); + var localSplit = localString.split('_'); if (localSplit.length == 1) { return Locale(localSplit[0]); } @@ -137,18 +137,18 @@ class Utils { final number = int.parse(match[1] ?? '0') + 1; return label.replaceFirst(reg, '($number)', label.length - 3 - 1); } else { - return "$label(1)"; + return '$label(1)'; } } String getTrayIconPath({ required Brightness brightness, }) { - if (Platform.isMacOS) { - return "assets/images/icon_white.png"; + if (system.isMacOS) { + return 'assets/images/icon_white.png'; } - final suffix = Platform.isWindows ? "ico" : "png"; - return "assets/images/icon.$suffix"; + final suffix = system.isWindows ? 'ico' : 'png'; + return 'assets/images/icon.$suffix'; // return switch (brightness) { // Brightness.dark => "assets/images/icon_white.$suffix", // Brightness.light => "assets/images/icon_black.$suffix", @@ -181,7 +181,7 @@ class Utils { String getPinyin(String value) { return value.isNotEmpty ? PinyinHelper.getFirstWordPinyin(value.substring(0, 1)) - : ""; + : ''; } String? getFileNameForDisposition(String? disposition) { @@ -189,7 +189,7 @@ class Utils { final parseValue = HeaderValue.parse(disposition); final parameters = parseValue.parameters; final fileNamePointKey = parameters.keys - .firstWhere((key) => key == "filename*", orElse: () => ""); + .firstWhere((key) => key == 'filename*', orElse: () => ''); if (fileNamePointKey.isNotEmpty) { final res = parameters[fileNamePointKey]?.split("''") ?? []; if (res.length >= 2) { @@ -197,7 +197,7 @@ class Utils { } } final fileNameKey = parameters.keys - .firstWhere((key) => key == "filename", orElse: () => ""); + .firstWhere((key) => key == 'filename', orElse: () => ''); if (fileNameKey.isEmpty) return null; return parameters[fileNameKey]; } @@ -250,7 +250,7 @@ class Utils { 900, ]; - _createPrimarySwatch(Color color) { + MaterialColor _createPrimarySwatch(Color color) { final Map swatch = {}; final int a = color.alpha8bit; final int r = color.red8bit; @@ -294,11 +294,11 @@ class Utils { } String getBackupFileName() { - return "${appName}_backup_${DateTime.now().show}.zip"; + return '${appName}_backup_${DateTime.now().show}.zip'; } String get logFile { - return "${appName}_${DateTime.now().show}.log"; + return '${appName}_${DateTime.now().show}.log'; } Future getLocalIpAddress() async { @@ -324,11 +324,11 @@ class Utils { }); return addresses.first.address; } - return ""; + return ''; } SingleActivator controlSingleActivator(LogicalKeyboardKey trigger) { - final control = Platform.isMacOS ? false : true; + final control = system.isMacOS ? false : true; return SingleActivator( trigger, control: control, diff --git a/lib/common/window.dart b/lib/common/window.dart index 2fdbfa1..98e9ec6 100755 --- a/lib/common/window.dart +++ b/lib/common/window.dart @@ -3,30 +3,34 @@ import 'dart:io'; import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/state.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_acrylic/flutter_acrylic.dart' as acrylic; import 'package:screen_retriever/screen_retriever.dart'; import 'package:window_manager/window_manager.dart'; class Window { - init(int version) async { + Future init(int version) async { final props = globalState.config.windowProps; final acquire = await singleInstanceLock.acquire(); if (!acquire) { exit(0); } - if (Platform.isWindows) { - protocol.register("clash"); - protocol.register("clashmeta"); - protocol.register("flclash"); + if (system.isWindows) { + protocol.register('clash'); + protocol.register('clashmeta'); + protocol.register('flclash'); + } + if ((version > 10 && system.isMacOS)) { + await acrylic.Window.initialize(); } await windowManager.ensureInitialized(); WindowOptions windowOptions = WindowOptions( size: Size(props.width, props.height), minimumSize: const Size(380, 400), ); - if (!Platform.isMacOS || version > 10) { + if (!system.isMacOS || version > 10) { await windowManager.setTitleBarStyle(TitleBarStyle.hidden); } - if (!Platform.isMacOS) { + if (!system.isMacOS) { final left = props.left ?? 0; final top = props.top ?? 0; final right = left + props.width; @@ -62,7 +66,14 @@ class Window { }); } - show() async { + void updateMacOSBrightness(Brightness brightness) { + if (!system.isMacOS) { + return; + } + acrylic.Window.overrideMacOSBrightness(dark: brightness == Brightness.dark); + } + + Future show() async { render?.resume(); await windowManager.show(); await windowManager.focus(); @@ -71,15 +82,15 @@ class Window { Future get isVisible async { final value = await windowManager.isVisible(); - commonPrint.log("window visible check: $value"); + commonPrint.log('window visible check: $value'); return value; } - close() async { + Future close() async { exit(0); } - hide() async { + Future hide() async { render?.pause(); await windowManager.hide(); await windowManager.setSkipTaskbar(true); diff --git a/lib/common/windows.dart b/lib/common/windows.dart deleted file mode 100644 index f23de1a..0000000 --- a/lib/common/windows.dart +++ /dev/null @@ -1,191 +0,0 @@ -import 'dart:ffi'; -import 'dart:io'; - -import 'package:ffi/ffi.dart'; -import 'package:fl_clash/common/common.dart'; -import 'package:fl_clash/enum/enum.dart'; -import 'package:path/path.dart'; - -class Windows { - static Windows? _instance; - late DynamicLibrary _shell32; - - Windows._internal() { - _shell32 = DynamicLibrary.open('shell32.dll'); - } - - factory Windows() { - _instance ??= Windows._internal(); - return _instance!; - } - - bool runas(String command, String arguments) { - final commandPtr = command.toNativeUtf16(); - final argumentsPtr = arguments.toNativeUtf16(); - final operationPtr = 'runas'.toNativeUtf16(); - - final shellExecute = _shell32.lookupFunction< - Int32 Function( - Pointer hwnd, - Pointer lpOperation, - Pointer lpFile, - Pointer lpParameters, - Pointer lpDirectory, - Int32 nShowCmd), - int Function( - Pointer hwnd, - Pointer lpOperation, - Pointer lpFile, - Pointer lpParameters, - Pointer lpDirectory, - int nShowCmd)>('ShellExecuteW'); - - final result = shellExecute( - nullptr, - operationPtr, - commandPtr, - argumentsPtr, - nullptr, - 1, - ); - - calloc.free(commandPtr); - calloc.free(argumentsPtr); - calloc.free(operationPtr); - - commonPrint.log("windows runas: $command $arguments resultCode:$result"); - - if (result < 42) { - return false; - } - return true; - } - - _killProcess(int port) async { - final result = await Process.run('netstat', ['-ano']); - final lines = result.stdout.toString().trim().split('\n'); - for (final line in lines) { - if (!line.contains(":$port") || !line.contains("LISTENING")) { - continue; - } - final parts = line.trim().split(RegExp(r'\s+')); - final pid = int.tryParse(parts.last); - if (pid != null) { - await Process.run('taskkill', ['/PID', pid.toString(), '/F']); - } - } - } - - Future checkService() async { - // final qcResult = await Process.run('sc', ['qc', appHelperService]); - // final qcOutput = qcResult.stdout.toString(); - // if (qcResult.exitCode != 0 || !qcOutput.contains(appPath.helperPath)) { - // return WindowsHelperServiceStatus.none; - // } - final result = await Process.run('sc', ['query', appHelperService]); - if(result.exitCode != 0){ - return WindowsHelperServiceStatus.none; - } - final output = result.stdout.toString(); - if (output.contains("RUNNING") && await request.pingHelper()) { - return WindowsHelperServiceStatus.running; - } - return WindowsHelperServiceStatus.presence; - } - - Future registerService() async { - final status = await checkService(); - - if (status == WindowsHelperServiceStatus.running) { - return true; - } - - await _killProcess(helperPort); - - final command = [ - "/c", - if (status == WindowsHelperServiceStatus.presence) ...[ - "sc", - "delete", - appHelperService, - "/force", - "&&", - ], - "sc", - "create", - appHelperService, - 'binPath= "${appPath.helperPath}"', - 'start= auto', - "&&", - "sc", - "start", - appHelperService, - ].join(" "); - - final res = runas("cmd.exe", command); - - await Future.delayed( - Duration(milliseconds: 300), - ); - - return res; - } - - Future registerTask(String appName) async { - final taskXml = ''' - - - - - InteractiveToken - HighestAvailable - - - - - - - Parallel - false - false - false - false - false - - false - false - - true - true - false - false - false - PT72H - 7 - - - - "${Platform.resolvedExecutable}" - - -'''; - final taskPath = join(await appPath.tempPath, "task.xml"); - await File(taskPath).create(recursive: true); - await File(taskPath) - .writeAsBytes(taskXml.encodeUtf16LeWithBom, flush: true); - final commandLine = [ - '/Create', - '/TN', - appName, - '/XML', - "%s", - '/F', - ].join(" "); - return runas( - 'schtasks', - commandLine.replaceFirst("%s", taskPath), - ); - } -} - -final windows = Platform.isWindows ? Windows() : null; diff --git a/lib/controller.dart b/lib/controller.dart index c59a0aa..43efb7a 100644 --- a/lib/controller.dart +++ b/lib/controller.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'dart:isolate'; -import 'dart:typed_data'; import 'package:archive/archive.dart'; import 'package:fl_clash/clash/clash.dart'; @@ -12,7 +11,9 @@ import 'package:fl_clash/plugins/app.dart'; import 'package:fl_clash/providers/providers.dart'; import 'package:fl_clash/state.dart'; import 'package:fl_clash/widgets/dialog.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:path/path.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -29,29 +30,29 @@ class AppController { AppController(this.context, WidgetRef ref) : _ref = ref; - setupClashConfigDebounce() { + void setupClashConfigDebounce() { debouncer.call(FunctionTag.setupClashConfig, () async { await setupClashConfig(); }); } - updateClashConfigDebounce() { + Future updateClashConfigDebounce() async { debouncer.call(FunctionTag.updateClashConfig, () async { await updateClashConfig(); }); } - updateGroupsDebounce() { + void updateGroupsDebounce() { debouncer.call(FunctionTag.updateGroups, updateGroups); } - addCheckIpNumDebounce() { + void addCheckIpNumDebounce() { debouncer.call(FunctionTag.addCheckIpNum, () { _ref.read(checkIpNumProvider.notifier).add(); }); } - applyProfileDebounce({ + void applyProfileDebounce({ bool silence = false, }) { debouncer.call(FunctionTag.applyProfile, (silence) { @@ -59,11 +60,11 @@ class AppController { }, args: [silence]); } - savePreferencesDebounce() { + void savePreferencesDebounce() { debouncer.call(FunctionTag.savePreferences, savePreferences); } - changeProxyDebounce(String groupName, String proxyName) { + void changeProxyDebounce(String groupName, String proxyName) { debouncer.call(FunctionTag.changeProxy, (String groupName, String proxyName) async { await changeProxy( @@ -74,8 +75,8 @@ class AppController { }, args: [groupName, proxyName]); } - restartCore() async { - commonPrint.log("restart core"); + Future restartCore() async { + commonPrint.log('restart core'); await clashService?.reStart(); await _initCore(); if (_ref.read(runTimeProvider.notifier).isStart) { @@ -83,7 +84,7 @@ class AppController { } } - updateStatus(bool isStart) async { + Future updateStatus(bool isStart) async { if (isStart) { await globalState.handleStart([ updateRunTime, @@ -102,7 +103,7 @@ class AppController { applyProfileDebounce(); } else { await globalState.handleStop(); - await clashCore.resetTraffic(); + clashCore.resetTraffic(); _ref.read(trafficsProvider.notifier).clear(); _ref.read(totalTrafficProvider.notifier).value = Traffic(); _ref.read(runTimeProvider.notifier).value = null; @@ -110,7 +111,7 @@ class AppController { } } - updateRunTime() { + void updateRunTime() { final startTime = globalState.startTime; if (startTime != null) { final startTimeStamp = startTime.millisecondsSinceEpoch; @@ -121,20 +122,20 @@ class AppController { } } - updateTraffic() async { + Future updateTraffic() async { final traffic = await clashCore.getTraffic(); _ref.read(trafficsProvider.notifier).addTraffic(traffic); _ref.read(totalTrafficProvider.notifier).value = await clashCore.getTotalTraffic(); } - addProfile(Profile profile) async { + Future addProfile(Profile profile) async { _ref.read(profilesProvider.notifier).setProfile(profile); if (_ref.read(currentProfileIdProvider) != null) return; _ref.read(currentProfileIdProvider.notifier).value = profile.id; } - deleteProfile(String id) async { + Future deleteProfile(String id) async { _ref.read(profilesProvider.notifier).deleteProfileById(id); clearEffect(id); if (globalState.config.currentProfileId == id) { @@ -150,12 +151,12 @@ class AppController { } } - updateProviders() async { + Future updateProviders() async { _ref.read(providersProvider.notifier).value = await clashCore.getExternalProviders(); } - updateLocalIp() async { + Future updateLocalIp() async { _ref.read(localIpProvider.notifier).value = null; await Future.delayed(commonDuration); _ref.read(localIpProvider.notifier).value = await utils.getLocalIpAddress(); @@ -171,26 +172,26 @@ class AppController { } } - setProfile(Profile profile) { + void setProfile(Profile profile) { _ref.read(profilesProvider.notifier).setProfile(profile); } - setProfileAndAutoApply(Profile profile) { + void setProfileAndAutoApply(Profile profile) { _ref.read(profilesProvider.notifier).setProfile(profile); if (profile.id == _ref.read(currentProfileIdProvider)) { applyProfileDebounce(silence: true); } } - setProfiles(List profiles) { + void setProfiles(List profiles) { _ref.read(profilesProvider.notifier).value = profiles; } - addLog(Log log) { + void addLog(Log log) { _ref.read(logsProvider).add(log); } - updateOrAddHotKeyAction(HotKeyAction hotKeyAction) { + void updateOrAddHotKeyAction(HotKeyAction hotKeyAction) { final hotKeyActions = _ref.read(hotKeyActionsProvider); final index = hotKeyActions.indexWhere((item) => item.action == hotKeyAction.action); @@ -219,26 +220,26 @@ class AppController { return _ref.read(getProxiesColumnsProvider); } - addSortNum() { + dynamic addSortNum() { return _ref.read(sortNumProvider.notifier).add(); } - getCurrentGroupName() { + String? getCurrentGroupName() { final currentGroupName = _ref.read(currentProfileProvider.select( (state) => state?.currentGroupName, )); return currentGroupName; } - ProxyCardState getProxyCardState(proxyName) { + ProxyCardState getProxyCardState(String proxyName) { return _ref.read(getProxyCardStateProvider(proxyName)); } - getSelectedProxyName(groupName) { + String? getSelectedProxyName(String groupName) { return _ref.read(getSelectedProxyNameProvider(groupName)); } - updateCurrentGroupName(String groupName) { + void updateCurrentGroupName(String groupName) { final profile = _ref.read(currentProfileProvider); if (profile == null || profile.currentGroupName == groupName) { return; @@ -249,11 +250,12 @@ class AppController { } Future updateClashConfig() async { - final commonScaffoldState = globalState.homeScaffoldKey.currentState; - if (commonScaffoldState?.mounted != true) return; - await commonScaffoldState?.loadingRun(() async { - await _updateClashConfig(); - }); + await safeRun( + () async { + await _updateClashConfig(); + }, + needLoading: true, + ); } Future _updateClashConfig() async { @@ -272,13 +274,16 @@ class AppController { } Future> _requestAdmin(bool enableTun) async { + if(system.isWindows && kDebugMode){ + return Result.success(false); + } final realTunEnable = _ref.read(realTunEnableProvider); if (enableTun != realTunEnable && realTunEnable == false) { final code = await system.authorizeCore(); switch (code) { case AuthorizeCode.success: await restartCore(); - return Result.error(""); + return Result.error(''); case AuthorizeCode.none: break; case AuthorizeCode.error: @@ -291,14 +296,15 @@ class AppController { } Future setupClashConfig() async { - final commonScaffoldState = globalState.homeScaffoldKey.currentState; - if (commonScaffoldState?.mounted != true) return; - await commonScaffoldState?.loadingRun(() async { - await _setupClashConfig(); - }); + await safeRun( + () async { + await _setupClashConfig(); + }, + needLoading: true, + ); } - _setupClashConfig() async { + Future _setupClashConfig() async { await _ref.read(currentProfileProvider)?.checkAndUpdate(); final patchConfig = _ref.read(patchClashConfigProvider); final res = await _requestAdmin(patchConfig.tun.enable); @@ -332,29 +338,32 @@ class AppController { if (silence) { await _applyProfile(); } else { - final commonScaffoldState = globalState.homeScaffoldKey.currentState; - if (commonScaffoldState?.mounted != true) return; - await commonScaffoldState?.loadingRun(() async { - await _applyProfile(); - }); + await safeRun( + () async { + await _applyProfile(); + }, + needLoading: true, + ); } addCheckIpNumDebounce(); } - handleChangeProfile() { + void handleChangeProfile() { _ref.read(delayDataSourceProvider.notifier).value = {}; applyProfile(); _ref.read(logsProvider.notifier).value = FixedList(500); _ref.read(requestsProvider.notifier).value = FixedList(500); - globalState.cacheHeightMap = {}; - globalState.cacheScrollPosition = {}; + globalState.computeHeightMapCache = {}; } - updateBrightness(Brightness brightness) { - _ref.read(appBrightnessProvider.notifier).value = brightness; + void updateBrightness() { + WidgetsBinding.instance.addPostFrameCallback((_) { + _ref.read(systemBrightnessProvider.notifier).value = + WidgetsBinding.instance.platformDispatcher.platformBrightness; + }); } - autoUpdateProfiles() async { + Future autoUpdateProfiles() async { for (final profile in _ref.read(profilesProvider)) { if (!profile.autoUpdate) continue; final isNotNeedUpdate = profile.lastUpdateDate @@ -386,7 +395,7 @@ class AppController { } } - updateProfiles() async { + Future updateProfiles() async { for (final profile in _ref.read(profilesProvider)) { if (profile.type == ProfileType.file) { continue; @@ -395,12 +404,12 @@ class AppController { } } - savePreferences() async { - commonPrint.log("save preferences"); + Future savePreferences() async { + commonPrint.log('save preferences'); await preferences.saveConfig(globalState.config); } - changeProxy({ + Future changeProxy({ required String groupName, required String proxyName, }) async { @@ -416,13 +425,13 @@ class AppController { addCheckIpNumDebounce(); } - handleBackOrExit() async { + Future handleBackOrExit() async { if (_ref.read(backBlockProvider)) { return; } if (_ref.read(appSettingProvider).minimizeOnExit) { if (system.isDesktop) { - await savePreferencesDebounce(); + await savePreferences(); } await system.back(); } else { @@ -430,21 +439,21 @@ class AppController { } } - backBlock() { + void backBlock() { _ref.read(backBlockProvider.notifier).value = true; } - unBackBlock() { + void unBackBlock() { _ref.read(backBlockProvider.notifier).value = false; } - handleExit() async { + Future handleExit() async { Future.delayed(commonDuration, () { system.exit(); }); try { await savePreferences(); - await system.setMacOSDns(true); + await macOS?.updateDns(true); await proxy?.stopProxy(); await clashCore.shutdown(); await clashService?.destroy(); @@ -455,19 +464,19 @@ class AppController { Future handleClear() async { await preferences.clearPreferences(); - commonPrint.log("clear preferences"); + commonPrint.log('clear preferences'); globalState.config = Config( themeProps: defaultThemeProps, ); } - autoCheckUpdate() async { + Future autoCheckUpdate() async { if (!_ref.read(appSettingProvider).autoCheckUpdate) return; final res = await request.checkForUpdate(); checkUpdateResultHandle(data: res); } - checkUpdateResultHandle({ + Future checkUpdateResultHandle({ Map? data, bool handleError = false, }) async { @@ -482,16 +491,16 @@ class AppController { final res = await globalState.showMessage( title: appLocalizations.discoverNewVersion, message: TextSpan( - text: "$tagName \n", + text: '$tagName \n', style: textTheme.headlineSmall, children: [ TextSpan( - text: "\n", + text: '\n', style: textTheme.bodyMedium, ), for (final submit in submits) TextSpan( - text: "- $submit \n", + text: '- $submit \n', style: textTheme.bodyMedium, ), ], @@ -502,7 +511,7 @@ class AppController { return; } launchUrl( - Uri.parse("https://github.com/$repository/releases/latest"), + Uri.parse('https://github.com/$repository/releases/latest'), ); } else if (handleError) { globalState.showMessage( @@ -514,7 +523,7 @@ class AppController { } } - _handlePreference() async { + Future _handlePreference() async { if (await preferences.isInit) { return; } @@ -543,9 +552,11 @@ class AppController { await applyProfile(); } - init() async { + Future init() async { FlutterError.onError = (details) { - commonPrint.log(details.stack.toString()); + if (kDebugMode) { + commonPrint.log(details.stack.toString()); + } }; updateTray(true); await _initCore(); @@ -565,8 +576,8 @@ class AppController { _ref.read(initProvider.notifier).value = true; } - _initStatus() async { - if (Platform.isAndroid) { + Future _initStatus() async { + if (system.isAndroid) { await globalState.updateStartTime(); } final status = globalState.isStart == true @@ -579,28 +590,28 @@ class AppController { } } - setDelay(Delay delay) { + void setDelay(Delay delay) { _ref.read(delayDataSourceProvider.notifier).setDelay(delay); } - toPage(PageLabel pageLabel) { + void toPage(PageLabel pageLabel) { _ref.read(currentPageLabelProvider.notifier).value = pageLabel; } - toProfiles() { + void toProfiles() { toPage(PageLabel.profiles); } - initLink() { + void initLink() { linkManager.initAppLinksListen( (url) async { final res = await globalState.showMessage( - title: "${appLocalizations.add}${appLocalizations.profile}", + title: '${appLocalizations.add}${appLocalizations.profile}', message: TextSpan( children: [ TextSpan(text: appLocalizations.doYouWantToPass), TextSpan( - text: " $url ", + text: ' $url ', style: TextStyle( color: Theme.of(context).colorScheme.primary, decoration: TextDecoration.underline, @@ -609,7 +620,7 @@ class AppController { ), TextSpan( text: - "${appLocalizations.create}${appLocalizations.profile}"), + '${appLocalizations.create}${appLocalizations.profile}'), ], ), ); @@ -652,7 +663,7 @@ class AppController { false; } - _handlerDisclaimer() async { + Future _handlerDisclaimer() async { if (_ref.read(appSettingProvider).disclaimerAccepted) { return; } @@ -663,62 +674,64 @@ class AppController { return; } - addProfileFormURL(String url) async { + Future addProfileFormURL(String url) async { if (globalState.navigatorKey.currentState?.canPop() ?? false) { globalState.navigatorKey.currentState?.popUntil((route) => route.isFirst); } toProfiles(); - final commonScaffoldState = globalState.homeScaffoldKey.currentState; - if (commonScaffoldState?.mounted != true) return; - final profile = await commonScaffoldState?.loadingRun( + + final profile = await safeRun( () async { return await Profile.normal( url: url, ).update(); }, - title: "${appLocalizations.add}${appLocalizations.profile}", + needLoading: true, + title: '${appLocalizations.add}${appLocalizations.profile}', ); if (profile != null) { await addProfile(profile); } } - addProfileFormFile() async { - final platformFile = await globalState.safeRun(picker.pickerFile); + Future addProfileFormFile() async { + final platformFile = await safeRun(picker.pickerFile); final bytes = platformFile?.bytes; if (bytes == null) { - return null; + return; } if (!context.mounted) return; globalState.navigatorKey.currentState?.popUntil((route) => route.isFirst); toProfiles(); - final commonScaffoldState = globalState.homeScaffoldKey.currentState; - if (commonScaffoldState?.mounted != true) return; - final profile = await commonScaffoldState?.loadingRun( + + final profile = await safeRun( () async { await Future.delayed(const Duration(milliseconds: 300)); return await Profile.normal(label: platformFile?.name).saveFile(bytes); }, - title: "${appLocalizations.add}${appLocalizations.profile}", + needLoading: true, + title: '${appLocalizations.add}${appLocalizations.profile}', ); if (profile != null) { await addProfile(profile); } } - addProfileFormQrCode() async { - final url = await globalState.safeRun(picker.pickerConfigQRCode); + Future addProfileFormQrCode() async { + final url = await safeRun( + picker.pickerConfigQRCode, + ); if (url == null) return; addProfileFormURL(url); } - updateViewSize(Size size) { + void updateViewSize(Size size) { WidgetsBinding.instance.addPostFrameCallback((_) { _ref.read(viewSizeProvider.notifier).value = size; }); } - setProvider(ExternalProvider? provider) { + void setProvider(ExternalProvider? provider) { _ref.read(providersProvider.notifier).setProvider(provider); } @@ -763,18 +776,22 @@ class AppController { ); } - List getSortProxies(List proxies, [String? url]) { - return switch (_ref.read(proxiesStyleSettingProvider).sortType) { + List getSortProxies({ + required List proxies, + required ProxiesSortType sortType, + String? testUrl, + }) { + return switch (sortType) { ProxiesSortType.none => proxies, ProxiesSortType.delay => _sortOfDelay( proxies: proxies, - testUrl: url, + testUrl: testUrl, ), ProxiesSortType.name => _sortOfName(proxies), }; } - clearEffect(String profileId) async { + Future clearEffect(String profileId) async { final profilePath = await appPath.getProfilePath(profileId); final providersDirPath = await appPath.getProvidersDirPath(profileId); return await Isolate.run(() async { @@ -791,13 +808,13 @@ class AppController { }); } - updateTun() { + void updateTun() { _ref.read(patchClashConfigProvider.notifier).updateState( (state) => state.copyWith.tun(enable: !state.tun.enable), ); } - updateSystemProxy() { + void updateSystemProxy() { _ref.read(networkSettingProvider.notifier).updateState( (state) => state.copyWith( systemProxy: !state.systemProxy, @@ -816,11 +833,11 @@ class AppController { return _ref.read(packagesProvider); } - updateStart() { + void updateStart() { updateStatus(!_ref.read(runTimeProvider.notifier).isStart); } - updateCurrentSelectedMap(String groupName, String proxyName) { + void updateCurrentSelectedMap(String groupName, String proxyName) { final currentProfile = _ref.read(currentProfileProvider); if (currentProfile != null && currentProfile.selectedMap[groupName] != proxyName) { @@ -835,7 +852,7 @@ class AppController { } } - updateCurrentUnfoldSet(Set value) { + void updateCurrentUnfoldSet(Set value) { final currentProfile = _ref.read(currentProfileProvider); if (currentProfile == null) { return; @@ -847,7 +864,7 @@ class AppController { ); } - changeMode(Mode mode) { + void changeMode(Mode mode) { _ref.read(patchClashConfigProvider.notifier).updateState( (state) => state.copyWith(mode: mode), ); @@ -857,7 +874,7 @@ class AppController { addCheckIpNumDebounce(); } - updateAutoLaunch() { + void updateAutoLaunch() { _ref.read(appSettingProvider.notifier).updateState( (state) => state.copyWith( autoLaunch: !state.autoLaunch, @@ -865,7 +882,7 @@ class AppController { ); } - updateVisible() async { + Future updateVisible() async { final visible = await window?.isVisible; if (visible != null && !visible) { window?.show(); @@ -874,7 +891,7 @@ class AppController { } } - updateMode() { + void updateMode() { _ref.read(patchClashConfigProvider.notifier).updateState( (state) { final index = Mode.values.indexWhere((item) => item == state.mode); @@ -889,7 +906,7 @@ class AppController { ); } - handleAddOrUpdate(WidgetRef ref, [Rule? rule]) async { + Future handleAddOrUpdate(WidgetRef ref, [Rule? rule]) async { final res = await globalState.showCommonDialog( child: AddRuleDialog( rule: rule, @@ -926,7 +943,7 @@ class AppController { (item) => item.toString(), ); final data = await Isolate.run>(() async { - final logsRawString = logsRaw.join("\n"); + final logsRawString = logsRaw.join('\n'); return utf8.encode(logsRawString); }); return await picker.saveFile( @@ -942,20 +959,20 @@ class AppController { final configJson = globalState.config.toJson(); return Isolate.run>(() async { final archive = Archive(); - archive.add("config.json", configJson); - await archive.addDirectoryToArchive(profilesPath, homeDirPath); + archive.add('config.json', configJson); + archive.addDirectoryToArchive(profilesPath, homeDirPath); final zipEncoder = ZipEncoder(); return zipEncoder.encode(archive) ?? []; }); } - updateTray([bool focus = false]) async { + Future updateTray([bool focus = false]) async { tray.update( trayState: _ref.read(trayStateProvider), ); } - recoveryData( + Future recoveryData( List data, RecoveryOption recoveryOption, ) async { @@ -965,12 +982,12 @@ class AppController { }); final homeDirPath = await appPath.homeDirPath; final configs = - archive.files.where((item) => item.name.endsWith(".json")).toList(); + archive.files.where((item) => item.name.endsWith('.json')).toList(); final profiles = - archive.files.where((item) => !item.name.endsWith(".json")); + archive.files.where((item) => !item.name.endsWith('.json')); final configIndex = - configs.indexWhere((config) => config.name == "config.json"); - if (configIndex == -1) throw "invalid backup file"; + configs.indexWhere((config) => config.name == 'config.json'); + if (configIndex == -1) throw 'invalid backup file'; final configFile = configs[configIndex]; var tempConfig = Config.compatibleFromJson( json.decode( @@ -984,7 +1001,7 @@ class AppController { await file.writeAsBytes(profile.content); } final clashConfigIndex = - configs.indexWhere((config) => config.name == "clashConfig.json"); + configs.indexWhere((config) => config.name == 'clashConfig.json'); if (clashConfigIndex != -1) { final clashConfigFile = configs[clashConfigIndex]; tempConfig = tempConfig.copyWith( @@ -1003,7 +1020,7 @@ class AppController { ); } - _recovery(Config config, RecoveryOption recoveryOption) { + void _recovery(Config config, RecoveryOption recoveryOption) { final recoveryStrategy = _ref.read(appSettingProvider.select( (state) => state.recoveryStrategy, )); @@ -1040,4 +1057,35 @@ class AppController { _ref.read(currentProfileIdProvider.notifier).value = profiles.first.id; } } + + Future safeRun( + FutureOr Function() futureFunction, { + String? title, + bool needLoading = false, + bool silence = true, + }) async { + final realSilence = needLoading == true ? true : silence; + try { + if (needLoading) { + _ref.read(loadingProvider.notifier).value = true; + } + final res = await futureFunction(); + return res; + } catch (e) { + commonPrint.log('$e'); + if (realSilence) { + globalState.showNotifier(e.toString()); + } else { + globalState.showMessage( + title: title ?? appLocalizations.tip, + message: TextSpan( + text: e.toString(), + ), + ); + } + return null; + } finally { + _ref.read(loadingProvider.notifier).value = false; + } + } } diff --git a/lib/enum/enum.dart b/lib/enum/enum.dart index f2751f0..9168260 100644 --- a/lib/enum/enum.dart +++ b/lib/enum/enum.dart @@ -2,8 +2,10 @@ import 'dart:io'; +import 'package:fl_clash/common/system.dart'; import 'package:fl_clash/views/dashboard/widgets/widgets.dart'; import 'package:fl_clash/widgets/widgets.dart'; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:hotkey_manager/hotkey_manager.dart'; @@ -15,16 +17,16 @@ enum SupportPlatform { Android; static SupportPlatform get currentPlatform { - if (Platform.isWindows) { + if (system.isWindows) { return SupportPlatform.Windows; - } else if (Platform.isMacOS) { + } else if (system.isMacOS) { return SupportPlatform.MacOS; } else if (Platform.isLinux) { return SupportPlatform.Linux; - } else if (Platform.isAndroid) { + } else if (system.isAndroid) { return SupportPlatform.Android; } - throw "invalid platform"; + throw 'invalid platform'; } } @@ -43,11 +45,11 @@ enum GroupType { static GroupType parseProfileType(String type) { return switch (type) { - "url-test" => URLTest, - "select" => Selector, - "fallback" => Fallback, - "load-balance" => LoadBalance, - "relay" => Relay, + 'url-test' => URLTest, + 'select' => Selector, + 'fallback' => Fallback, + 'load-balance' => LoadBalance, + 'relay' => Relay, String() => throw UnimplementedError(), }; } @@ -58,7 +60,7 @@ enum GroupName { GLOBAL, Proxy, Auto, Fallback } extension GroupTypeExtension on GroupType { static List get valueList => GroupType.values .map( - (e) => e.toString().split(".").last, + (e) => e.toString().split('.').last, ) .toList(); @@ -80,7 +82,7 @@ enum UsedProxy { GLOBAL, DIRECT, REJECT } extension UsedProxyExtension on UsedProxy { static List get valueList => UsedProxy.values .map( - (e) => e.toString().split(".").last, + (e) => e.toString().split('.').last, ) .toList(); @@ -97,7 +99,18 @@ enum LogLevel { warning, error, silent, - app, +} + +extension LogLevelExt on LogLevel { + Color? get color { + return switch (this) { + LogLevel.silent => Colors.grey.shade700, + LogLevel.debug => Colors.grey.shade400, + LogLevel.info => null, + LogLevel.warning => Colors.yellowAccent, + LogLevel.error => Colors.redAccent, + }; + } } enum TransportProtocol { udp, tcp } @@ -160,18 +173,18 @@ enum ProxyCardType { expand, shrink, min } enum DnsMode { normal, - @JsonValue("fake-ip") + @JsonValue('fake-ip') fakeIp, - @JsonValue("redir-host") + @JsonValue('redir-host') redirHost, hosts } enum ExternalControllerStatus { - @JsonValue("") - close(""), - @JsonValue("127.0.0.1:9090") - open("127.0.0.1:9090"); + @JsonValue('') + close(''), + @JsonValue('127.0.0.1:9090') + open('127.0.0.1:9090'); final String value; @@ -235,9 +248,9 @@ enum ProxiesIconStyle { } enum FontFamily { - twEmoji("Twemoji"), - jetBrainsMono("JetBrainsMono"), - icon("Icons"); + twEmoji('Twemoji'), + jetBrainsMono('JetBrainsMono'), + icon('Icons'); final String value; @@ -320,6 +333,7 @@ enum FunctionTag { proxiesTabChange, logs, requests, + autoScrollToEnd, } enum DashboardWidget { @@ -423,39 +437,39 @@ enum PageLabel { } enum RuleAction { - DOMAIN("DOMAIN"), - DOMAIN_SUFFIX("DOMAIN-SUFFIX"), - DOMAIN_KEYWORD("DOMAIN-KEYWORD"), - DOMAIN_REGEX("DOMAIN-REGEX"), - GEOSITE("GEOSITE"), - IP_CIDR("IP-CIDR"), - IP_CIDR6("IP-CIDR6"), - IP_SUFFIX("IP-SUFFIX"), - IP_ASN("IP-ASN"), - GEOIP("GEOIP"), - SRC_GEOIP("SRC-GEOIP"), - SRC_IP_ASN("SRC-IP-ASN"), - SRC_IP_CIDR("SRC-IP-CIDR"), - SRC_IP_SUFFIX("SRC-IP-SUFFIX"), - DST_PORT("DST-PORT"), - SRC_PORT("SRC-PORT"), - IN_PORT("IN-PORT"), - IN_TYPE("IN-TYPE"), - IN_USER("IN-USER"), - IN_NAME("IN-NAME"), - PROCESS_PATH("PROCESS-PATH"), - PROCESS_PATH_REGEX("PROCESS-PATH-REGEX"), - PROCESS_NAME("PROCESS-NAME"), - PROCESS_NAME_REGEX("PROCESS-NAME-REGEX"), - UID("UID"), - NETWORK("NETWORK"), - DSCP("DSCP"), - RULE_SET("RULE-SET"), - AND("AND"), - OR("OR"), - NOT("NOT"), - SUB_RULE("SUB-RULE"), - MATCH("MATCH"); + DOMAIN('DOMAIN'), + DOMAIN_SUFFIX('DOMAIN-SUFFIX'), + DOMAIN_KEYWORD('DOMAIN-KEYWORD'), + DOMAIN_REGEX('DOMAIN-REGEX'), + GEOSITE('GEOSITE'), + IP_CIDR('IP-CIDR'), + IP_CIDR6('IP-CIDR6'), + IP_SUFFIX('IP-SUFFIX'), + IP_ASN('IP-ASN'), + GEOIP('GEOIP'), + SRC_GEOIP('SRC-GEOIP'), + SRC_IP_ASN('SRC-IP-ASN'), + SRC_IP_CIDR('SRC-IP-CIDR'), + SRC_IP_SUFFIX('SRC-IP-SUFFIX'), + DST_PORT('DST-PORT'), + SRC_PORT('SRC-PORT'), + IN_PORT('IN-PORT'), + IN_TYPE('IN-TYPE'), + IN_USER('IN-USER'), + IN_NAME('IN-NAME'), + PROCESS_PATH('PROCESS-PATH'), + PROCESS_PATH_REGEX('PROCESS-PATH-REGEX'), + PROCESS_NAME('PROCESS-NAME'), + PROCESS_NAME_REGEX('PROCESS-NAME-REGEX'), + UID('UID'), + NETWORK('NETWORK'), + DSCP('DSCP'), + RULE_SET('RULE-SET'), + AND('AND'), + OR('OR'), + NOT('NOT'), + SUB_RULE('SUB-RULE'), + MATCH('MATCH'); final String value; @@ -493,6 +507,7 @@ enum CacheTag { logs, rules, requests, + proxiesList, } enum Language { @@ -504,3 +519,10 @@ enum ImportOption { file, url, } + +enum ScrollPositionCacheKeys { + tools, + profiles, + proxiesList, + proxiesTabList, +} diff --git a/lib/l10n/intl/messages_en.dart b/lib/l10n/intl/messages_en.dart index 24d48a9..0e1dbe0 100644 --- a/lib/l10n/intl/messages_en.dart +++ b/lib/l10n/intl/messages_en.dart @@ -26,19 +26,21 @@ class MessageLookup extends MessageLookupByLibrary { static String m1(label) => "Are you sure you want to delete the current ${label}?"; - static String m2(label) => "${label} cannot be empty"; + static String m2(label) => "${label} details"; - static String m3(label) => "Current ${label} already exists"; + static String m3(label) => "${label} cannot be empty"; - static String m4(label) => "No ${label} at the moment"; + static String m4(label) => "Current ${label} already exists"; - static String m5(label) => "${label} must be a number"; + static String m5(label) => "No ${label} at the moment"; - static String m6(label) => "${label} must be between 1024 and 49151"; + static String m6(label) => "${label} must be a number"; - static String m7(count) => "${count} items have been selected"; + static String m7(label) => "${label} must be between 1024 and 49151"; - static String m8(label) => "${label} must be a url"; + static String m8(count) => "${count} items have been selected"; + + static String m9(label) => "${label} must be a url"; final messages = _notInlinedMessages(_notInlinedMessages); static Map _notInlinedMessages(_) => { @@ -175,6 +177,7 @@ class MessageLookup extends MessageLookupByLibrary { "Opening it will lose part of its application ability and gain the support of full amount of Clash.", ), "confirm": MessageLookupByLibrary.simpleMessage("Confirm"), + "connection": MessageLookupByLibrary.simpleMessage("Connection"), "connections": MessageLookupByLibrary.simpleMessage("Connections"), "connectionsDesc": MessageLookupByLibrary.simpleMessage( "View current connections data", @@ -194,6 +197,7 @@ class MessageLookup extends MessageLookupByLibrary { "country": MessageLookupByLibrary.simpleMessage("Country"), "crashTest": MessageLookupByLibrary.simpleMessage("Crash test"), "create": MessageLookupByLibrary.simpleMessage("Create"), + "creationTime": MessageLookupByLibrary.simpleMessage("Creation time"), "cut": MessageLookupByLibrary.simpleMessage("Cut"), "dark": MessageLookupByLibrary.simpleMessage("Dark"), "dashboard": MessageLookupByLibrary.simpleMessage("Dashboard"), @@ -214,6 +218,14 @@ class MessageLookup extends MessageLookupByLibrary { "desc": MessageLookupByLibrary.simpleMessage( "A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.", ), + "destination": MessageLookupByLibrary.simpleMessage("Destination"), + "destinationGeoIP": MessageLookupByLibrary.simpleMessage( + "Destination GeoIP", + ), + "destinationIPASN": MessageLookupByLibrary.simpleMessage( + "Destination IPASN", + ), + "details": m2, "detectionTip": MessageLookupByLibrary.simpleMessage( "Relying on third-party api is for reference only", ), @@ -242,7 +254,7 @@ class MessageLookup extends MessageLookupByLibrary { "domain": MessageLookupByLibrary.simpleMessage("Domain"), "download": MessageLookupByLibrary.simpleMessage("Download"), "edit": MessageLookupByLibrary.simpleMessage("Edit"), - "emptyTip": m2, + "emptyTip": m3, "en": MessageLookupByLibrary.simpleMessage("English"), "enableOverride": MessageLookupByLibrary.simpleMessage("Enable override"), "entries": MessageLookupByLibrary.simpleMessage(" entries"), @@ -250,7 +262,7 @@ class MessageLookup extends MessageLookupByLibrary { "excludeDesc": MessageLookupByLibrary.simpleMessage( "When the app is in the background, the app is hidden from the recent task", ), - "existsTip": m3, + "existsTip": m4, "exit": MessageLookupByLibrary.simpleMessage("Exit"), "expand": MessageLookupByLibrary.simpleMessage("Standard"), "expirationTime": MessageLookupByLibrary.simpleMessage("Expiration time"), @@ -312,6 +324,7 @@ class MessageLookup extends MessageLookupByLibrary { "hasCacheChange": MessageLookupByLibrary.simpleMessage( "Do you want to cache the changes?", ), + "host": MessageLookupByLibrary.simpleMessage("Host"), "hostsDesc": MessageLookupByLibrary.simpleMessage("Add Hosts"), "hotkeyConflict": MessageLookupByLibrary.simpleMessage("Hotkey conflict"), "hotkeyManagement": MessageLookupByLibrary.simpleMessage( @@ -366,6 +379,7 @@ class MessageLookup extends MessageLookupByLibrary { "localRecoveryDesc": MessageLookupByLibrary.simpleMessage( "Recovery data from file", ), + "log": MessageLookupByLibrary.simpleMessage("Log"), "logLevel": MessageLookupByLibrary.simpleMessage("LogLevel"), "logcat": MessageLookupByLibrary.simpleMessage("Logcat"), "logcatDesc": MessageLookupByLibrary.simpleMessage( @@ -415,6 +429,7 @@ class MessageLookup extends MessageLookupByLibrary { "Network detection", ), "networkSpeed": MessageLookupByLibrary.simpleMessage("Network speed"), + "networkType": MessageLookupByLibrary.simpleMessage("Network type"), "neutralScheme": MessageLookupByLibrary.simpleMessage("Neutral"), "noData": MessageLookupByLibrary.simpleMessage("No data"), "noHotKey": MessageLookupByLibrary.simpleMessage("No HotKey"), @@ -435,8 +450,8 @@ class MessageLookup extends MessageLookupByLibrary { "nullProfileDesc": MessageLookupByLibrary.simpleMessage( "No profile, Please add a profile", ), - "nullTip": m4, - "numberTip": m5, + "nullTip": m5, + "numberTip": m6, "oneColumn": MessageLookupByLibrary.simpleMessage("One column"), "onlyIcon": MessageLookupByLibrary.simpleMessage("Icon"), "onlyOtherApps": MessageLookupByLibrary.simpleMessage( @@ -490,7 +505,7 @@ class MessageLookup extends MessageLookupByLibrary { "portConflictTip": MessageLookupByLibrary.simpleMessage( "Please enter a different port", ), - "portTip": m6, + "portTip": m7, "preferH3Desc": MessageLookupByLibrary.simpleMessage( "Prioritize the use of DOH\'s http/3", ), @@ -524,10 +539,12 @@ class MessageLookup extends MessageLookupByLibrary { ), "profiles": MessageLookupByLibrary.simpleMessage("Profiles"), "profilesSort": MessageLookupByLibrary.simpleMessage("Profiles sort"), + "progress": MessageLookupByLibrary.simpleMessage("Progress"), "project": MessageLookupByLibrary.simpleMessage("Project"), "providers": MessageLookupByLibrary.simpleMessage("Providers"), "proxies": MessageLookupByLibrary.simpleMessage("Proxies"), "proxiesSetting": MessageLookupByLibrary.simpleMessage("Proxies setting"), + "proxyChains": MessageLookupByLibrary.simpleMessage("Proxy chains"), "proxyGroup": MessageLookupByLibrary.simpleMessage("Proxy group"), "proxyNameserver": MessageLookupByLibrary.simpleMessage("Proxy nameserver"), "proxyNameserverDesc": MessageLookupByLibrary.simpleMessage( @@ -566,11 +583,15 @@ class MessageLookup extends MessageLookupByLibrary { "remoteBackupDesc": MessageLookupByLibrary.simpleMessage( "Backup local data to WebDAV", ), + "remoteDestination": MessageLookupByLibrary.simpleMessage( + "Remote destination", + ), "remoteRecoveryDesc": MessageLookupByLibrary.simpleMessage( "Recovery data from WebDAV", ), "remove": MessageLookupByLibrary.simpleMessage("Remove"), "rename": MessageLookupByLibrary.simpleMessage("Rename"), + "request": MessageLookupByLibrary.simpleMessage("Request"), "requests": MessageLookupByLibrary.simpleMessage("Requests"), "requestsDesc": MessageLookupByLibrary.simpleMessage( "View recently request records", @@ -611,7 +632,7 @@ class MessageLookup extends MessageLookupByLibrary { "seconds": MessageLookupByLibrary.simpleMessage("Seconds"), "selectAll": MessageLookupByLibrary.simpleMessage("Select all"), "selected": MessageLookupByLibrary.simpleMessage("Selected"), - "selectedCountTitle": m7, + "selectedCountTitle": m8, "settings": MessageLookupByLibrary.simpleMessage("Settings"), "show": MessageLookupByLibrary.simpleMessage("Show"), "shrink": MessageLookupByLibrary.simpleMessage("Shrink"), @@ -624,6 +645,8 @@ class MessageLookup extends MessageLookupByLibrary { "sort": MessageLookupByLibrary.simpleMessage("Sort"), "source": MessageLookupByLibrary.simpleMessage("Source"), "sourceIp": MessageLookupByLibrary.simpleMessage("Source IP"), + "specialProxy": MessageLookupByLibrary.simpleMessage("Special proxy"), + "specialRules": MessageLookupByLibrary.simpleMessage("special rules"), "stackMode": MessageLookupByLibrary.simpleMessage("Stack mode"), "standard": MessageLookupByLibrary.simpleMessage("Standard"), "start": MessageLookupByLibrary.simpleMessage("Start"), @@ -692,7 +715,7 @@ class MessageLookup extends MessageLookupByLibrary { "urlDesc": MessageLookupByLibrary.simpleMessage( "Obtain profile through URL", ), - "urlTip": m8, + "urlTip": m9, "useHosts": MessageLookupByLibrary.simpleMessage("Use hosts"), "useSystemHosts": MessageLookupByLibrary.simpleMessage("Use system hosts"), "value": MessageLookupByLibrary.simpleMessage("Value"), diff --git a/lib/l10n/intl/messages_ja.dart b/lib/l10n/intl/messages_ja.dart index 14e7535..553e3d8 100644 --- a/lib/l10n/intl/messages_ja.dart +++ b/lib/l10n/intl/messages_ja.dart @@ -24,19 +24,21 @@ class MessageLookup extends MessageLookupByLibrary { static String m1(label) => "現在の${label}を削除してもよろしいですか?"; - static String m2(label) => "${label}は空欄にできません"; + static String m2(label) => "${label}詳細"; - static String m3(label) => "現在の${label}は既に存在しています"; + static String m3(label) => "${label}は空欄にできません"; - static String m4(label) => "現在${label}はありません"; + static String m4(label) => "現在の${label}は既に存在しています"; - static String m5(label) => "${label}は数字でなければなりません"; + static String m5(label) => "現在${label}はありません"; - static String m6(label) => "${label} は 1024 から 49151 の間でなければなりません"; + static String m6(label) => "${label}は数字でなければなりません"; - static String m7(count) => "${count} 項目が選択されています"; + static String m7(label) => "${label} は 1024 から 49151 の間でなければなりません"; - static String m8(label) => "${label}はURLである必要があります"; + static String m8(count) => "${count} 項目が選択されています"; + + static String m9(label) => "${label}はURLである必要があります"; final messages = _notInlinedMessages(_notInlinedMessages); static Map _notInlinedMessages(_) => { @@ -131,6 +133,7 @@ class MessageLookup extends MessageLookupByLibrary { "有効化すると一部機能を失いますが、Clashの完全サポートを獲得", ), "confirm": MessageLookupByLibrary.simpleMessage("確認"), + "connection": MessageLookupByLibrary.simpleMessage("接続"), "connections": MessageLookupByLibrary.simpleMessage("接続"), "connectionsDesc": MessageLookupByLibrary.simpleMessage("現在の接続データを表示"), "connectivity": MessageLookupByLibrary.simpleMessage("接続性:"), @@ -146,6 +149,7 @@ class MessageLookup extends MessageLookupByLibrary { "country": MessageLookupByLibrary.simpleMessage("国"), "crashTest": MessageLookupByLibrary.simpleMessage("クラッシュテスト"), "create": MessageLookupByLibrary.simpleMessage("作成"), + "creationTime": MessageLookupByLibrary.simpleMessage("作成時間"), "cut": MessageLookupByLibrary.simpleMessage("切り取り"), "dark": MessageLookupByLibrary.simpleMessage("ダーク"), "dashboard": MessageLookupByLibrary.simpleMessage("ダッシュボード"), @@ -164,6 +168,10 @@ class MessageLookup extends MessageLookupByLibrary { "desc": MessageLookupByLibrary.simpleMessage( "ClashMetaベースのマルチプラットフォームプロキシクライアント。シンプルで使いやすく、オープンソースで広告なし。", ), + "destination": MessageLookupByLibrary.simpleMessage("宛先"), + "destinationGeoIP": MessageLookupByLibrary.simpleMessage("宛先地理情報"), + "destinationIPASN": MessageLookupByLibrary.simpleMessage("宛先IP ASN"), + "details": m2, "detectionTip": MessageLookupByLibrary.simpleMessage("サードパーティAPIに依存(参考値)"), "developerMode": MessageLookupByLibrary.simpleMessage("デベロッパーモード"), "developerModeEnableTip": MessageLookupByLibrary.simpleMessage( @@ -182,7 +190,7 @@ class MessageLookup extends MessageLookupByLibrary { "domain": MessageLookupByLibrary.simpleMessage("ドメイン"), "download": MessageLookupByLibrary.simpleMessage("ダウンロード"), "edit": MessageLookupByLibrary.simpleMessage("編集"), - "emptyTip": m2, + "emptyTip": m3, "en": MessageLookupByLibrary.simpleMessage("英語"), "enableOverride": MessageLookupByLibrary.simpleMessage("上書きを有効化"), "entries": MessageLookupByLibrary.simpleMessage(" エントリ"), @@ -190,7 +198,7 @@ class MessageLookup extends MessageLookupByLibrary { "excludeDesc": MessageLookupByLibrary.simpleMessage( "アプリがバックグラウンド時に最近のタスクから非表示", ), - "existsTip": m3, + "existsTip": m4, "exit": MessageLookupByLibrary.simpleMessage("終了"), "expand": MessageLookupByLibrary.simpleMessage("標準"), "expirationTime": MessageLookupByLibrary.simpleMessage("有効期限"), @@ -236,6 +244,7 @@ class MessageLookup extends MessageLookupByLibrary { "go": MessageLookupByLibrary.simpleMessage("移動"), "goDownload": MessageLookupByLibrary.simpleMessage("ダウンロードへ"), "hasCacheChange": MessageLookupByLibrary.simpleMessage("変更をキャッシュしますか?"), + "host": MessageLookupByLibrary.simpleMessage("ホスト"), "hostsDesc": MessageLookupByLibrary.simpleMessage("ホストを追加"), "hotkeyConflict": MessageLookupByLibrary.simpleMessage("ホットキー競合"), "hotkeyManagement": MessageLookupByLibrary.simpleMessage("ホットキー管理"), @@ -274,6 +283,7 @@ class MessageLookup extends MessageLookupByLibrary { "local": MessageLookupByLibrary.simpleMessage("ローカル"), "localBackupDesc": MessageLookupByLibrary.simpleMessage("ローカルにデータをバックアップ"), "localRecoveryDesc": MessageLookupByLibrary.simpleMessage("ファイルからデータを復元"), + "log": MessageLookupByLibrary.simpleMessage("ログ"), "logLevel": MessageLookupByLibrary.simpleMessage("ログレベル"), "logcat": MessageLookupByLibrary.simpleMessage("ログキャット"), "logcatDesc": MessageLookupByLibrary.simpleMessage("無効化するとログエントリを非表示"), @@ -309,6 +319,7 @@ class MessageLookup extends MessageLookupByLibrary { "networkDesc": MessageLookupByLibrary.simpleMessage("ネットワーク関連設定の変更"), "networkDetection": MessageLookupByLibrary.simpleMessage("ネットワーク検出"), "networkSpeed": MessageLookupByLibrary.simpleMessage("ネットワーク速度"), + "networkType": MessageLookupByLibrary.simpleMessage("ネットワーク種別"), "neutralScheme": MessageLookupByLibrary.simpleMessage("ニュートラル"), "noData": MessageLookupByLibrary.simpleMessage("データなし"), "noHotKey": MessageLookupByLibrary.simpleMessage("ホットキーなし"), @@ -329,8 +340,8 @@ class MessageLookup extends MessageLookupByLibrary { "nullProfileDesc": MessageLookupByLibrary.simpleMessage( "プロファイルがありません。追加してください", ), - "nullTip": m4, - "numberTip": m5, + "nullTip": m5, + "numberTip": m6, "oneColumn": MessageLookupByLibrary.simpleMessage("1列"), "onlyIcon": MessageLookupByLibrary.simpleMessage("アイコンのみ"), "onlyOtherApps": MessageLookupByLibrary.simpleMessage("サードパーティアプリのみ"), @@ -372,7 +383,7 @@ class MessageLookup extends MessageLookupByLibrary { ), "port": MessageLookupByLibrary.simpleMessage("ポート"), "portConflictTip": MessageLookupByLibrary.simpleMessage("別のポートを入力してください"), - "portTip": m6, + "portTip": m7, "preferH3Desc": MessageLookupByLibrary.simpleMessage("DOHのHTTP/3を優先使用"), "pressKeyboard": MessageLookupByLibrary.simpleMessage("キーボードを押してください"), "preview": MessageLookupByLibrary.simpleMessage("プレビュー"), @@ -398,10 +409,12 @@ class MessageLookup extends MessageLookupByLibrary { ), "profiles": MessageLookupByLibrary.simpleMessage("プロファイル一覧"), "profilesSort": MessageLookupByLibrary.simpleMessage("プロファイルの並び替え"), + "progress": MessageLookupByLibrary.simpleMessage("進捗"), "project": MessageLookupByLibrary.simpleMessage("プロジェクト"), "providers": MessageLookupByLibrary.simpleMessage("プロバイダー"), "proxies": MessageLookupByLibrary.simpleMessage("プロキシ"), "proxiesSetting": MessageLookupByLibrary.simpleMessage("プロキシ設定"), + "proxyChains": MessageLookupByLibrary.simpleMessage("プロキシチェーン"), "proxyGroup": MessageLookupByLibrary.simpleMessage("プロキシグループ"), "proxyNameserver": MessageLookupByLibrary.simpleMessage("プロキシネームサーバー"), "proxyNameserverDesc": MessageLookupByLibrary.simpleMessage( @@ -430,11 +443,13 @@ class MessageLookup extends MessageLookupByLibrary { "remoteBackupDesc": MessageLookupByLibrary.simpleMessage( "WebDAVにデータをバックアップ", ), + "remoteDestination": MessageLookupByLibrary.simpleMessage("リモート宛先"), "remoteRecoveryDesc": MessageLookupByLibrary.simpleMessage( "WebDAVからデータを復元", ), "remove": MessageLookupByLibrary.simpleMessage("削除"), "rename": MessageLookupByLibrary.simpleMessage("リネーム"), + "request": MessageLookupByLibrary.simpleMessage("リクエスト"), "requests": MessageLookupByLibrary.simpleMessage("リクエスト"), "requestsDesc": MessageLookupByLibrary.simpleMessage("最近のリクエスト記録を表示"), "reset": MessageLookupByLibrary.simpleMessage("リセット"), @@ -465,7 +480,7 @@ class MessageLookup extends MessageLookupByLibrary { "seconds": MessageLookupByLibrary.simpleMessage("秒"), "selectAll": MessageLookupByLibrary.simpleMessage("すべて選択"), "selected": MessageLookupByLibrary.simpleMessage("選択済み"), - "selectedCountTitle": m7, + "selectedCountTitle": m8, "settings": MessageLookupByLibrary.simpleMessage("設定"), "show": MessageLookupByLibrary.simpleMessage("表示"), "shrink": MessageLookupByLibrary.simpleMessage("縮小"), @@ -476,6 +491,8 @@ class MessageLookup extends MessageLookupByLibrary { "sort": MessageLookupByLibrary.simpleMessage("並び替え"), "source": MessageLookupByLibrary.simpleMessage("ソース"), "sourceIp": MessageLookupByLibrary.simpleMessage("送信元IP"), + "specialProxy": MessageLookupByLibrary.simpleMessage("特殊プロキシ"), + "specialRules": MessageLookupByLibrary.simpleMessage("特殊ルール"), "stackMode": MessageLookupByLibrary.simpleMessage("スタックモード"), "standard": MessageLookupByLibrary.simpleMessage("標準"), "start": MessageLookupByLibrary.simpleMessage("開始"), @@ -532,7 +549,7 @@ class MessageLookup extends MessageLookupByLibrary { "upload": MessageLookupByLibrary.simpleMessage("アップロード"), "url": MessageLookupByLibrary.simpleMessage("URL"), "urlDesc": MessageLookupByLibrary.simpleMessage("URL経由でプロファイルを取得"), - "urlTip": m8, + "urlTip": m9, "useHosts": MessageLookupByLibrary.simpleMessage("ホストを使用"), "useSystemHosts": MessageLookupByLibrary.simpleMessage("システムホストを使用"), "value": MessageLookupByLibrary.simpleMessage("値"), diff --git a/lib/l10n/intl/messages_ru.dart b/lib/l10n/intl/messages_ru.dart index 530ebcc..e80f88f 100644 --- a/lib/l10n/intl/messages_ru.dart +++ b/lib/l10n/intl/messages_ru.dart @@ -25,19 +25,21 @@ class MessageLookup extends MessageLookupByLibrary { static String m1(label) => "Вы уверены, что хотите удалить текущий ${label}?"; - static String m2(label) => "${label} не может быть пустым"; + static String m2(label) => "Детали {}"; - static String m3(label) => "Текущий ${label} уже существует"; + static String m3(label) => "${label} не может быть пустым"; - static String m4(label) => "Сейчас ${label} нет"; + static String m4(label) => "Текущий ${label} уже существует"; - static String m5(label) => "${label} должно быть числом"; + static String m5(label) => "Сейчас ${label} нет"; - static String m6(label) => "${label} должен быть числом от 1024 до 49151"; + static String m6(label) => "${label} должно быть числом"; - static String m7(count) => "Выбрано ${count} элементов"; + static String m7(label) => "${label} должен быть числом от 1024 до 49151"; - static String m8(label) => "${label} должен быть URL"; + static String m8(count) => "Выбрано ${count} элементов"; + + static String m9(label) => "${label} должен быть URL"; final messages = _notInlinedMessages(_notInlinedMessages); static Map _notInlinedMessages(_) => { @@ -180,6 +182,7 @@ class MessageLookup extends MessageLookupByLibrary { "Включение приведет к потере части функциональности приложения, но обеспечит полную поддержку Clash.", ), "confirm": MessageLookupByLibrary.simpleMessage("Подтвердить"), + "connection": MessageLookupByLibrary.simpleMessage("Соединение"), "connections": MessageLookupByLibrary.simpleMessage("Соединения"), "connectionsDesc": MessageLookupByLibrary.simpleMessage( "Просмотр текущих данных о соединениях", @@ -199,6 +202,7 @@ class MessageLookup extends MessageLookupByLibrary { "country": MessageLookupByLibrary.simpleMessage("Страна"), "crashTest": MessageLookupByLibrary.simpleMessage("Тест на сбои"), "create": MessageLookupByLibrary.simpleMessage("Создать"), + "creationTime": MessageLookupByLibrary.simpleMessage("Время создания"), "cut": MessageLookupByLibrary.simpleMessage("Вырезать"), "dark": MessageLookupByLibrary.simpleMessage("Темный"), "dashboard": MessageLookupByLibrary.simpleMessage("Панель управления"), @@ -221,6 +225,12 @@ class MessageLookup extends MessageLookupByLibrary { "desc": MessageLookupByLibrary.simpleMessage( "Многоплатформенный прокси-клиент на основе ClashMeta, простой и удобный в использовании, с открытым исходным кодом и без рекламы.", ), + "destination": MessageLookupByLibrary.simpleMessage("Назначение"), + "destinationGeoIP": MessageLookupByLibrary.simpleMessage( + "Геолокация назначения", + ), + "destinationIPASN": MessageLookupByLibrary.simpleMessage("ASN назначения"), + "details": m2, "detectionTip": MessageLookupByLibrary.simpleMessage( "Опирается на сторонний API, только для справки", ), @@ -251,7 +261,7 @@ class MessageLookup extends MessageLookupByLibrary { "domain": MessageLookupByLibrary.simpleMessage("Домен"), "download": MessageLookupByLibrary.simpleMessage("Скачивание"), "edit": MessageLookupByLibrary.simpleMessage("Редактировать"), - "emptyTip": m2, + "emptyTip": m3, "en": MessageLookupByLibrary.simpleMessage("Английский"), "enableOverride": MessageLookupByLibrary.simpleMessage( "Включить переопределение", @@ -263,7 +273,7 @@ class MessageLookup extends MessageLookupByLibrary { "excludeDesc": MessageLookupByLibrary.simpleMessage( "Когда приложение находится в фоновом режиме, оно скрыто из последних задач", ), - "existsTip": m3, + "existsTip": m4, "exit": MessageLookupByLibrary.simpleMessage("Выход"), "expand": MessageLookupByLibrary.simpleMessage("Стандартный"), "expirationTime": MessageLookupByLibrary.simpleMessage("Время истечения"), @@ -329,6 +339,7 @@ class MessageLookup extends MessageLookupByLibrary { "hasCacheChange": MessageLookupByLibrary.simpleMessage( "Хотите сохранить изменения в кэше?", ), + "host": MessageLookupByLibrary.simpleMessage("Хост"), "hostsDesc": MessageLookupByLibrary.simpleMessage("Добавить Hosts"), "hotkeyConflict": MessageLookupByLibrary.simpleMessage( "Конфликт горячих клавиш", @@ -387,6 +398,7 @@ class MessageLookup extends MessageLookupByLibrary { "localRecoveryDesc": MessageLookupByLibrary.simpleMessage( "Восстановление данных из файла", ), + "log": MessageLookupByLibrary.simpleMessage("Журнал"), "logLevel": MessageLookupByLibrary.simpleMessage("Уровень логов"), "logcat": MessageLookupByLibrary.simpleMessage("Logcat"), "logcatDesc": MessageLookupByLibrary.simpleMessage( @@ -440,6 +452,7 @@ class MessageLookup extends MessageLookupByLibrary { "Обнаружение сети", ), "networkSpeed": MessageLookupByLibrary.simpleMessage("Скорость сети"), + "networkType": MessageLookupByLibrary.simpleMessage("Тип сети"), "neutralScheme": MessageLookupByLibrary.simpleMessage("Нейтральные"), "noData": MessageLookupByLibrary.simpleMessage("Нет данных"), "noHotKey": MessageLookupByLibrary.simpleMessage("Нет горячей клавиши"), @@ -462,8 +475,8 @@ class MessageLookup extends MessageLookupByLibrary { "nullProfileDesc": MessageLookupByLibrary.simpleMessage( "Нет профиля, пожалуйста, добавьте профиль", ), - "nullTip": m4, - "numberTip": m5, + "nullTip": m5, + "numberTip": m6, "oneColumn": MessageLookupByLibrary.simpleMessage("Один столбец"), "onlyIcon": MessageLookupByLibrary.simpleMessage("Только иконка"), "onlyOtherApps": MessageLookupByLibrary.simpleMessage( @@ -519,7 +532,7 @@ class MessageLookup extends MessageLookupByLibrary { "portConflictTip": MessageLookupByLibrary.simpleMessage( "Введите другой порт", ), - "portTip": m6, + "portTip": m7, "preferH3Desc": MessageLookupByLibrary.simpleMessage( "Приоритетное использование HTTP/3 для DOH", ), @@ -553,10 +566,12 @@ class MessageLookup extends MessageLookupByLibrary { ), "profiles": MessageLookupByLibrary.simpleMessage("Профили"), "profilesSort": MessageLookupByLibrary.simpleMessage("Сортировка профилей"), + "progress": MessageLookupByLibrary.simpleMessage("Прогресс"), "project": MessageLookupByLibrary.simpleMessage("Проект"), "providers": MessageLookupByLibrary.simpleMessage("Провайдеры"), "proxies": MessageLookupByLibrary.simpleMessage("Прокси"), "proxiesSetting": MessageLookupByLibrary.simpleMessage("Настройка прокси"), + "proxyChains": MessageLookupByLibrary.simpleMessage("Цепочки прокси"), "proxyGroup": MessageLookupByLibrary.simpleMessage("Группа прокси"), "proxyNameserver": MessageLookupByLibrary.simpleMessage( "Прокси-сервер имен", @@ -601,11 +616,15 @@ class MessageLookup extends MessageLookupByLibrary { "remoteBackupDesc": MessageLookupByLibrary.simpleMessage( "Резервное копирование локальных данных на WebDAV", ), + "remoteDestination": MessageLookupByLibrary.simpleMessage( + "Удалённое назначение", + ), "remoteRecoveryDesc": MessageLookupByLibrary.simpleMessage( "Восстановление данных с WebDAV", ), "remove": MessageLookupByLibrary.simpleMessage("Удалить"), "rename": MessageLookupByLibrary.simpleMessage("Переименовать"), + "request": MessageLookupByLibrary.simpleMessage("Запрос"), "requests": MessageLookupByLibrary.simpleMessage("Запросы"), "requestsDesc": MessageLookupByLibrary.simpleMessage( "Просмотр последних записей запросов", @@ -648,7 +667,7 @@ class MessageLookup extends MessageLookupByLibrary { "seconds": MessageLookupByLibrary.simpleMessage("Секунд"), "selectAll": MessageLookupByLibrary.simpleMessage("Выбрать все"), "selected": MessageLookupByLibrary.simpleMessage("Выбрано"), - "selectedCountTitle": m7, + "selectedCountTitle": m8, "settings": MessageLookupByLibrary.simpleMessage("Настройки"), "show": MessageLookupByLibrary.simpleMessage("Показать"), "shrink": MessageLookupByLibrary.simpleMessage("Сжать"), @@ -661,6 +680,8 @@ class MessageLookup extends MessageLookupByLibrary { "sort": MessageLookupByLibrary.simpleMessage("Сортировка"), "source": MessageLookupByLibrary.simpleMessage("Источник"), "sourceIp": MessageLookupByLibrary.simpleMessage("Исходный IP"), + "specialProxy": MessageLookupByLibrary.simpleMessage("Специальный прокси"), + "specialRules": MessageLookupByLibrary.simpleMessage("Специальные правила"), "stackMode": MessageLookupByLibrary.simpleMessage("Режим стека"), "standard": MessageLookupByLibrary.simpleMessage("Стандартный"), "start": MessageLookupByLibrary.simpleMessage("Старт"), @@ -733,7 +754,7 @@ class MessageLookup extends MessageLookupByLibrary { "urlDesc": MessageLookupByLibrary.simpleMessage( "Получить профиль через URL", ), - "urlTip": m8, + "urlTip": m9, "useHosts": MessageLookupByLibrary.simpleMessage("Использовать hosts"), "useSystemHosts": MessageLookupByLibrary.simpleMessage( "Использовать системные hosts", diff --git a/lib/l10n/intl/messages_zh_CN.dart b/lib/l10n/intl/messages_zh_CN.dart index f7c7b71..a66935a 100644 --- a/lib/l10n/intl/messages_zh_CN.dart +++ b/lib/l10n/intl/messages_zh_CN.dart @@ -24,19 +24,21 @@ class MessageLookup extends MessageLookupByLibrary { static String m1(label) => "确定删除当前${label}吗?"; - static String m2(label) => "${label}不能为空"; + static String m2(label) => "${label}详情"; - static String m3(label) => "${label}当前已存在"; + static String m3(label) => "${label}不能为空"; - static String m4(label) => "暂无${label}"; + static String m4(label) => "${label}当前已存在"; - static String m5(label) => "${label}必须为数字"; + static String m5(label) => "暂无${label}"; - static String m6(label) => "${label} 必须在 1024 到 49151 之间"; + static String m6(label) => "${label}必须为数字"; - static String m7(count) => "已选择 ${count} 项"; + static String m7(label) => "${label} 必须在 1024 到 49151 之间"; - static String m8(label) => "${label}必须为URL"; + static String m8(count) => "已选择 ${count} 项"; + + static String m9(label) => "${label}必须为URL"; final messages = _notInlinedMessages(_notInlinedMessages); static Map _notInlinedMessages(_) => { @@ -121,6 +123,7 @@ class MessageLookup extends MessageLookupByLibrary { "开启将失去部分应用能力,获得全量的Clash的支持", ), "confirm": MessageLookupByLibrary.simpleMessage("确定"), + "connection": MessageLookupByLibrary.simpleMessage("连接"), "connections": MessageLookupByLibrary.simpleMessage("连接"), "connectionsDesc": MessageLookupByLibrary.simpleMessage("查看当前连接数据"), "connectivity": MessageLookupByLibrary.simpleMessage("连通性:"), @@ -136,6 +139,7 @@ class MessageLookup extends MessageLookupByLibrary { "country": MessageLookupByLibrary.simpleMessage("区域"), "crashTest": MessageLookupByLibrary.simpleMessage("崩溃测试"), "create": MessageLookupByLibrary.simpleMessage("创建"), + "creationTime": MessageLookupByLibrary.simpleMessage("创建时间"), "cut": MessageLookupByLibrary.simpleMessage("剪切"), "dark": MessageLookupByLibrary.simpleMessage("深色"), "dashboard": MessageLookupByLibrary.simpleMessage("仪表盘"), @@ -152,6 +156,10 @@ class MessageLookup extends MessageLookupByLibrary { "desc": MessageLookupByLibrary.simpleMessage( "基于ClashMeta的多平台代理客户端,简单易用,开源无广告。", ), + "destination": MessageLookupByLibrary.simpleMessage("目标地址"), + "destinationGeoIP": MessageLookupByLibrary.simpleMessage("目标地理定位"), + "destinationIPASN": MessageLookupByLibrary.simpleMessage("目标IP ASN"), + "details": m2, "detectionTip": MessageLookupByLibrary.simpleMessage("依赖第三方api,仅供参考"), "developerMode": MessageLookupByLibrary.simpleMessage("开发者模式"), "developerModeEnableTip": MessageLookupByLibrary.simpleMessage("开发者模式已启用。"), @@ -168,13 +176,13 @@ class MessageLookup extends MessageLookupByLibrary { "domain": MessageLookupByLibrary.simpleMessage("域名"), "download": MessageLookupByLibrary.simpleMessage("下载"), "edit": MessageLookupByLibrary.simpleMessage("编辑"), - "emptyTip": m2, + "emptyTip": m3, "en": MessageLookupByLibrary.simpleMessage("英语"), "enableOverride": MessageLookupByLibrary.simpleMessage("启用覆写"), "entries": MessageLookupByLibrary.simpleMessage("个条目"), "exclude": MessageLookupByLibrary.simpleMessage("从最近任务中隐藏"), "excludeDesc": MessageLookupByLibrary.simpleMessage("应用在后台时,从最近任务中隐藏应用"), - "existsTip": m3, + "existsTip": m4, "exit": MessageLookupByLibrary.simpleMessage("退出"), "expand": MessageLookupByLibrary.simpleMessage("标准"), "expirationTime": MessageLookupByLibrary.simpleMessage("到期时间"), @@ -214,6 +222,7 @@ class MessageLookup extends MessageLookupByLibrary { "go": MessageLookupByLibrary.simpleMessage("前往"), "goDownload": MessageLookupByLibrary.simpleMessage("前往下载"), "hasCacheChange": MessageLookupByLibrary.simpleMessage("是否缓存修改"), + "host": MessageLookupByLibrary.simpleMessage("主机"), "hostsDesc": MessageLookupByLibrary.simpleMessage("追加Hosts"), "hotkeyConflict": MessageLookupByLibrary.simpleMessage("快捷键冲突"), "hotkeyManagement": MessageLookupByLibrary.simpleMessage("快捷键管理"), @@ -248,6 +257,7 @@ class MessageLookup extends MessageLookupByLibrary { "local": MessageLookupByLibrary.simpleMessage("本地"), "localBackupDesc": MessageLookupByLibrary.simpleMessage("备份数据到本地"), "localRecoveryDesc": MessageLookupByLibrary.simpleMessage("通过文件恢复数据"), + "log": MessageLookupByLibrary.simpleMessage("日志"), "logLevel": MessageLookupByLibrary.simpleMessage("日志等级"), "logcat": MessageLookupByLibrary.simpleMessage("日志捕获"), "logcatDesc": MessageLookupByLibrary.simpleMessage("禁用将会隐藏日志入口"), @@ -279,6 +289,7 @@ class MessageLookup extends MessageLookupByLibrary { "networkDesc": MessageLookupByLibrary.simpleMessage("修改网络相关设置"), "networkDetection": MessageLookupByLibrary.simpleMessage("网络检测"), "networkSpeed": MessageLookupByLibrary.simpleMessage("网络速度"), + "networkType": MessageLookupByLibrary.simpleMessage("网络类型"), "neutralScheme": MessageLookupByLibrary.simpleMessage("中性"), "noData": MessageLookupByLibrary.simpleMessage("暂无数据"), "noHotKey": MessageLookupByLibrary.simpleMessage("暂无快捷键"), @@ -293,8 +304,8 @@ class MessageLookup extends MessageLookupByLibrary { "none": MessageLookupByLibrary.simpleMessage("无"), "notSelectedTip": MessageLookupByLibrary.simpleMessage("当前代理组无法选中"), "nullProfileDesc": MessageLookupByLibrary.simpleMessage("没有配置文件,请先添加配置文件"), - "nullTip": m4, - "numberTip": m5, + "nullTip": m5, + "numberTip": m6, "oneColumn": MessageLookupByLibrary.simpleMessage("一列"), "onlyIcon": MessageLookupByLibrary.simpleMessage("仅图标"), "onlyOtherApps": MessageLookupByLibrary.simpleMessage("仅第三方应用"), @@ -326,7 +337,7 @@ class MessageLookup extends MessageLookupByLibrary { ), "port": MessageLookupByLibrary.simpleMessage("端口"), "portConflictTip": MessageLookupByLibrary.simpleMessage("请输入不同的端口"), - "portTip": m6, + "portTip": m7, "preferH3Desc": MessageLookupByLibrary.simpleMessage("优先使用DOH的http/3"), "pressKeyboard": MessageLookupByLibrary.simpleMessage("请按下按键"), "preview": MessageLookupByLibrary.simpleMessage("预览"), @@ -350,10 +361,12 @@ class MessageLookup extends MessageLookupByLibrary { ), "profiles": MessageLookupByLibrary.simpleMessage("配置"), "profilesSort": MessageLookupByLibrary.simpleMessage("配置排序"), + "progress": MessageLookupByLibrary.simpleMessage("进度"), "project": MessageLookupByLibrary.simpleMessage("项目"), "providers": MessageLookupByLibrary.simpleMessage("提供者"), "proxies": MessageLookupByLibrary.simpleMessage("代理"), "proxiesSetting": MessageLookupByLibrary.simpleMessage("代理设置"), + "proxyChains": MessageLookupByLibrary.simpleMessage("代理链"), "proxyGroup": MessageLookupByLibrary.simpleMessage("代理组"), "proxyNameserver": MessageLookupByLibrary.simpleMessage("代理域名服务器"), "proxyNameserverDesc": MessageLookupByLibrary.simpleMessage("用于解析代理节点的域名"), @@ -376,9 +389,11 @@ class MessageLookup extends MessageLookupByLibrary { "regExp": MessageLookupByLibrary.simpleMessage("正则"), "remote": MessageLookupByLibrary.simpleMessage("远程"), "remoteBackupDesc": MessageLookupByLibrary.simpleMessage("备份数据到WebDAV"), + "remoteDestination": MessageLookupByLibrary.simpleMessage("远程目标"), "remoteRecoveryDesc": MessageLookupByLibrary.simpleMessage("通过WebDAV恢复数据"), "remove": MessageLookupByLibrary.simpleMessage("移除"), "rename": MessageLookupByLibrary.simpleMessage("重命名"), + "request": MessageLookupByLibrary.simpleMessage("请求"), "requests": MessageLookupByLibrary.simpleMessage("请求"), "requestsDesc": MessageLookupByLibrary.simpleMessage("查看最近请求记录"), "reset": MessageLookupByLibrary.simpleMessage("重置"), @@ -407,7 +422,7 @@ class MessageLookup extends MessageLookupByLibrary { "seconds": MessageLookupByLibrary.simpleMessage("秒"), "selectAll": MessageLookupByLibrary.simpleMessage("全选"), "selected": MessageLookupByLibrary.simpleMessage("已选择"), - "selectedCountTitle": m7, + "selectedCountTitle": m8, "settings": MessageLookupByLibrary.simpleMessage("设置"), "show": MessageLookupByLibrary.simpleMessage("显示"), "shrink": MessageLookupByLibrary.simpleMessage("紧凑"), @@ -418,6 +433,8 @@ class MessageLookup extends MessageLookupByLibrary { "sort": MessageLookupByLibrary.simpleMessage("排序"), "source": MessageLookupByLibrary.simpleMessage("来源"), "sourceIp": MessageLookupByLibrary.simpleMessage("源IP"), + "specialProxy": MessageLookupByLibrary.simpleMessage("特殊代理"), + "specialRules": MessageLookupByLibrary.simpleMessage("特殊规则"), "stackMode": MessageLookupByLibrary.simpleMessage("栈模式"), "standard": MessageLookupByLibrary.simpleMessage("标准"), "start": MessageLookupByLibrary.simpleMessage("启动"), @@ -470,7 +487,7 @@ class MessageLookup extends MessageLookupByLibrary { "upload": MessageLookupByLibrary.simpleMessage("上传"), "url": MessageLookupByLibrary.simpleMessage("URL"), "urlDesc": MessageLookupByLibrary.simpleMessage("通过URL获取配置文件"), - "urlTip": m8, + "urlTip": m9, "useHosts": MessageLookupByLibrary.simpleMessage("使用Hosts"), "useSystemHosts": MessageLookupByLibrary.simpleMessage("使用系统Hosts"), "value": MessageLookupByLibrary.simpleMessage("值"), diff --git a/lib/l10n/l10n.dart b/lib/l10n/l10n.dart index d8aeb56..daa4b74 100644 --- a/lib/l10n/l10n.dart +++ b/lib/l10n/l10n.dart @@ -3139,6 +3139,126 @@ class AppLocalizations { args: [], ); } + + /// `{label} details` + String details(Object label) { + return Intl.message( + '$label details', + name: 'details', + desc: '', + args: [label], + ); + } + + /// `Creation time` + String get creationTime { + return Intl.message( + 'Creation time', + name: 'creationTime', + desc: '', + args: [], + ); + } + + /// `Progress` + String get progress { + return Intl.message('Progress', name: 'progress', desc: '', args: []); + } + + /// `Host` + String get host { + return Intl.message('Host', name: 'host', desc: '', args: []); + } + + /// `Destination` + String get destination { + return Intl.message('Destination', name: 'destination', desc: '', args: []); + } + + /// `Destination GeoIP` + String get destinationGeoIP { + return Intl.message( + 'Destination GeoIP', + name: 'destinationGeoIP', + desc: '', + args: [], + ); + } + + /// `Destination IPASN` + String get destinationIPASN { + return Intl.message( + 'Destination IPASN', + name: 'destinationIPASN', + desc: '', + args: [], + ); + } + + /// `Special proxy` + String get specialProxy { + return Intl.message( + 'Special proxy', + name: 'specialProxy', + desc: '', + args: [], + ); + } + + /// `special rules` + String get specialRules { + return Intl.message( + 'special rules', + name: 'specialRules', + desc: '', + args: [], + ); + } + + /// `Remote destination` + String get remoteDestination { + return Intl.message( + 'Remote destination', + name: 'remoteDestination', + desc: '', + args: [], + ); + } + + /// `Network type` + String get networkType { + return Intl.message( + 'Network type', + name: 'networkType', + desc: '', + args: [], + ); + } + + /// `Proxy chains` + String get proxyChains { + return Intl.message( + 'Proxy chains', + name: 'proxyChains', + desc: '', + args: [], + ); + } + + /// `Log` + String get log { + return Intl.message('Log', name: 'log', desc: '', args: []); + } + + /// `Connection` + String get connection { + return Intl.message('Connection', name: 'connection', desc: '', args: []); + } + + /// `Request` + String get request { + return Intl.message('Request', name: 'request', desc: '', args: []); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/main.dart b/lib/main.dart index 17c8420..daf6078 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -36,7 +36,7 @@ Future main() async { Future _service(List flags) async { globalState.isService = true; WidgetsFlutterBinding.ensureInitialized(); - final quickStart = flags.contains("quick"); + final quickStart = flags.contains('quick'); final clashLibHandler = ClashLibHandler(); await globalState.init(); @@ -54,15 +54,14 @@ Future _service(List flags) async { vpn?.handleGetStartForegroundParams = () { final traffic = clashLibHandler.getTraffic(); return json.encode({ - "title": clashLibHandler.getCurrentProfileName(), - "content": "$traffic" + 'title': clashLibHandler.getCurrentProfileName(), + 'content': '$traffic' }); }; vpn?.addListener( _VpnListenerWithService( onDnsChanged: (String dns) { - print("handle dns $dns"); clashLibHandler.updateDns(dns); }, ), @@ -70,7 +69,7 @@ Future _service(List flags) async { if (!quickStart) { _handleMainIpc(clashLibHandler); } else { - commonPrint.log("quick start"); + commonPrint.log('quick start'); await ClashCore.initGeo(); app?.tip(appLocalizations.startVpn); final homeDirPath = await appPath.homeDirPath; @@ -107,7 +106,7 @@ Future _service(List flags) async { } } -_handleMainIpc(ClashLibHandler clashLibHandler) { +void _handleMainIpc(ClashLibHandler clashLibHandler) { final sendPort = IsolateNameServer.lookupPortByName(mainIsolate); if (sendPort == null) { return; diff --git a/lib/manager/android_manager.dart b/lib/manager/android_manager.dart index 7a051a4..e735971 100644 --- a/lib/manager/android_manager.dart +++ b/lib/manager/android_manager.dart @@ -1,7 +1,6 @@ import 'package:fl_clash/plugins/app.dart'; -import 'package:fl_clash/providers/config.dart'; +import 'package:fl_clash/providers/providers.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; class AndroidManager extends ConsumerStatefulWidget { @@ -20,14 +19,10 @@ class _AndroidContainerState extends ConsumerState { @override void initState() { super.initState(); - SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); - ref.listenManual( - appSettingProvider.select((state) => state.hidden), - (prev, next) { - app?.updateExcludeFromRecents(next); - }, - fireImmediately: true - ); + ref.listenManual(appSettingProvider.select((state) => state.hidden), + (prev, next) { + app?.updateExcludeFromRecents(next); + }, fireImmediately: true); } @override diff --git a/lib/manager/app_manager.dart b/lib/manager/app_manager.dart new file mode 100644 index 0000000..ff206bc --- /dev/null +++ b/lib/manager/app_manager.dart @@ -0,0 +1,291 @@ +import 'dart:async'; + +import 'package:fl_clash/common/common.dart'; +import 'package:fl_clash/enum/enum.dart'; +import 'package:fl_clash/manager/window_manager.dart'; +import 'package:fl_clash/providers/providers.dart'; +import 'package:fl_clash/state.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_acrylic/widgets/transparent_macos_sidebar.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:intl/intl.dart'; + +class AppStateManager extends ConsumerStatefulWidget { + final Widget child; + + const AppStateManager({ + super.key, + required this.child, + }); + + @override + ConsumerState createState() => _AppStateManagerState(); +} + +class _AppStateManagerState extends ConsumerState + with WidgetsBindingObserver { + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addObserver(this); + ref.listenManual(layoutChangeProvider, (prev, next) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (prev != next) { + globalState.computeHeightMapCache = {}; + } + }); + }); + ref.listenManual( + checkIpProvider, + (prev, next) { + if (prev != next && next.b) { + detectionState.startCheck(); + } + }, + fireImmediately: true, + ); + ref.listenManual(configStateProvider, (prev, next) { + if (prev != next) { + globalState.appController.savePreferencesDebounce(); + } + }); + if (window == null) { + return; + } + ref.listenManual( + autoSetSystemDnsStateProvider, + (prev, next) async { + if (prev == next) { + return; + } + if (next.a == true && next.b == true) { + macOS?.updateDns(false); + } else { + macOS?.updateDns(true); + } + }, + ); + ref.listenManual( + currentBrightnessProvider, + (prev, next) { + if (prev == next) { + return; + } + window?.updateMacOSBrightness(next); + }, + fireImmediately: true, + ); + } + + @override + void dispose() { + WidgetsBinding.instance.removeObserver(this); + super.dispose(); + } + + @override + Future didChangeAppLifecycleState(AppLifecycleState state) async { + commonPrint.log('$state'); + if (state == AppLifecycleState.paused || + state == AppLifecycleState.inactive) { + globalState.appController.savePreferences(); + } else { + render?.resume(); + } + if (state == AppLifecycleState.inactive) { + WidgetsBinding.instance.addPostFrameCallback((_) { + detectionState.tryStartCheck(); + }); + } + } + + @override + void didChangePlatformBrightness() { + globalState.appController.updateBrightness(); + } + + @override + Widget build(BuildContext context) { + return Listener( + onPointerHover: (_) { + render?.resume(); + }, + child: widget.child, + ); + } +} + +class AppEnvManager extends StatelessWidget { + final Widget child; + + const AppEnvManager({ + super.key, + required this.child, + }); + + @override + Widget build(BuildContext context) { + if (kDebugMode) { + if (globalState.isPre) { + return Banner( + message: 'DEBUG', + location: BannerLocation.topEnd, + child: child, + ); + } + } + if (globalState.isPre) { + return Banner( + message: 'PRE', + location: BannerLocation.topEnd, + child: child, + ); + } + return child; + } +} + +class AppSidebarContainer extends ConsumerWidget { + final Widget child; + + const AppSidebarContainer({ + super.key, + required this.child, + }); + + Widget _buildLoading() { + return Consumer( + builder: (_, ref, __) { + final loading = ref.watch(loadingProvider); + final isMobileView = ref.watch(isMobileViewProvider); + return loading && !isMobileView + ? RotatedBox( + quarterTurns: 1, + child: const LinearProgressIndicator(), + ) + : Container(); + }, + ); + } + + Widget _buildBackground({ + required BuildContext context, + required Widget child, + }) { + if (!system.isMacOS) { + return Material( + color: context.colorScheme.surfaceContainer, + child: child, + ); + } + return TransparentMacOSSidebar( + child: Material( + color: Colors.transparent, + child: child, + ), + ); + } + + @override + Widget build(BuildContext context, WidgetRef ref) { + final navigationState = ref.watch(navigationStateProvider); + final navigationItems = navigationState.navigationItems; + final isMobileView = navigationState.viewMode == ViewMode.mobile; + if (isMobileView) { + return child; + } + final currentIndex = navigationState.currentIndex; + final showLabel = ref.watch(appSettingProvider).showLabel; + return Row( + children: [ + Stack( + alignment: Alignment.topRight, + children: [ + _buildBackground( + context: context, + child: Column( + children: [ + SizedBox( + height: 32, + ), + if (!system.isMacOS) ...[ + AppIcon(), + SizedBox( + height: 12, + ), + ], + Expanded( + child: ScrollConfiguration( + behavior: HiddenBarScrollBehavior(), + child: SingleChildScrollView( + child: IntrinsicHeight( + child: NavigationRail( + backgroundColor: Colors.transparent, + selectedLabelTextStyle: + context.textTheme.labelLarge!.copyWith( + color: context.colorScheme.onSurface, + ), + unselectedLabelTextStyle: + context.textTheme.labelLarge!.copyWith( + color: context.colorScheme.onSurface, + ), + destinations: navigationItems + .map( + (e) => NavigationRailDestination( + icon: e.icon, + label: Text( + Intl.message(e.label.name), + ), + ), + ) + .toList(), + onDestinationSelected: (index) { + globalState.appController + .toPage(navigationItems[index].label); + }, + extended: false, + selectedIndex: currentIndex, + labelType: showLabel + ? NavigationRailLabelType.all + : NavigationRailLabelType.none, + ), + ), + ), + ), + ), + const SizedBox( + height: 16, + ), + IconButton( + onPressed: () { + ref.read(appSettingProvider.notifier).updateState( + (state) => state.copyWith( + showLabel: !state.showLabel, + ), + ); + }, + icon: Icon( + Icons.menu, + color: context.colorScheme.onSurfaceVariant, + ), + ), + const SizedBox( + height: 16, + ), + ], + ), + ), + _buildLoading(), + ], + ), + Expanded( + flex: 1, + child: ClipRect( + child: child, + ), + ) + ], + ); + } +} diff --git a/lib/manager/app_state_manager.dart b/lib/manager/app_state_manager.dart deleted file mode 100644 index fa8664b..0000000 --- a/lib/manager/app_state_manager.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'dart:async'; - -import 'package:fl_clash/common/common.dart'; -import 'package:fl_clash/providers/providers.dart'; -import 'package:fl_clash/state.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -class AppStateManager extends ConsumerStatefulWidget { - final Widget child; - - const AppStateManager({ - super.key, - required this.child, - }); - - @override - ConsumerState createState() => _AppStateManagerState(); -} - -class _AppStateManagerState extends ConsumerState - with WidgetsBindingObserver { - @override - void initState() { - super.initState(); - WidgetsBinding.instance.addObserver(this); - ref.listenManual(layoutChangeProvider, (prev, next) { - WidgetsBinding.instance.addPostFrameCallback((_) { - if (prev != next) { - globalState.cacheHeightMap = {}; - } - }); - }); - ref.listenManual( - checkIpProvider, - (prev, next) { - if (prev != next && next.b) { - detectionState.startCheck(); - } - }, - fireImmediately: true, - ); - ref.listenManual(configStateProvider, (prev, next) { - if (prev != next) { - globalState.appController.savePreferencesDebounce(); - } - }); - ref.listenManual( - autoSetSystemDnsStateProvider, - (prev, next) async { - if (prev == next) { - return; - } - if (next.a == true && next.b == true) { - system.setMacOSDns(false); - } else { - system.setMacOSDns(true); - } - }, - ); - } - - @override - reassemble() { - super.reassemble(); - } - - @override - void dispose() async { - await system.setMacOSDns(true); - WidgetsBinding.instance.removeObserver(this); - super.dispose(); - } - - @override - Future didChangeAppLifecycleState(AppLifecycleState state) async { - commonPrint.log("$state"); - if (state == AppLifecycleState.paused || - state == AppLifecycleState.inactive) { - globalState.appController.savePreferences(); - } else { - render?.resume(); - } - } - - @override - void didChangePlatformBrightness() { - globalState.appController.updateBrightness( - WidgetsBinding.instance.platformDispatcher.platformBrightness, - ); - } - - @override - Widget build(BuildContext context) { - return Listener( - onPointerHover: (_) { - render?.resume(); - }, - child: widget.child, - ); - } -} - -class AppEnvManager extends StatelessWidget { - final Widget child; - - const AppEnvManager({ - super.key, - required this.child, - }); - - @override - Widget build(BuildContext context) { - if (kDebugMode) { - if (globalState.isPre) { - return Banner( - message: 'DEBUG', - location: BannerLocation.topEnd, - child: child, - ); - } - } - if (globalState.isPre) { - return Banner( - message: 'PRE', - location: BannerLocation.topEnd, - child: child, - ); - } - return child; - } -} diff --git a/lib/manager/clash_manager.dart b/lib/manager/clash_manager.dart index 10561e8..f21810f 100644 --- a/lib/manager/clash_manager.dart +++ b/lib/manager/clash_manager.dart @@ -74,7 +74,7 @@ class _ClashContainerState extends ConsumerState debouncer.call( FunctionTag.updateDelay, () async { - await appController.updateGroupsDebounce(); + appController.updateGroupsDebounce(); }, duration: const Duration(milliseconds: 5000), ); @@ -90,9 +90,9 @@ class _ClashContainerState extends ConsumerState } @override - void onRequest(Connection connection) async { - ref.read(requestsProvider.notifier).addRequest(connection); - super.onRequest(connection); + void onRequest(TrackerInfo trackerInfo) async { + ref.read(requestsProvider.notifier).addRequest(trackerInfo); + super.onRequest(trackerInfo); } @override @@ -102,7 +102,7 @@ class _ClashContainerState extends ConsumerState providerName, ), ); - await globalState.appController.updateGroupsDebounce(); + globalState.appController.updateGroupsDebounce(); super.onLoaded(providerName); } } diff --git a/lib/manager/hotkey_manager.dart b/lib/manager/hotkey_manager.dart index b44c389..56f3623 100644 --- a/lib/manager/hotkey_manager.dart +++ b/lib/manager/hotkey_manager.dart @@ -35,7 +35,7 @@ class _HotKeyManagerState extends ConsumerState { ); } - _handleHotKeyAction(HotAction action) async { + Future _handleHotKeyAction(HotAction action) async { switch (action) { case HotAction.mode: globalState.appController.updateMode(); @@ -50,7 +50,7 @@ class _HotKeyManagerState extends ConsumerState { } } - _updateHotKeys({ + Future _updateHotKeys({ required List hotKeyActions, }) async { await hotKeyManager.unregisterAll(); @@ -78,7 +78,7 @@ class _HotKeyManagerState extends ConsumerState { await Future.wait(hotkeyActionHandles); } - _buildShortcuts(Widget child) { + Shortcuts _buildShortcuts(Widget child) { return Shortcuts( shortcuts: { utils.controlSingleActivator(LogicalKeyboardKey.keyW): diff --git a/lib/manager/manager.dart b/lib/manager/manager.dart index e8208ca..0dbf611 100644 --- a/lib/manager/manager.dart +++ b/lib/manager/manager.dart @@ -1,11 +1,11 @@ -export 'tray_manager.dart'; -export 'window_manager.dart'; export 'android_manager.dart'; +export 'app_manager.dart'; export 'clash_manager.dart'; -export 'tile_manager.dart'; -export 'app_state_manager.dart'; -export 'vpn_manager.dart'; -export 'proxy_manager.dart'; export 'connectivity_manager.dart'; export 'message_manager.dart'; -export 'theme_manager.dart'; \ No newline at end of file +export 'proxy_manager.dart'; +export 'theme_manager.dart'; +export 'tile_manager.dart'; +export 'tray_manager.dart'; +export 'vpn_manager.dart'; +export 'window_manager.dart'; diff --git a/lib/manager/message_manager.dart b/lib/manager/message_manager.dart index d5b53a3..1a911e8 100644 --- a/lib/manager/message_manager.dart +++ b/lib/manager/message_manager.dart @@ -44,7 +44,7 @@ class MessageManagerState extends State { await _showMessage(); } - _showMessage() async { + Future _showMessage() async { if (_pushing == true) { return; } @@ -65,7 +65,7 @@ class MessageManagerState extends State { } } - _handleRemove(CommonMessage commonMessage) async { + Future _handleRemove(CommonMessage commonMessage) async { _messagesNotifier.value = List.from(_messagesNotifier.value) ..remove(commonMessage); } @@ -91,7 +91,7 @@ class MessageManagerState extends State { key: Key(messages.last.id), builder: (_, constraints) { return Card( - shape: const RoundedSuperellipseBorder( + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular(12.0), ), diff --git a/lib/manager/proxy_manager.dart b/lib/manager/proxy_manager.dart index 5edd356..8b5bac8 100644 --- a/lib/manager/proxy_manager.dart +++ b/lib/manager/proxy_manager.dart @@ -14,7 +14,7 @@ class ProxyManager extends ConsumerStatefulWidget { } class _ProxyManagerState extends ConsumerState { - _updateProxy(ProxyState proxyState) async { + Future _updateProxy(ProxyState proxyState) async { final isStart = proxyState.isStart; final systemProxy = proxyState.systemProxy; final port = proxyState.port; diff --git a/lib/manager/theme_manager.dart b/lib/manager/theme_manager.dart index c6a8982..d744648 100644 --- a/lib/manager/theme_manager.dart +++ b/lib/manager/theme_manager.dart @@ -1,12 +1,15 @@ import 'dart:math'; -import 'package:fl_clash/common/constant.dart'; -import 'package:fl_clash/common/measure.dart'; + +import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/common/theme.dart'; import 'package:fl_clash/providers/config.dart'; import 'package:fl_clash/state.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../providers/state.dart'; + class ThemeManager extends ConsumerWidget { final Widget child; @@ -15,6 +18,54 @@ class ThemeManager extends ConsumerWidget { required this.child, }); + Widget _buildSystemUi(Widget child) { + if (!system.isAndroid) { + return child; + } + return AnnotatedRegion( + sized: false, + value: SystemUiMode.edgeToEdge, + child: Consumer( + builder: (context, ref, _) { + final brightness = ref.watch(currentBrightnessProvider); + final iconBrightness = brightness == Brightness.light + ? Brightness.dark + : Brightness.light; + globalState.appState = globalState.appState.copyWith( + systemUiOverlayStyle: SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + statusBarIconBrightness: iconBrightness, + systemNavigationBarIconBrightness: iconBrightness, + systemNavigationBarColor: context.colorScheme.surface, + systemNavigationBarDividerColor: Colors.transparent, + ), + ); + return AnnotatedRegion( + value: globalState.appState.systemUiOverlayStyle, + sized: false, + child: child, + ); + }, + ), + ); + } + + // _buildScrollbar(Widget child) { + // return Consumer( + // builder: (_, ref, child) { + // final isMobileView = ref.read(isMobileViewProvider); + // if (isMobileView) { + // return ScrollConfiguration( + // behavior: HiddenBarScrollBehavior(), + // child: child!, + // ); + // } + // return child!; + // }, + // child: child, + // ); + // } + @override Widget build(BuildContext context, ref) { final textScale = ref.read( @@ -49,7 +100,7 @@ class ThemeManager extends ConsumerWidget { container.maxHeight, ), ); - return child; + return _buildSystemUi(child); }, ), ); diff --git a/lib/manager/tray_manager.dart b/lib/manager/tray_manager.dart index fb3017a..61ab743 100755 --- a/lib/manager/tray_manager.dart +++ b/lib/manager/tray_manager.dart @@ -39,7 +39,7 @@ class _TrayContainerState extends ConsumerState with TrayListener { @override void onTrayIconRightMouseDown() { - trayManager.popUpContextMenu(); + trayManager.popUpContextMenu(bringAppToFront: true); } @override diff --git a/lib/manager/vpn_manager.dart b/lib/manager/vpn_manager.dart index de56a9f..869f19a 100644 --- a/lib/manager/vpn_manager.dart +++ b/lib/manager/vpn_manager.dart @@ -27,7 +27,7 @@ class _VpnContainerState extends ConsumerState { }); } - showTip() { + void showTip() { debouncer.call( FunctionTag.vpnTip, () { diff --git a/lib/manager/window_manager.dart b/lib/manager/window_manager.dart index 3731346..ff45574 100644 --- a/lib/manager/window_manager.dart +++ b/lib/manager/window_manager.dart @@ -1,10 +1,8 @@ import 'dart:async'; -import 'dart:io'; import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/enum/enum.dart'; -import 'package:fl_clash/providers/app.dart'; -import 'package:fl_clash/providers/config.dart'; +import 'package:fl_clash/providers/providers.dart'; import 'package:fl_clash/state.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -59,7 +57,7 @@ class _WindowContainerState extends ConsumerState @override void onWindowFocus() { super.onWindowFocus(); - commonPrint.log("focus"); + commonPrint.log('focus'); render?.resume(); } @@ -96,14 +94,14 @@ class _WindowContainerState extends ConsumerState @override void onWindowMinimize() async { globalState.appController.savePreferencesDebounce(); - commonPrint.log("minimize"); + commonPrint.log('minimize'); render?.pause(); super.onWindowMinimize(); } @override void onWindowRestore() { - commonPrint.log("restore"); + commonPrint.log('restore'); render?.resume(); super.onWindowRestore(); } @@ -128,8 +126,9 @@ class WindowHeaderContainer extends StatelessWidget { Widget build(BuildContext context) { return Consumer( builder: (_, ref, child) { + final isMobileView = ref.watch(isMobileViewProvider); final version = ref.watch(versionProvider); - if (version <= 10 && Platform.isMacOS) { + if ((version <= 10 || !isMobileView) && system.isMacOS) { return child!; } return Stack( @@ -171,7 +170,7 @@ class _WindowHeaderState extends State { _initNotifier(); } - _initNotifier() async { + Future _initNotifier() async { isMaximizedNotifier.value = await windowManager.isMaximized(); isPinNotifier.value = await windowManager.isAlwaysOnTop(); } @@ -183,7 +182,7 @@ class _WindowHeaderState extends State { super.dispose(); } - _updateMaximized() async { + Future _updateMaximized() async { final isMaximized = await windowManager.isMaximized(); switch (isMaximized) { case true: @@ -196,13 +195,13 @@ class _WindowHeaderState extends State { isMaximizedNotifier.value = await windowManager.isMaximized(); } - _updatePin() async { + Future _updatePin() async { final isAlwaysOnTop = await windowManager.isAlwaysOnTop(); await windowManager.setAlwaysOnTop(!isAlwaysOnTop); isPinNotifier.value = await windowManager.isAlwaysOnTop(); } - _buildActions() { + Widget _buildActions() { return Row( children: [ IconButton( @@ -280,15 +279,11 @@ class _WindowHeaderState extends State { ), ), ), - if (Platform.isMacOS) + if (system.isMacOS) const Text( appName, ) else ...[ - const Positioned( - left: 0, - child: AppIcon(), - ), Positioned( right: 0, child: _buildActions(), @@ -306,24 +301,18 @@ class AppIcon extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - margin: const EdgeInsets.only(left: 8), - child: const Row( - children: [ - SizedBox( - width: 24, - height: 24, - child: CircleAvatar( - foregroundImage: AssetImage("assets/images/icon.png"), - backgroundColor: Colors.transparent, - ), - ), - SizedBox( - width: 8, - ), - Text( - appName, - ), - ], + decoration: BoxDecoration( + color: context.colorScheme.primaryContainer, + borderRadius: BorderRadius.circular(12), + ), + padding: EdgeInsets.all(6), + child: SizedBox( + width: 28, + height: 28, + child: CircleAvatar( + foregroundImage: AssetImage('assets/images/icon.png'), + backgroundColor: Colors.transparent, + ), ), ); } diff --git a/lib/models/app.dart b/lib/models/app.dart index 0ff39ac..b007908 100644 --- a/lib/models/app.dart +++ b/lib/models/app.dart @@ -1,6 +1,6 @@ import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/enum/enum.dart'; -import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'common.dart'; @@ -22,17 +22,18 @@ class AppState with _$AppState { @Default({}) DelayMap delayMap, @Default([]) List groups, @Default(0) int checkIpNum, - Brightness? brightness, + required Brightness brightness, int? runTime, @Default([]) List providers, String? localIp, - required FixedList requests, + required FixedList requests, required int version, required FixedList logs, required FixedList traffics, required Traffic totalTraffic, - @Default("") String proxiesQuery, @Default(false) bool realTunEnable, + @Default(false) bool loading, + required SystemUiOverlayStyle systemUiOverlayStyle, }) = _AppState; } diff --git a/lib/models/clash_config.dart b/lib/models/clash_config.dart index 9f63160..0d6ef8a 100644 --- a/lib/models/clash_config.dart +++ b/lib/models/clash_config.dart @@ -19,88 +19,88 @@ const defaultMixedPort = 7890; const defaultKeepAliveInterval = 30; const defaultBypassPrivateRouteAddress = [ - "1.0.0.0/8", - "2.0.0.0/7", - "4.0.0.0/6", - "8.0.0.0/7", - "11.0.0.0/8", - "12.0.0.0/6", - "16.0.0.0/4", - "32.0.0.0/3", - "64.0.0.0/3", - "96.0.0.0/4", - "112.0.0.0/5", - "120.0.0.0/6", - "124.0.0.0/7", - "126.0.0.0/8", - "128.0.0.0/3", - "160.0.0.0/5", - "168.0.0.0/8", - "169.0.0.0/9", - "169.128.0.0/10", - "169.192.0.0/11", - "169.224.0.0/12", - "169.240.0.0/13", - "169.248.0.0/14", - "169.252.0.0/15", - "169.255.0.0/16", - "170.0.0.0/7", - "172.0.0.0/12", - "172.32.0.0/11", - "172.64.0.0/10", - "172.128.0.0/9", - "173.0.0.0/8", - "174.0.0.0/7", - "176.0.0.0/4", - "192.0.0.0/9", - "192.128.0.0/11", - "192.160.0.0/13", - "192.169.0.0/16", - "192.170.0.0/15", - "192.172.0.0/14", - "192.176.0.0/12", - "192.192.0.0/10", - "193.0.0.0/8", - "194.0.0.0/7", - "196.0.0.0/6", - "200.0.0.0/5", - "208.0.0.0/4", - "240.0.0.0/5", - "248.0.0.0/6", - "252.0.0.0/7", - "254.0.0.0/8", - "255.0.0.0/9", - "255.128.0.0/10", - "255.192.0.0/11", - "255.224.0.0/12", - "255.240.0.0/13", - "255.248.0.0/14", - "255.252.0.0/15", - "255.254.0.0/16", - "255.255.0.0/17", - "255.255.128.0/18", - "255.255.192.0/19", - "255.255.224.0/20", - "255.255.240.0/21", - "255.255.248.0/22", - "255.255.252.0/23", - "255.255.254.0/24", - "255.255.255.0/25", - "255.255.255.128/26", - "255.255.255.192/27", - "255.255.255.224/28", - "255.255.255.240/29", - "255.255.255.248/30", - "255.255.255.252/31", - "255.255.255.254/32", - "::/1", - "8000::/2", - "c000::/3", - "e000::/4", - "f000::/5", - "f800::/6", - "fe00::/9", - "fec0::/10" + '1.0.0.0/8', + '2.0.0.0/7', + '4.0.0.0/6', + '8.0.0.0/7', + '11.0.0.0/8', + '12.0.0.0/6', + '16.0.0.0/4', + '32.0.0.0/3', + '64.0.0.0/3', + '96.0.0.0/4', + '112.0.0.0/5', + '120.0.0.0/6', + '124.0.0.0/7', + '126.0.0.0/8', + '128.0.0.0/3', + '160.0.0.0/5', + '168.0.0.0/8', + '169.0.0.0/9', + '169.128.0.0/10', + '169.192.0.0/11', + '169.224.0.0/12', + '169.240.0.0/13', + '169.248.0.0/14', + '169.252.0.0/15', + '169.255.0.0/16', + '170.0.0.0/7', + '172.0.0.0/12', + '172.32.0.0/11', + '172.64.0.0/10', + '172.128.0.0/9', + '173.0.0.0/8', + '174.0.0.0/7', + '176.0.0.0/4', + '192.0.0.0/9', + '192.128.0.0/11', + '192.160.0.0/13', + '192.169.0.0/16', + '192.170.0.0/15', + '192.172.0.0/14', + '192.176.0.0/12', + '192.192.0.0/10', + '193.0.0.0/8', + '194.0.0.0/7', + '196.0.0.0/6', + '200.0.0.0/5', + '208.0.0.0/4', + '240.0.0.0/5', + '248.0.0.0/6', + '252.0.0.0/7', + '254.0.0.0/8', + '255.0.0.0/9', + '255.128.0.0/10', + '255.192.0.0/11', + '255.224.0.0/12', + '255.240.0.0/13', + '255.248.0.0/14', + '255.252.0.0/15', + '255.254.0.0/16', + '255.255.0.0/17', + '255.255.128.0/18', + '255.255.192.0/19', + '255.255.224.0/20', + '255.255.240.0/21', + '255.255.248.0/22', + '255.255.252.0/23', + '255.255.254.0/24', + '255.255.255.0/25', + '255.255.255.128/26', + '255.255.255.192/27', + '255.255.255.224/28', + '255.255.255.240/29', + '255.255.255.248/30', + '255.255.255.252/31', + '255.255.255.254/32', + '::/1', + '8000::/2', + 'c000::/3', + 'e000::/4', + 'f000::/5', + 'f800::/6', + 'fe00::/9', + 'fec0::/10' ]; @freezed @@ -117,11 +117,11 @@ class ProxyGroup with _$ProxyGroup { bool? lazy, String? url, int? timeout, - @JsonKey(name: "max-failed-times") int? maxFailedTimes, + @JsonKey(name: 'max-failed-times') int? maxFailedTimes, String? filter, - @JsonKey(name: "expected-filter") String? excludeFilter, - @JsonKey(name: "exclude-type") String? excludeType, - @JsonKey(name: "expected-status") dynamic expectedStatus, + @JsonKey(name: 'expected-filter') String? excludeFilter, + @JsonKey(name: 'exclude-type') String? excludeType, + @JsonKey(name: 'expected-status') dynamic expectedStatus, bool? hidden, String? icon, }) = _ProxyGroup; @@ -144,15 +144,15 @@ class RuleProvider with _$RuleProvider { class Sniffer with _$Sniffer { const factory Sniffer({ @Default(false) bool enable, - @Default(true) @JsonKey(name: "override-destination") bool overrideDest, + @Default(true) @JsonKey(name: 'override-destination') bool overrideDest, @Default([]) List sniffing, - @Default([]) @JsonKey(name: "force-domain") List forceDomain, - @Default([]) @JsonKey(name: "skip-src-address") List skipSrcAddress, - @Default([]) @JsonKey(name: "skip-dst-address") List skipDstAddress, - @Default([]) @JsonKey(name: "skip-domain") List skipDomain, - @Default([]) @JsonKey(name: "port-whitelist") List port, - @Default(true) @JsonKey(name: "force-dns-mapping") bool forceDnsMapping, - @Default(true) @JsonKey(name: "parse-pure-ip") bool parsePureIp, + @Default([]) @JsonKey(name: 'force-domain') List forceDomain, + @Default([]) @JsonKey(name: 'skip-src-address') List skipSrcAddress, + @Default([]) @JsonKey(name: 'skip-dst-address') List skipDstAddress, + @Default([]) @JsonKey(name: 'skip-domain') List skipDomain, + @Default([]) @JsonKey(name: 'port-whitelist') List port, + @Default(true) @JsonKey(name: 'force-dns-mapping') bool forceDnsMapping, + @Default(true) @JsonKey(name: 'parse-pure-ip') bool parsePureIp, @Default({}) Map sniff, }) = _Sniffer; @@ -168,7 +168,7 @@ List _formJsonPorts(List? ports) { class SnifferConfig with _$SnifferConfig { const factory SnifferConfig({ @Default([]) @JsonKey(fromJson: _formJsonPorts) List ports, - @JsonKey(name: "override-destination") bool? overrideDest, + @JsonKey(name: 'override-destination') bool? overrideDest, }) = _SnifferConfig; factory SnifferConfig.fromJson(Map json) => @@ -180,10 +180,10 @@ class Tun with _$Tun { const factory Tun({ @Default(false) bool enable, @Default(appName) String device, - @JsonKey(name: "auto-route") @Default(false) bool autoRoute, + @JsonKey(name: 'auto-route') @Default(false) bool autoRoute, @Default(TunStack.mixed) TunStack stack, - @JsonKey(name: "dns-hijack") @Default(["any:53"]) List dnsHijack, - @JsonKey(name: "route-address") @Default([]) List routeAddress, + @JsonKey(name: 'dns-hijack') @Default(['any:53']) List dnsHijack, + @JsonKey(name: 'route-address') @Default([]) List routeAddress, }) = _Tun; factory Tun.fromJson(Map json) => _$TunFromJson(json); @@ -222,13 +222,13 @@ extension TunExt on Tun { class FallbackFilter with _$FallbackFilter { const factory FallbackFilter({ @Default(true) bool geoip, - @Default("CN") @JsonKey(name: "geoip-code") String geoipCode, - @Default(["gfw"]) List geosite, - @Default(["240.0.0.0/4"]) List ipcidr, + @Default('CN') @JsonKey(name: 'geoip-code') String geoipCode, + @Default(['gfw']) List geosite, + @Default(['240.0.0.0/4']) List ipcidr, @Default([ - "+.google.com", - "+.facebook.com", - "+.youtube.com", + '+.google.com', + '+.facebook.com', + '+.youtube.com', ]) List domain, }) = _FallbackFilter; @@ -241,51 +241,51 @@ class FallbackFilter with _$FallbackFilter { class Dns with _$Dns { const factory Dns({ @Default(true) bool enable, - @Default("0.0.0.0:1053") String listen, - @Default(false) @JsonKey(name: "prefer-h3") bool preferH3, - @Default(true) @JsonKey(name: "use-hosts") bool useHosts, - @Default(true) @JsonKey(name: "use-system-hosts") bool useSystemHosts, - @Default(false) @JsonKey(name: "respect-rules") bool respectRules, + @Default('0.0.0.0:1053') String listen, + @Default(false) @JsonKey(name: 'prefer-h3') bool preferH3, + @Default(true) @JsonKey(name: 'use-hosts') bool useHosts, + @Default(true) @JsonKey(name: 'use-system-hosts') bool useSystemHosts, + @Default(false) @JsonKey(name: 'respect-rules') bool respectRules, @Default(false) bool ipv6, - @Default(["223.5.5.5"]) - @JsonKey(name: "default-nameserver") + @Default(['223.5.5.5']) + @JsonKey(name: 'default-nameserver') List defaultNameserver, @Default(DnsMode.fakeIp) - @JsonKey(name: "enhanced-mode") + @JsonKey(name: 'enhanced-mode') DnsMode enhancedMode, - @Default("198.18.0.1/16") - @JsonKey(name: "fake-ip-range") + @Default('198.18.0.1/16') + @JsonKey(name: 'fake-ip-range') String fakeIpRange, @Default([ - "*.lan", - "localhost.ptlogin2.qq.com", + '*.lan', + 'localhost.ptlogin2.qq.com', ]) - @JsonKey(name: "fake-ip-filter") + @JsonKey(name: 'fake-ip-filter') List fakeIpFilter, @Default({ - "www.baidu.com": "114.114.114.114", - "+.internal.crop.com": "10.0.0.1", - "geosite:cn": "https://doh.pub/dns-query" + 'www.baidu.com': '114.114.114.114', + '+.internal.crop.com': '10.0.0.1', + 'geosite:cn': 'https://doh.pub/dns-query' }) - @JsonKey(name: "nameserver-policy") + @JsonKey(name: 'nameserver-policy') Map nameserverPolicy, @Default([ - "https://doh.pub/dns-query", - "https://dns.alidns.com/dns-query", + 'https://doh.pub/dns-query', + 'https://dns.alidns.com/dns-query', ]) List nameserver, @Default([ - "tls://8.8.4.4", - "tls://1.1.1.1", + 'tls://8.8.4.4', + 'tls://1.1.1.1', ]) List fallback, @Default([ - "https://doh.pub/dns-query", + 'https://doh.pub/dns-query', ]) - @JsonKey(name: "proxy-server-nameserver") + @JsonKey(name: 'proxy-server-nameserver') List proxyServerNameserver, @Default(FallbackFilter()) - @JsonKey(name: "fallback-filter") + @JsonKey(name: 'fallback-filter') FallbackFilter fallbackFilter, }) = _Dns; @@ -304,19 +304,19 @@ class Dns with _$Dns { class GeoXUrl with _$GeoXUrl { const factory GeoXUrl({ @Default( - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb', ) String mmdb, @Default( - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb', ) String asn, @Default( - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat', ) String geoip, @Default( - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat', ) String geosite, }) = _GeoXUrl; @@ -349,10 +349,10 @@ class ParsedRule with _$ParsedRule { }) = _ParsedRule; factory ParsedRule.parseString(String value) { - final splits = value.split(","); + final splits = value.split(','); final shortSplits = splits .where( - (item) => !item.contains("src") && !item.contains("no-resolve"), + (item) => !item.contains('src') && !item.contains('no-resolve'), ) .toList(); final ruleAction = RuleAction.values.firstWhere( @@ -372,17 +372,17 @@ class ParsedRule with _$ParsedRule { String? ruleProvider; if (ruleAction == RuleAction.RULE_SET) { - ruleProvider = shortSplits.sublist(1, shortSplits.length - 1).join(","); + ruleProvider = shortSplits.sublist(1, shortSplits.length - 1).join(','); } else { - content = shortSplits.sublist(1, shortSplits.length - 1).join(","); + content = shortSplits.sublist(1, shortSplits.length - 1).join(','); } return ParsedRule( ruleAction: ruleAction, content: content, - src: splits.contains("src"), + src: splits.contains('src'), ruleProvider: ruleProvider, - noResolve: splits.contains("no-resolve"), + noResolve: splits.contains('no-resolve'), subRule: subRule, ruleTarget: ruleTarget, ); @@ -396,10 +396,10 @@ extension ParsedRuleExt on ParsedRule { ruleAction == RuleAction.RULE_SET ? ruleProvider : content, ruleAction == RuleAction.SUB_RULE ? subRule : ruleTarget, if (ruleAction.hasParams) ...[ - if (src) "src", - if (noResolve) "no-resolve", + if (src) 'src', + if (noResolve) 'no-resolve', ] - ].join(","); + ].join(','); } } @@ -430,7 +430,7 @@ class SubRule with _$SubRule { _$SubRuleFromJson(json); } -_genRule(List? rules) { +List _genRule(List? rules) { if (rules == null) { return []; } @@ -458,12 +458,12 @@ List _genSubRules(Map json) { @freezed class ClashConfigSnippet with _$ClashConfigSnippet { const factory ClashConfigSnippet({ - @Default([]) @JsonKey(name: "proxy-groups") List proxyGroups, - @JsonKey(fromJson: _genRule, name: "rules") @Default([]) List rule, - @JsonKey(name: "rule-providers", fromJson: _genRuleProviders) + @Default([]) @JsonKey(name: 'proxy-groups') List proxyGroups, + @JsonKey(fromJson: _genRule, name: 'rules') @Default([]) List rule, + @JsonKey(name: 'rule-providers', fromJson: _genRuleProviders) @Default([]) List ruleProvider, - @JsonKey(name: "sub-rules", fromJson: _genSubRules) + @JsonKey(name: 'sub-rules', fromJson: _genSubRules) @Default([]) List subRules, }) = _ClashConfigSnippet; @@ -475,39 +475,39 @@ class ClashConfigSnippet with _$ClashConfigSnippet { @freezed class ClashConfig with _$ClashConfig { const factory ClashConfig({ - @Default(defaultMixedPort) @JsonKey(name: "mixed-port") int mixedPort, - @Default(0) @JsonKey(name: "socks-port") int socksPort, - @Default(0) @JsonKey(name: "port") int port, - @Default(0) @JsonKey(name: "redir-port") int redirPort, - @Default(0) @JsonKey(name: "tproxy-port") int tproxyPort, + @Default(defaultMixedPort) @JsonKey(name: 'mixed-port') int mixedPort, + @Default(0) @JsonKey(name: 'socks-port') int socksPort, + @Default(0) @JsonKey(name: 'port') int port, + @Default(0) @JsonKey(name: 'redir-port') int redirPort, + @Default(0) @JsonKey(name: 'tproxy-port') int tproxyPort, @Default(Mode.rule) Mode mode, - @Default(false) @JsonKey(name: "allow-lan") bool allowLan, - @Default(LogLevel.error) @JsonKey(name: "log-level") LogLevel logLevel, + @Default(false) @JsonKey(name: 'allow-lan') bool allowLan, + @Default(LogLevel.error) @JsonKey(name: 'log-level') LogLevel logLevel, @Default(false) bool ipv6, @Default(FindProcessMode.off) @JsonKey( - name: "find-process-mode", + name: 'find-process-mode', unknownEnumValue: FindProcessMode.always, ) FindProcessMode findProcessMode, @Default(defaultKeepAliveInterval) - @JsonKey(name: "keep-alive-interval") + @JsonKey(name: 'keep-alive-interval') int keepAliveInterval, - @Default(true) @JsonKey(name: "unified-delay") bool unifiedDelay, - @Default(true) @JsonKey(name: "tcp-concurrent") bool tcpConcurrent, + @Default(true) @JsonKey(name: 'unified-delay') bool unifiedDelay, + @Default(true) @JsonKey(name: 'tcp-concurrent') bool tcpConcurrent, @Default(defaultTun) @JsonKey(fromJson: Tun.safeFormJson) Tun tun, @Default(defaultDns) @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, @Default(defaultGeoXUrl) - @JsonKey(name: "geox-url", fromJson: GeoXUrl.safeFormJson) + @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, @Default(GeodataLoader.memconservative) - @JsonKey(name: "geodata-loader") + @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, - @Default([]) @JsonKey(name: "proxy-groups") List proxyGroups, + @Default([]) @JsonKey(name: 'proxy-groups') List proxyGroups, @Default([]) List rule, - @JsonKey(name: "global-ua") String? globalUa, + @JsonKey(name: 'global-ua') String? globalUa, @Default(ExternalControllerStatus.close) - @JsonKey(name: "external-controller") + @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, @Default({}) HostsMap hosts, }) = _ClashConfig; diff --git a/lib/models/common.dart b/lib/models/common.dart index 39b8c9e..fdccd66 100644 --- a/lib/models/common.dart +++ b/lib/models/common.dart @@ -16,7 +16,7 @@ class NavigationItem with _$NavigationItem { required Icon icon, required PageLabel label, final String? description, - required Widget view, + required WidgetBuilder builder, @Default(true) bool keep, String? path, @Default([NavigationItemMode.mobile, NavigationItemMode.desktop]) @@ -41,15 +41,23 @@ class Package with _$Package { @freezed class Metadata with _$Metadata { const factory Metadata({ - required int uid, - required String network, - required String sourceIP, - required String sourcePort, - required String destinationIP, - required String destinationPort, - required String host, - required String process, - required String remoteDestination, + @Default(0) int uid, + @Default('') String network, + @Default('') String sourceIP, + @Default('') String sourcePort, + @Default('') String destinationIP, + @Default('') String destinationPort, + @Default('') String host, + DnsMode? dnsMode, + @Default('') String process, + @Default('') String processPath, + @Default('') String remoteDestination, + @Default([]) List sourceGeoIP, + @Default([]) List destinationGeoIP, + @Default('') String destinationIPASN, + @Default('') String sourceIPASN, + @Default('') String specialRules, + @Default('') String specialProxy, }) = _Metadata; factory Metadata.fromJson(Map json) => @@ -57,35 +65,48 @@ class Metadata with _$Metadata { } @freezed -class Connection with _$Connection { - const factory Connection({ +class TrackerInfo with _$TrackerInfo { + const factory TrackerInfo({ required String id, - num? upload, - num? download, + @Default(0) int upload, + @Default(0) int download, required DateTime start, required Metadata metadata, required List chains, - }) = _Connection; + required String rule, + required String rulePayload, + int? downloadSpeed, + int? uploadSpeed, + }) = _TrackerInfo; - factory Connection.fromJson(Map json) => - _$ConnectionFromJson(json); + factory TrackerInfo.fromJson(Map json) => + _$TrackerInfoFromJson(json); } -extension ConnectionExt on Connection { +extension TrackerInfoExt on TrackerInfo { String get desc { - var text = "${metadata.network}://"; + var text = '${metadata.network}://'; final ips = [ metadata.host, metadata.destinationIP, ].where((ip) => ip.isNotEmpty); - text += ips.join("/"); - text += ":${metadata.destinationPort}"; + text += ips.join('/'); + text += ':${metadata.destinationPort}'; return text; } + + String get progressText { + final process = metadata.process; + final uid = metadata.uid; + if (uid != 0) { + return '$process($uid)'; + } + return process; + } } -String _logDateTime(_) { - return DateTime.now().toString(); +String _logDateTime(dynamic _) { + return DateTime.now().showFull; } // String _logId(_) { @@ -95,8 +116,9 @@ String _logDateTime(_) { @freezed class Log with _$Log { const factory Log({ - @JsonKey(name: "LogLevel") @Default(LogLevel.app) LogLevel logLevel, - @JsonKey(name: "Payload") @Default("") String payload, + // @JsonKey(fromJson: _logId) required String id, + @JsonKey(name: 'LogLevel') @Default(LogLevel.info) LogLevel logLevel, + @JsonKey(name: 'Payload') @Default('') String payload, @JsonKey(fromJson: _logDateTime) required String dateTime, }) = _Log; @@ -118,8 +140,8 @@ class LogsState with _$LogsState { const factory LogsState({ @Default([]) List logs, @Default([]) List keywords, - @Default("") String query, - @Default(false) bool loading, + @Default('') String query, + @Default(true) bool autoScrollToEnd, }) = _LogsState; } @@ -138,27 +160,28 @@ extension LogsStateExt on LogsState { } @freezed -class ConnectionsState with _$ConnectionsState { - const factory ConnectionsState({ - @Default([]) List connections, +class TrackerInfosState with _$TrackerInfosState { + const factory TrackerInfosState({ + @Default([]) List trackerInfos, @Default([]) List keywords, - @Default("") String query, - @Default(false) bool loading, - }) = _ConnectionsState; + @Default('') String query, + @Default(true) bool autoScrollToEnd, + }) = _TrackerInfosState; } -extension ConnectionsStateExt on ConnectionsState { - List get list { +extension TrackerInfosStateExt on TrackerInfosState { + List get list { final lowerQuery = query.toLowerCase().trim(); final lowQuery = query.toLowerCase(); - return connections.where((connection) { - final chains = connection.chains; - final process = connection.metadata.process; - final networkText = connection.metadata.network.toLowerCase(); - final hostText = connection.metadata.host.toLowerCase(); - final destinationIPText = connection.metadata.destinationIP.toLowerCase(); - final processText = connection.metadata.process.toLowerCase(); - final chainsText = chains.join("").toLowerCase(); + return trackerInfos.where((trackerInfo) { + final chains = trackerInfo.chains; + final process = trackerInfo.metadata.process; + final networkText = trackerInfo.metadata.network.toLowerCase(); + final hostText = trackerInfo.metadata.host.toLowerCase(); + final destinationIPText = + trackerInfo.metadata.destinationIP.toLowerCase(); + final processText = trackerInfo.metadata.process.toLowerCase(); + final chainsText = chains.join('').toLowerCase(); return {...chains, process}.containsAll(keywords) && (networkText.contains(lowerQuery) || hostText.contains(lowerQuery) || @@ -169,7 +192,7 @@ extension ConnectionsStateExt on ConnectionsState { } } -const defaultDavFileName = "backup.zip"; +const defaultDavFileName = 'backup.zip'; @freezed class DAV with _$DAV { @@ -193,14 +216,14 @@ class FileInfo with _$FileInfo { extension FileInfoExt on FileInfo { String get desc => - "${TrafficValue(value: size).show} · ${lastModified.lastUpdateTimeDesc}"; + '${TrafficValue(value: size).show} · ${lastModified.lastUpdateTimeDesc}'; } @freezed class VersionInfo with _$VersionInfo { const factory VersionInfo({ - @Default("") String clashName, - @Default("") String version, + @Default('') String clashName, + @Default('') String version, }) = _VersionInfo; factory VersionInfo.fromJson(Map json) => @@ -226,6 +249,10 @@ class Traffic { ); } + String toSpeedText() { + return '↑ $up/s ↓ $down/s'; + } + @override String toString() { return '$up↑ $down↓'; @@ -274,7 +301,7 @@ class Group with _$Group { String? now, bool? hidden, String? testUrl, - @Default("") String icon, + @Default('') String icon, required String name, }) = _Group; @@ -289,7 +316,7 @@ extension GroupsExt on List { } extension GroupExt on Group { - String get realNow => now ?? ""; + String get realNow => now ?? ''; String getCurrentSelectedName(String proxyName) { if (type.isComputedSelected) { @@ -307,10 +334,10 @@ class TrafficValue { int get value => _value; - String get show => "$showValue $showUnit"; + String get show => '$showValue $showUnit'; String get shortShow => - "${trafficValueShow.value.fixed(decimals: 1)} $showUnit"; + '${trafficValueShow.value.fixed(decimals: 1)} $showUnit'; String get showValue => trafficValueShow.value.fixed(); @@ -347,7 +374,7 @@ class TrafficValue { @override String toString() { - return "$showValue$showUnit"; + return '$showValue$showUnit'; } @override @@ -411,56 +438,56 @@ class IpInfo { static IpInfo fromIpInfoIoJson(Map json) { return switch (json) { { - "ip": final String ip, - "country": final String country, + 'ip': final String ip, + 'country': final String country, } => IpInfo( ip: ip, countryCode: country, ), - _ => throw const FormatException("invalid json"), + _ => throw const FormatException('invalid json'), }; } static IpInfo fromIpApiCoJson(Map json) { return switch (json) { { - "ip": final String ip, - "country_code": final String countryCode, + 'ip': final String ip, + 'country_code': final String countryCode, } => IpInfo( ip: ip, countryCode: countryCode, ), - _ => throw const FormatException("invalid json"), + _ => throw const FormatException('invalid json'), }; } static IpInfo fromIpSbJson(Map json) { return switch (json) { { - "ip": final String ip, - "country_code": final String countryCode, + 'ip': final String ip, + 'country_code': final String countryCode, } => IpInfo( ip: ip, countryCode: countryCode, ), - _ => throw const FormatException("invalid json"), + _ => throw const FormatException('invalid json'), }; } static IpInfo fromIpwhoIsJson(Map json) { return switch (json) { { - "ip": final String ip, - "country_code": final String countryCode, + 'ip': final String ip, + 'country_code': final String countryCode, } => IpInfo( ip: ip, countryCode: countryCode, ), - _ => throw const FormatException("invalid json"), + _ => throw const FormatException('invalid json'), }; } @@ -539,7 +566,7 @@ class Result with _$Result { factory Result.success(T data) => Result( data: data, type: ResultType.success, - message: "", + message: '', ); factory Result.error(String message) => Result( diff --git a/lib/models/config.dart b/lib/models/config.dart index 42352c5..51b377d 100644 --- a/lib/models/config.dart +++ b/lib/models/config.dart @@ -11,23 +11,23 @@ part 'generated/config.freezed.dart'; part 'generated/config.g.dart'; const defaultBypassDomain = [ - "*zhihu.com", - "*zhimg.com", - "*jd.com", - "100ime-iat-api.xfyun.cn", - "*360buyimg.com", - "localhost", - "*.local", - "127.*", - "10.*", - "172.16.*", - "172.17.*", - "172.18.*", - "172.19.*", - "172.2*", - "172.30.*", - "172.31.*", - "192.168.*" + '*zhihu.com', + '*zhimg.com', + '*jd.com', + '100ime-iat-api.xfyun.cn', + '*360buyimg.com', + 'localhost', + '*.local', + '127.*', + '10.*', + '172.16.*', + '172.17.*', + '172.18.*', + '172.19.*', + '172.2*', + '172.30.*', + '172.31.*', + '192.168.*' ]; const defaultAppSettingProps = AppSettingProps(); @@ -178,8 +178,8 @@ class ProxiesStyle with _$ProxiesStyle { @freezed class TextScale with _$TextScale { const factory TextScale({ - @Default(false) enable, - @Default(1.0) scale, + @Default(false) bool enable, + @Default(1.0) double scale, }) = _TextScale; factory TextScale.fromJson(Map json) => @@ -265,12 +265,12 @@ class Config with _$Config { factory Config.compatibleFromJson(Map json) { try { - final accessControlMap = json["accessControl"]; - final isAccessControl = json["isAccessControl"]; + final accessControlMap = json['accessControl']; + final isAccessControl = json['isAccessControl']; if (accessControlMap != null) { - (accessControlMap as Map)["enable"] = isAccessControl; - if (json["vpnProps"] != null) { - (json["vpnProps"] as Map)["accessControl"] = accessControlMap; + (accessControlMap as Map)['enable'] = isAccessControl; + if (json['vpnProps'] != null) { + (json['vpnProps'] as Map)['accessControl'] = accessControlMap; } } } catch (_) {} diff --git a/lib/models/core.dart b/lib/models/core.dart index 52addb4..5e70b32 100644 --- a/lib/models/core.dart +++ b/lib/models/core.dart @@ -12,7 +12,7 @@ abstract mixin class AppMessageListener { void onDelay(Delay delay) {} - void onRequest(Connection connection) {} + void onRequest(TrackerInfo connection) {} void onLoaded(String providerName) {} } @@ -26,9 +26,9 @@ abstract mixin class AppMessageListener { @freezed class SetupParams with _$SetupParams { const factory SetupParams({ - @JsonKey(name: "config") required Map config, - @JsonKey(name: "selected-map") required Map selectedMap, - @JsonKey(name: "test-url") required String testUrl, + @JsonKey(name: 'config') required Map config, + @JsonKey(name: 'selected-map') required Map selectedMap, + @JsonKey(name: 'test-url') required String testUrl, }) = _SetupParams; factory SetupParams.fromJson(Map json) => @@ -68,10 +68,10 @@ class UpdateParams with _$UpdateParams { @freezed class CoreState with _$CoreState { const factory CoreState({ - @JsonKey(name: "vpn-props") required VpnProps vpnProps, - @JsonKey(name: "only-statistics-proxy") required bool onlyStatisticsProxy, - @JsonKey(name: "current-profile-name") required String currentProfileName, - @JsonKey(name: "bypass-domain") @Default([]) List bypassDomain, + @JsonKey(name: 'vpn-props') required VpnProps vpnProps, + @JsonKey(name: 'only-statistics-proxy') required bool onlyStatisticsProxy, + @JsonKey(name: 'current-profile-name') required String currentProfileName, + @JsonKey(name: 'bypass-domain') @Default([]) List bypassDomain, }) = _CoreState; factory CoreState.fromJson(Map json) => @@ -100,7 +100,7 @@ class AndroidVpnOptions with _$AndroidVpnOptions { @freezed class InitParams with _$InitParams { const factory InitParams({ - @JsonKey(name: "home-dir") required String homeDir, + @JsonKey(name: 'home-dir') required String homeDir, required int version, }) = _InitParams; @@ -111,8 +111,8 @@ class InitParams with _$InitParams { @freezed class ChangeProxyParams with _$ChangeProxyParams { const factory ChangeProxyParams({ - @JsonKey(name: "group-name") required String groupName, - @JsonKey(name: "proxy-name") required String proxyName, + @JsonKey(name: 'group-name') required String groupName, + @JsonKey(name: 'proxy-name') required String proxyName, }) = _ChangeProxyParams; factory ChangeProxyParams.fromJson(Map json) => @@ -122,8 +122,8 @@ class ChangeProxyParams with _$ChangeProxyParams { @freezed class UpdateGeoDataParams with _$UpdateGeoDataParams { const factory UpdateGeoDataParams({ - @JsonKey(name: "geo-type") required String geoType, - @JsonKey(name: "geo-name") required String geoName, + @JsonKey(name: 'geo-type') required String geoType, + @JsonKey(name: 'geo-name') required String geoName, }) = _UpdateGeoDataParams; factory UpdateGeoDataParams.fromJson(Map json) => @@ -197,10 +197,10 @@ class Now with _$Now { @freezed class ProviderSubscriptionInfo with _$ProviderSubscriptionInfo { const factory ProviderSubscriptionInfo({ - @JsonKey(name: "UPLOAD") @Default(0) int upload, - @JsonKey(name: "DOWNLOAD") @Default(0) int download, - @JsonKey(name: "TOTAL") @Default(0) int total, - @JsonKey(name: "EXPIRE") @Default(0) int expire, + @JsonKey(name: 'UPLOAD') @Default(0) int upload, + @JsonKey(name: 'DOWNLOAD') @Default(0) int download, + @JsonKey(name: 'TOTAL') @Default(0) int total, + @JsonKey(name: 'EXPIRE') @Default(0) int expire, }) = _ProviderSubscriptionInfo; factory ProviderSubscriptionInfo.fromJson(Map json) => @@ -224,11 +224,11 @@ class ExternalProvider with _$ExternalProvider { required String type, String? path, required int count, - @JsonKey(name: "subscription-info", fromJson: subscriptionInfoFormCore) + @JsonKey(name: 'subscription-info', fromJson: subscriptionInfoFormCore) SubscriptionInfo? subscriptionInfo, @Default(false) bool isUpdating, - @JsonKey(name: "vehicle-type") required String vehicleType, - @JsonKey(name: "update-at") required DateTime updateAt, + @JsonKey(name: 'vehicle-type') required String vehicleType, + @JsonKey(name: 'update-at') required DateTime updateAt, }) = _ExternalProvider; factory ExternalProvider.fromJson(Map json) => diff --git a/lib/models/generated/app.freezed.dart b/lib/models/generated/app.freezed.dart index 00062a4..7e71d66 100644 --- a/lib/models/generated/app.freezed.dart +++ b/lib/models/generated/app.freezed.dart @@ -26,17 +26,19 @@ mixin _$AppState { throw _privateConstructorUsedError; List get groups => throw _privateConstructorUsedError; int get checkIpNum => throw _privateConstructorUsedError; - Brightness? get brightness => throw _privateConstructorUsedError; + Brightness get brightness => throw _privateConstructorUsedError; int? get runTime => throw _privateConstructorUsedError; List get providers => throw _privateConstructorUsedError; String? get localIp => throw _privateConstructorUsedError; - FixedList get requests => throw _privateConstructorUsedError; + FixedList get requests => throw _privateConstructorUsedError; int get version => throw _privateConstructorUsedError; FixedList get logs => throw _privateConstructorUsedError; FixedList get traffics => throw _privateConstructorUsedError; Traffic get totalTraffic => throw _privateConstructorUsedError; - String get proxiesQuery => throw _privateConstructorUsedError; bool get realTunEnable => throw _privateConstructorUsedError; + bool get loading => throw _privateConstructorUsedError; + SystemUiOverlayStyle get systemUiOverlayStyle => + throw _privateConstructorUsedError; /// Create a copy of AppState /// with the given fields replaced by the non-null parameter values. @@ -60,17 +62,18 @@ abstract class $AppStateCopyWith<$Res> { Map> delayMap, List groups, int checkIpNum, - Brightness? brightness, + Brightness brightness, int? runTime, List providers, String? localIp, - FixedList requests, + FixedList requests, int version, FixedList logs, FixedList traffics, Traffic totalTraffic, - String proxiesQuery, - bool realTunEnable}); + bool realTunEnable, + bool loading, + SystemUiOverlayStyle systemUiOverlayStyle}); } /// @nodoc @@ -97,7 +100,7 @@ class _$AppStateCopyWithImpl<$Res, $Val extends AppState> Object? delayMap = null, Object? groups = null, Object? checkIpNum = null, - Object? brightness = freezed, + Object? brightness = null, Object? runTime = freezed, Object? providers = null, Object? localIp = freezed, @@ -106,8 +109,9 @@ class _$AppStateCopyWithImpl<$Res, $Val extends AppState> Object? logs = null, Object? traffics = null, Object? totalTraffic = null, - Object? proxiesQuery = null, Object? realTunEnable = null, + Object? loading = null, + Object? systemUiOverlayStyle = null, }) { return _then(_value.copyWith( isInit: null == isInit @@ -146,10 +150,10 @@ class _$AppStateCopyWithImpl<$Res, $Val extends AppState> ? _value.checkIpNum : checkIpNum // ignore: cast_nullable_to_non_nullable as int, - brightness: freezed == brightness + brightness: null == brightness ? _value.brightness : brightness // ignore: cast_nullable_to_non_nullable - as Brightness?, + as Brightness, runTime: freezed == runTime ? _value.runTime : runTime // ignore: cast_nullable_to_non_nullable @@ -165,7 +169,7 @@ class _$AppStateCopyWithImpl<$Res, $Val extends AppState> requests: null == requests ? _value.requests : requests // ignore: cast_nullable_to_non_nullable - as FixedList, + as FixedList, version: null == version ? _value.version : version // ignore: cast_nullable_to_non_nullable @@ -182,14 +186,18 @@ class _$AppStateCopyWithImpl<$Res, $Val extends AppState> ? _value.totalTraffic : totalTraffic // ignore: cast_nullable_to_non_nullable as Traffic, - proxiesQuery: null == proxiesQuery - ? _value.proxiesQuery - : proxiesQuery // ignore: cast_nullable_to_non_nullable - as String, realTunEnable: null == realTunEnable ? _value.realTunEnable : realTunEnable // ignore: cast_nullable_to_non_nullable as bool, + loading: null == loading + ? _value.loading + : loading // ignore: cast_nullable_to_non_nullable + as bool, + systemUiOverlayStyle: null == systemUiOverlayStyle + ? _value.systemUiOverlayStyle + : systemUiOverlayStyle // ignore: cast_nullable_to_non_nullable + as SystemUiOverlayStyle, ) as $Val); } } @@ -212,17 +220,18 @@ abstract class _$$AppStateImplCopyWith<$Res> Map> delayMap, List groups, int checkIpNum, - Brightness? brightness, + Brightness brightness, int? runTime, List providers, String? localIp, - FixedList requests, + FixedList requests, int version, FixedList logs, FixedList traffics, Traffic totalTraffic, - String proxiesQuery, - bool realTunEnable}); + bool realTunEnable, + bool loading, + SystemUiOverlayStyle systemUiOverlayStyle}); } /// @nodoc @@ -247,7 +256,7 @@ class __$$AppStateImplCopyWithImpl<$Res> Object? delayMap = null, Object? groups = null, Object? checkIpNum = null, - Object? brightness = freezed, + Object? brightness = null, Object? runTime = freezed, Object? providers = null, Object? localIp = freezed, @@ -256,8 +265,9 @@ class __$$AppStateImplCopyWithImpl<$Res> Object? logs = null, Object? traffics = null, Object? totalTraffic = null, - Object? proxiesQuery = null, Object? realTunEnable = null, + Object? loading = null, + Object? systemUiOverlayStyle = null, }) { return _then(_$AppStateImpl( isInit: null == isInit @@ -296,10 +306,10 @@ class __$$AppStateImplCopyWithImpl<$Res> ? _value.checkIpNum : checkIpNum // ignore: cast_nullable_to_non_nullable as int, - brightness: freezed == brightness + brightness: null == brightness ? _value.brightness : brightness // ignore: cast_nullable_to_non_nullable - as Brightness?, + as Brightness, runTime: freezed == runTime ? _value.runTime : runTime // ignore: cast_nullable_to_non_nullable @@ -315,7 +325,7 @@ class __$$AppStateImplCopyWithImpl<$Res> requests: null == requests ? _value.requests : requests // ignore: cast_nullable_to_non_nullable - as FixedList, + as FixedList, version: null == version ? _value.version : version // ignore: cast_nullable_to_non_nullable @@ -332,14 +342,18 @@ class __$$AppStateImplCopyWithImpl<$Res> ? _value.totalTraffic : totalTraffic // ignore: cast_nullable_to_non_nullable as Traffic, - proxiesQuery: null == proxiesQuery - ? _value.proxiesQuery - : proxiesQuery // ignore: cast_nullable_to_non_nullable - as String, realTunEnable: null == realTunEnable ? _value.realTunEnable : realTunEnable // ignore: cast_nullable_to_non_nullable as bool, + loading: null == loading + ? _value.loading + : loading // ignore: cast_nullable_to_non_nullable + as bool, + systemUiOverlayStyle: null == systemUiOverlayStyle + ? _value.systemUiOverlayStyle + : systemUiOverlayStyle // ignore: cast_nullable_to_non_nullable + as SystemUiOverlayStyle, )); } } @@ -357,7 +371,7 @@ class _$AppStateImpl implements _AppState { final Map> delayMap = const {}, final List groups = const [], this.checkIpNum = 0, - this.brightness, + required this.brightness, this.runTime, final List providers = const [], this.localIp, @@ -366,8 +380,9 @@ class _$AppStateImpl implements _AppState { required this.logs, required this.traffics, required this.totalTraffic, - this.proxiesQuery = "", - this.realTunEnable = false}) + this.realTunEnable = false, + this.loading = false, + required this.systemUiOverlayStyle}) : _packages = packages, _delayMap = delayMap, _groups = groups, @@ -418,7 +433,7 @@ class _$AppStateImpl implements _AppState { @JsonKey() final int checkIpNum; @override - final Brightness? brightness; + final Brightness brightness; @override final int? runTime; final List _providers; @@ -433,7 +448,7 @@ class _$AppStateImpl implements _AppState { @override final String? localIp; @override - final FixedList requests; + final FixedList requests; @override final int version; @override @@ -444,14 +459,16 @@ class _$AppStateImpl implements _AppState { final Traffic totalTraffic; @override @JsonKey() - final String proxiesQuery; + final bool realTunEnable; @override @JsonKey() - final bool realTunEnable; + final bool loading; + @override + final SystemUiOverlayStyle systemUiOverlayStyle; @override String toString() { - return 'AppState(isInit: $isInit, backBlock: $backBlock, pageLabel: $pageLabel, packages: $packages, sortNum: $sortNum, viewSize: $viewSize, delayMap: $delayMap, groups: $groups, checkIpNum: $checkIpNum, brightness: $brightness, runTime: $runTime, providers: $providers, localIp: $localIp, requests: $requests, version: $version, logs: $logs, traffics: $traffics, totalTraffic: $totalTraffic, proxiesQuery: $proxiesQuery, realTunEnable: $realTunEnable)'; + return 'AppState(isInit: $isInit, backBlock: $backBlock, pageLabel: $pageLabel, packages: $packages, sortNum: $sortNum, viewSize: $viewSize, delayMap: $delayMap, groups: $groups, checkIpNum: $checkIpNum, brightness: $brightness, runTime: $runTime, providers: $providers, localIp: $localIp, requests: $requests, version: $version, logs: $logs, traffics: $traffics, totalTraffic: $totalTraffic, realTunEnable: $realTunEnable, loading: $loading, systemUiOverlayStyle: $systemUiOverlayStyle)'; } @override @@ -486,10 +503,11 @@ class _$AppStateImpl implements _AppState { other.traffics == traffics) && (identical(other.totalTraffic, totalTraffic) || other.totalTraffic == totalTraffic) && - (identical(other.proxiesQuery, proxiesQuery) || - other.proxiesQuery == proxiesQuery) && (identical(other.realTunEnable, realTunEnable) || - other.realTunEnable == realTunEnable)); + other.realTunEnable == realTunEnable) && + (identical(other.loading, loading) || other.loading == loading) && + (identical(other.systemUiOverlayStyle, systemUiOverlayStyle) || + other.systemUiOverlayStyle == systemUiOverlayStyle)); } @override @@ -513,8 +531,9 @@ class _$AppStateImpl implements _AppState { logs, traffics, totalTraffic, - proxiesQuery, - realTunEnable + realTunEnable, + loading, + systemUiOverlayStyle ]); /// Create a copy of AppState @@ -528,26 +547,28 @@ class _$AppStateImpl implements _AppState { abstract class _AppState implements AppState { const factory _AppState( - {final bool isInit, - final bool backBlock, - final PageLabel pageLabel, - final List packages, - final int sortNum, - required final Size viewSize, - final Map> delayMap, - final List groups, - final int checkIpNum, - final Brightness? brightness, - final int? runTime, - final List providers, - final String? localIp, - required final FixedList requests, - required final int version, - required final FixedList logs, - required final FixedList traffics, - required final Traffic totalTraffic, - final String proxiesQuery, - final bool realTunEnable}) = _$AppStateImpl; + {final bool isInit, + final bool backBlock, + final PageLabel pageLabel, + final List packages, + final int sortNum, + required final Size viewSize, + final Map> delayMap, + final List groups, + final int checkIpNum, + required final Brightness brightness, + final int? runTime, + final List providers, + final String? localIp, + required final FixedList requests, + required final int version, + required final FixedList logs, + required final FixedList traffics, + required final Traffic totalTraffic, + final bool realTunEnable, + final bool loading, + required final SystemUiOverlayStyle systemUiOverlayStyle}) = + _$AppStateImpl; @override bool get isInit; @@ -568,7 +589,7 @@ abstract class _AppState implements AppState { @override int get checkIpNum; @override - Brightness? get brightness; + Brightness get brightness; @override int? get runTime; @override @@ -576,7 +597,7 @@ abstract class _AppState implements AppState { @override String? get localIp; @override - FixedList get requests; + FixedList get requests; @override int get version; @override @@ -586,9 +607,11 @@ abstract class _AppState implements AppState { @override Traffic get totalTraffic; @override - String get proxiesQuery; - @override bool get realTunEnable; + @override + bool get loading; + @override + SystemUiOverlayStyle get systemUiOverlayStyle; /// Create a copy of AppState /// with the given fields replaced by the non-null parameter values. diff --git a/lib/models/generated/clash_config.freezed.dart b/lib/models/generated/clash_config.freezed.dart index 93a8687..dccecbd 100644 --- a/lib/models/generated/clash_config.freezed.dart +++ b/lib/models/generated/clash_config.freezed.dart @@ -29,14 +29,14 @@ mixin _$ProxyGroup { bool? get lazy => throw _privateConstructorUsedError; String? get url => throw _privateConstructorUsedError; int? get timeout => throw _privateConstructorUsedError; - @JsonKey(name: "max-failed-times") + @JsonKey(name: 'max-failed-times') int? get maxFailedTimes => throw _privateConstructorUsedError; String? get filter => throw _privateConstructorUsedError; - @JsonKey(name: "expected-filter") + @JsonKey(name: 'expected-filter') String? get excludeFilter => throw _privateConstructorUsedError; - @JsonKey(name: "exclude-type") + @JsonKey(name: 'exclude-type') String? get excludeType => throw _privateConstructorUsedError; - @JsonKey(name: "expected-status") + @JsonKey(name: 'expected-status') dynamic get expectedStatus => throw _privateConstructorUsedError; bool? get hidden => throw _privateConstructorUsedError; String? get icon => throw _privateConstructorUsedError; @@ -66,11 +66,11 @@ abstract class $ProxyGroupCopyWith<$Res> { bool? lazy, String? url, int? timeout, - @JsonKey(name: "max-failed-times") int? maxFailedTimes, + @JsonKey(name: 'max-failed-times') int? maxFailedTimes, String? filter, - @JsonKey(name: "expected-filter") String? excludeFilter, - @JsonKey(name: "exclude-type") String? excludeType, - @JsonKey(name: "expected-status") dynamic expectedStatus, + @JsonKey(name: 'expected-filter') String? excludeFilter, + @JsonKey(name: 'exclude-type') String? excludeType, + @JsonKey(name: 'expected-status') dynamic expectedStatus, bool? hidden, String? icon}); } @@ -188,11 +188,11 @@ abstract class _$$ProxyGroupImplCopyWith<$Res> bool? lazy, String? url, int? timeout, - @JsonKey(name: "max-failed-times") int? maxFailedTimes, + @JsonKey(name: 'max-failed-times') int? maxFailedTimes, String? filter, - @JsonKey(name: "expected-filter") String? excludeFilter, - @JsonKey(name: "exclude-type") String? excludeType, - @JsonKey(name: "expected-status") dynamic expectedStatus, + @JsonKey(name: 'expected-filter') String? excludeFilter, + @JsonKey(name: 'exclude-type') String? excludeType, + @JsonKey(name: 'expected-status') dynamic expectedStatus, bool? hidden, String? icon}); } @@ -303,11 +303,11 @@ class _$ProxyGroupImpl implements _ProxyGroup { this.lazy, this.url, this.timeout, - @JsonKey(name: "max-failed-times") this.maxFailedTimes, + @JsonKey(name: 'max-failed-times') this.maxFailedTimes, this.filter, - @JsonKey(name: "expected-filter") this.excludeFilter, - @JsonKey(name: "exclude-type") this.excludeType, - @JsonKey(name: "expected-status") this.expectedStatus, + @JsonKey(name: 'expected-filter') this.excludeFilter, + @JsonKey(name: 'exclude-type') this.excludeType, + @JsonKey(name: 'expected-status') this.expectedStatus, this.hidden, this.icon}) : _proxies = proxies, @@ -350,18 +350,18 @@ class _$ProxyGroupImpl implements _ProxyGroup { @override final int? timeout; @override - @JsonKey(name: "max-failed-times") + @JsonKey(name: 'max-failed-times') final int? maxFailedTimes; @override final String? filter; @override - @JsonKey(name: "expected-filter") + @JsonKey(name: 'expected-filter') final String? excludeFilter; @override - @JsonKey(name: "exclude-type") + @JsonKey(name: 'exclude-type') final String? excludeType; @override - @JsonKey(name: "expected-status") + @JsonKey(name: 'expected-status') final dynamic expectedStatus; @override final bool? hidden; @@ -447,11 +447,11 @@ abstract class _ProxyGroup implements ProxyGroup { final bool? lazy, final String? url, final int? timeout, - @JsonKey(name: "max-failed-times") final int? maxFailedTimes, + @JsonKey(name: 'max-failed-times') final int? maxFailedTimes, final String? filter, - @JsonKey(name: "expected-filter") final String? excludeFilter, - @JsonKey(name: "exclude-type") final String? excludeType, - @JsonKey(name: "expected-status") final dynamic expectedStatus, + @JsonKey(name: 'expected-filter') final String? excludeFilter, + @JsonKey(name: 'exclude-type') final String? excludeType, + @JsonKey(name: 'expected-status') final dynamic expectedStatus, final bool? hidden, final String? icon}) = _$ProxyGroupImpl; @@ -476,18 +476,18 @@ abstract class _ProxyGroup implements ProxyGroup { @override int? get timeout; @override - @JsonKey(name: "max-failed-times") + @JsonKey(name: 'max-failed-times') int? get maxFailedTimes; @override String? get filter; @override - @JsonKey(name: "expected-filter") + @JsonKey(name: 'expected-filter') String? get excludeFilter; @override - @JsonKey(name: "exclude-type") + @JsonKey(name: 'exclude-type') String? get excludeType; @override - @JsonKey(name: "expected-status") + @JsonKey(name: 'expected-status') dynamic get expectedStatus; @override bool? get hidden; @@ -659,22 +659,22 @@ Sniffer _$SnifferFromJson(Map json) { /// @nodoc mixin _$Sniffer { bool get enable => throw _privateConstructorUsedError; - @JsonKey(name: "override-destination") + @JsonKey(name: 'override-destination') bool get overrideDest => throw _privateConstructorUsedError; List get sniffing => throw _privateConstructorUsedError; - @JsonKey(name: "force-domain") + @JsonKey(name: 'force-domain') List get forceDomain => throw _privateConstructorUsedError; - @JsonKey(name: "skip-src-address") + @JsonKey(name: 'skip-src-address') List get skipSrcAddress => throw _privateConstructorUsedError; - @JsonKey(name: "skip-dst-address") + @JsonKey(name: 'skip-dst-address') List get skipDstAddress => throw _privateConstructorUsedError; - @JsonKey(name: "skip-domain") + @JsonKey(name: 'skip-domain') List get skipDomain => throw _privateConstructorUsedError; - @JsonKey(name: "port-whitelist") + @JsonKey(name: 'port-whitelist') List get port => throw _privateConstructorUsedError; - @JsonKey(name: "force-dns-mapping") + @JsonKey(name: 'force-dns-mapping') bool get forceDnsMapping => throw _privateConstructorUsedError; - @JsonKey(name: "parse-pure-ip") + @JsonKey(name: 'parse-pure-ip') bool get parsePureIp => throw _privateConstructorUsedError; Map get sniff => throw _privateConstructorUsedError; @@ -694,15 +694,15 @@ abstract class $SnifferCopyWith<$Res> { @useResult $Res call( {bool enable, - @JsonKey(name: "override-destination") bool overrideDest, + @JsonKey(name: 'override-destination') bool overrideDest, List sniffing, - @JsonKey(name: "force-domain") List forceDomain, - @JsonKey(name: "skip-src-address") List skipSrcAddress, - @JsonKey(name: "skip-dst-address") List skipDstAddress, - @JsonKey(name: "skip-domain") List skipDomain, - @JsonKey(name: "port-whitelist") List port, - @JsonKey(name: "force-dns-mapping") bool forceDnsMapping, - @JsonKey(name: "parse-pure-ip") bool parsePureIp, + @JsonKey(name: 'force-domain') List forceDomain, + @JsonKey(name: 'skip-src-address') List skipSrcAddress, + @JsonKey(name: 'skip-dst-address') List skipDstAddress, + @JsonKey(name: 'skip-domain') List skipDomain, + @JsonKey(name: 'port-whitelist') List port, + @JsonKey(name: 'force-dns-mapping') bool forceDnsMapping, + @JsonKey(name: 'parse-pure-ip') bool parsePureIp, Map sniff}); } @@ -791,15 +791,15 @@ abstract class _$$SnifferImplCopyWith<$Res> implements $SnifferCopyWith<$Res> { @useResult $Res call( {bool enable, - @JsonKey(name: "override-destination") bool overrideDest, + @JsonKey(name: 'override-destination') bool overrideDest, List sniffing, - @JsonKey(name: "force-domain") List forceDomain, - @JsonKey(name: "skip-src-address") List skipSrcAddress, - @JsonKey(name: "skip-dst-address") List skipDstAddress, - @JsonKey(name: "skip-domain") List skipDomain, - @JsonKey(name: "port-whitelist") List port, - @JsonKey(name: "force-dns-mapping") bool forceDnsMapping, - @JsonKey(name: "parse-pure-ip") bool parsePureIp, + @JsonKey(name: 'force-domain') List forceDomain, + @JsonKey(name: 'skip-src-address') List skipSrcAddress, + @JsonKey(name: 'skip-dst-address') List skipDstAddress, + @JsonKey(name: 'skip-domain') List skipDomain, + @JsonKey(name: 'port-whitelist') List port, + @JsonKey(name: 'force-dns-mapping') bool forceDnsMapping, + @JsonKey(name: 'parse-pure-ip') bool parsePureIp, Map sniff}); } @@ -882,17 +882,17 @@ class __$$SnifferImplCopyWithImpl<$Res> class _$SnifferImpl implements _Sniffer { const _$SnifferImpl( {this.enable = false, - @JsonKey(name: "override-destination") this.overrideDest = true, + @JsonKey(name: 'override-destination') this.overrideDest = true, final List sniffing = const [], - @JsonKey(name: "force-domain") final List forceDomain = const [], - @JsonKey(name: "skip-src-address") + @JsonKey(name: 'force-domain') final List forceDomain = const [], + @JsonKey(name: 'skip-src-address') final List skipSrcAddress = const [], - @JsonKey(name: "skip-dst-address") + @JsonKey(name: 'skip-dst-address') final List skipDstAddress = const [], - @JsonKey(name: "skip-domain") final List skipDomain = const [], - @JsonKey(name: "port-whitelist") final List port = const [], - @JsonKey(name: "force-dns-mapping") this.forceDnsMapping = true, - @JsonKey(name: "parse-pure-ip") this.parsePureIp = true, + @JsonKey(name: 'skip-domain') final List skipDomain = const [], + @JsonKey(name: 'port-whitelist') final List port = const [], + @JsonKey(name: 'force-dns-mapping') this.forceDnsMapping = true, + @JsonKey(name: 'parse-pure-ip') this.parsePureIp = true, final Map sniff = const {}}) : _sniffing = sniffing, _forceDomain = forceDomain, @@ -909,7 +909,7 @@ class _$SnifferImpl implements _Sniffer { @JsonKey() final bool enable; @override - @JsonKey(name: "override-destination") + @JsonKey(name: 'override-destination') final bool overrideDest; final List _sniffing; @override @@ -922,7 +922,7 @@ class _$SnifferImpl implements _Sniffer { final List _forceDomain; @override - @JsonKey(name: "force-domain") + @JsonKey(name: 'force-domain') List get forceDomain { if (_forceDomain is EqualUnmodifiableListView) return _forceDomain; // ignore: implicit_dynamic_type @@ -931,7 +931,7 @@ class _$SnifferImpl implements _Sniffer { final List _skipSrcAddress; @override - @JsonKey(name: "skip-src-address") + @JsonKey(name: 'skip-src-address') List get skipSrcAddress { if (_skipSrcAddress is EqualUnmodifiableListView) return _skipSrcAddress; // ignore: implicit_dynamic_type @@ -940,7 +940,7 @@ class _$SnifferImpl implements _Sniffer { final List _skipDstAddress; @override - @JsonKey(name: "skip-dst-address") + @JsonKey(name: 'skip-dst-address') List get skipDstAddress { if (_skipDstAddress is EqualUnmodifiableListView) return _skipDstAddress; // ignore: implicit_dynamic_type @@ -949,7 +949,7 @@ class _$SnifferImpl implements _Sniffer { final List _skipDomain; @override - @JsonKey(name: "skip-domain") + @JsonKey(name: 'skip-domain') List get skipDomain { if (_skipDomain is EqualUnmodifiableListView) return _skipDomain; // ignore: implicit_dynamic_type @@ -958,7 +958,7 @@ class _$SnifferImpl implements _Sniffer { final List _port; @override - @JsonKey(name: "port-whitelist") + @JsonKey(name: 'port-whitelist') List get port { if (_port is EqualUnmodifiableListView) return _port; // ignore: implicit_dynamic_type @@ -966,10 +966,10 @@ class _$SnifferImpl implements _Sniffer { } @override - @JsonKey(name: "force-dns-mapping") + @JsonKey(name: 'force-dns-mapping') final bool forceDnsMapping; @override - @JsonKey(name: "parse-pure-ip") + @JsonKey(name: 'parse-pure-ip') final bool parsePureIp; final Map _sniff; @override @@ -1045,15 +1045,15 @@ class _$SnifferImpl implements _Sniffer { abstract class _Sniffer implements Sniffer { const factory _Sniffer( {final bool enable, - @JsonKey(name: "override-destination") final bool overrideDest, + @JsonKey(name: 'override-destination') final bool overrideDest, final List sniffing, - @JsonKey(name: "force-domain") final List forceDomain, - @JsonKey(name: "skip-src-address") final List skipSrcAddress, - @JsonKey(name: "skip-dst-address") final List skipDstAddress, - @JsonKey(name: "skip-domain") final List skipDomain, - @JsonKey(name: "port-whitelist") final List port, - @JsonKey(name: "force-dns-mapping") final bool forceDnsMapping, - @JsonKey(name: "parse-pure-ip") final bool parsePureIp, + @JsonKey(name: 'force-domain') final List forceDomain, + @JsonKey(name: 'skip-src-address') final List skipSrcAddress, + @JsonKey(name: 'skip-dst-address') final List skipDstAddress, + @JsonKey(name: 'skip-domain') final List skipDomain, + @JsonKey(name: 'port-whitelist') final List port, + @JsonKey(name: 'force-dns-mapping') final bool forceDnsMapping, + @JsonKey(name: 'parse-pure-ip') final bool parsePureIp, final Map sniff}) = _$SnifferImpl; factory _Sniffer.fromJson(Map json) = _$SnifferImpl.fromJson; @@ -1061,30 +1061,30 @@ abstract class _Sniffer implements Sniffer { @override bool get enable; @override - @JsonKey(name: "override-destination") + @JsonKey(name: 'override-destination') bool get overrideDest; @override List get sniffing; @override - @JsonKey(name: "force-domain") + @JsonKey(name: 'force-domain') List get forceDomain; @override - @JsonKey(name: "skip-src-address") + @JsonKey(name: 'skip-src-address') List get skipSrcAddress; @override - @JsonKey(name: "skip-dst-address") + @JsonKey(name: 'skip-dst-address') List get skipDstAddress; @override - @JsonKey(name: "skip-domain") + @JsonKey(name: 'skip-domain') List get skipDomain; @override - @JsonKey(name: "port-whitelist") + @JsonKey(name: 'port-whitelist') List get port; @override - @JsonKey(name: "force-dns-mapping") + @JsonKey(name: 'force-dns-mapping') bool get forceDnsMapping; @override - @JsonKey(name: "parse-pure-ip") + @JsonKey(name: 'parse-pure-ip') bool get parsePureIp; @override Map get sniff; @@ -1105,7 +1105,7 @@ SnifferConfig _$SnifferConfigFromJson(Map json) { mixin _$SnifferConfig { @JsonKey(fromJson: _formJsonPorts) List get ports => throw _privateConstructorUsedError; - @JsonKey(name: "override-destination") + @JsonKey(name: 'override-destination') bool? get overrideDest => throw _privateConstructorUsedError; /// Serializes this SnifferConfig to a JSON map. @@ -1126,7 +1126,7 @@ abstract class $SnifferConfigCopyWith<$Res> { @useResult $Res call( {@JsonKey(fromJson: _formJsonPorts) List ports, - @JsonKey(name: "override-destination") bool? overrideDest}); + @JsonKey(name: 'override-destination') bool? overrideDest}); } /// @nodoc @@ -1170,7 +1170,7 @@ abstract class _$$SnifferConfigImplCopyWith<$Res> @useResult $Res call( {@JsonKey(fromJson: _formJsonPorts) List ports, - @JsonKey(name: "override-destination") bool? overrideDest}); + @JsonKey(name: 'override-destination') bool? overrideDest}); } /// @nodoc @@ -1207,7 +1207,7 @@ class __$$SnifferConfigImplCopyWithImpl<$Res> class _$SnifferConfigImpl implements _SnifferConfig { const _$SnifferConfigImpl( {@JsonKey(fromJson: _formJsonPorts) final List ports = const [], - @JsonKey(name: "override-destination") this.overrideDest}) + @JsonKey(name: 'override-destination') this.overrideDest}) : _ports = ports; factory _$SnifferConfigImpl.fromJson(Map json) => @@ -1223,7 +1223,7 @@ class _$SnifferConfigImpl implements _SnifferConfig { } @override - @JsonKey(name: "override-destination") + @JsonKey(name: 'override-destination') final bool? overrideDest; @override @@ -1265,7 +1265,7 @@ class _$SnifferConfigImpl implements _SnifferConfig { abstract class _SnifferConfig implements SnifferConfig { const factory _SnifferConfig( {@JsonKey(fromJson: _formJsonPorts) final List ports, - @JsonKey(name: "override-destination") final bool? overrideDest}) = + @JsonKey(name: 'override-destination') final bool? overrideDest}) = _$SnifferConfigImpl; factory _SnifferConfig.fromJson(Map json) = @@ -1275,7 +1275,7 @@ abstract class _SnifferConfig implements SnifferConfig { @JsonKey(fromJson: _formJsonPorts) List get ports; @override - @JsonKey(name: "override-destination") + @JsonKey(name: 'override-destination') bool? get overrideDest; /// Create a copy of SnifferConfig @@ -1294,12 +1294,12 @@ Tun _$TunFromJson(Map json) { mixin _$Tun { bool get enable => throw _privateConstructorUsedError; String get device => throw _privateConstructorUsedError; - @JsonKey(name: "auto-route") + @JsonKey(name: 'auto-route') bool get autoRoute => throw _privateConstructorUsedError; TunStack get stack => throw _privateConstructorUsedError; - @JsonKey(name: "dns-hijack") + @JsonKey(name: 'dns-hijack') List get dnsHijack => throw _privateConstructorUsedError; - @JsonKey(name: "route-address") + @JsonKey(name: 'route-address') List get routeAddress => throw _privateConstructorUsedError; /// Serializes this Tun to a JSON map. @@ -1319,10 +1319,10 @@ abstract class $TunCopyWith<$Res> { $Res call( {bool enable, String device, - @JsonKey(name: "auto-route") bool autoRoute, + @JsonKey(name: 'auto-route') bool autoRoute, TunStack stack, - @JsonKey(name: "dns-hijack") List dnsHijack, - @JsonKey(name: "route-address") List routeAddress}); + @JsonKey(name: 'dns-hijack') List dnsHijack, + @JsonKey(name: 'route-address') List routeAddress}); } /// @nodoc @@ -1384,10 +1384,10 @@ abstract class _$$TunImplCopyWith<$Res> implements $TunCopyWith<$Res> { $Res call( {bool enable, String device, - @JsonKey(name: "auto-route") bool autoRoute, + @JsonKey(name: 'auto-route') bool autoRoute, TunStack stack, - @JsonKey(name: "dns-hijack") List dnsHijack, - @JsonKey(name: "route-address") List routeAddress}); + @JsonKey(name: 'dns-hijack') List dnsHijack, + @JsonKey(name: 'route-address') List routeAddress}); } /// @nodoc @@ -1443,11 +1443,11 @@ class _$TunImpl implements _Tun { const _$TunImpl( {this.enable = false, this.device = appName, - @JsonKey(name: "auto-route") this.autoRoute = false, + @JsonKey(name: 'auto-route') this.autoRoute = false, this.stack = TunStack.mixed, - @JsonKey(name: "dns-hijack") - final List dnsHijack = const ["any:53"], - @JsonKey(name: "route-address") + @JsonKey(name: 'dns-hijack') + final List dnsHijack = const ['any:53'], + @JsonKey(name: 'route-address') final List routeAddress = const []}) : _dnsHijack = dnsHijack, _routeAddress = routeAddress; @@ -1462,14 +1462,14 @@ class _$TunImpl implements _Tun { @JsonKey() final String device; @override - @JsonKey(name: "auto-route") + @JsonKey(name: 'auto-route') final bool autoRoute; @override @JsonKey() final TunStack stack; final List _dnsHijack; @override - @JsonKey(name: "dns-hijack") + @JsonKey(name: 'dns-hijack') List get dnsHijack { if (_dnsHijack is EqualUnmodifiableListView) return _dnsHijack; // ignore: implicit_dynamic_type @@ -1478,7 +1478,7 @@ class _$TunImpl implements _Tun { final List _routeAddress; @override - @JsonKey(name: "route-address") + @JsonKey(name: 'route-address') List get routeAddress { if (_routeAddress is EqualUnmodifiableListView) return _routeAddress; // ignore: implicit_dynamic_type @@ -1537,10 +1537,10 @@ abstract class _Tun implements Tun { const factory _Tun( {final bool enable, final String device, - @JsonKey(name: "auto-route") final bool autoRoute, + @JsonKey(name: 'auto-route') final bool autoRoute, final TunStack stack, - @JsonKey(name: "dns-hijack") final List dnsHijack, - @JsonKey(name: "route-address") final List routeAddress}) = + @JsonKey(name: 'dns-hijack') final List dnsHijack, + @JsonKey(name: 'route-address') final List routeAddress}) = _$TunImpl; factory _Tun.fromJson(Map json) = _$TunImpl.fromJson; @@ -1550,15 +1550,15 @@ abstract class _Tun implements Tun { @override String get device; @override - @JsonKey(name: "auto-route") + @JsonKey(name: 'auto-route') bool get autoRoute; @override TunStack get stack; @override - @JsonKey(name: "dns-hijack") + @JsonKey(name: 'dns-hijack') List get dnsHijack; @override - @JsonKey(name: "route-address") + @JsonKey(name: 'route-address') List get routeAddress; /// Create a copy of Tun @@ -1576,7 +1576,7 @@ FallbackFilter _$FallbackFilterFromJson(Map json) { /// @nodoc mixin _$FallbackFilter { bool get geoip => throw _privateConstructorUsedError; - @JsonKey(name: "geoip-code") + @JsonKey(name: 'geoip-code') String get geoipCode => throw _privateConstructorUsedError; List get geosite => throw _privateConstructorUsedError; List get ipcidr => throw _privateConstructorUsedError; @@ -1600,7 +1600,7 @@ abstract class $FallbackFilterCopyWith<$Res> { @useResult $Res call( {bool geoip, - @JsonKey(name: "geoip-code") String geoipCode, + @JsonKey(name: 'geoip-code') String geoipCode, List geosite, List ipcidr, List domain}); @@ -1662,7 +1662,7 @@ abstract class _$$FallbackFilterImplCopyWith<$Res> @useResult $Res call( {bool geoip, - @JsonKey(name: "geoip-code") String geoipCode, + @JsonKey(name: 'geoip-code') String geoipCode, List geosite, List ipcidr, List domain}); @@ -1717,13 +1717,13 @@ class __$$FallbackFilterImplCopyWithImpl<$Res> class _$FallbackFilterImpl implements _FallbackFilter { const _$FallbackFilterImpl( {this.geoip = true, - @JsonKey(name: "geoip-code") this.geoipCode = "CN", - final List geosite = const ["gfw"], - final List ipcidr = const ["240.0.0.0/4"], + @JsonKey(name: 'geoip-code') this.geoipCode = 'CN', + final List geosite = const ['gfw'], + final List ipcidr = const ['240.0.0.0/4'], final List domain = const [ - "+.google.com", - "+.facebook.com", - "+.youtube.com" + '+.google.com', + '+.facebook.com', + '+.youtube.com' ]}) : _geosite = geosite, _ipcidr = ipcidr, @@ -1736,7 +1736,7 @@ class _$FallbackFilterImpl implements _FallbackFilter { @JsonKey() final bool geoip; @override - @JsonKey(name: "geoip-code") + @JsonKey(name: 'geoip-code') final String geoipCode; final List _geosite; @override @@ -1813,7 +1813,7 @@ class _$FallbackFilterImpl implements _FallbackFilter { abstract class _FallbackFilter implements FallbackFilter { const factory _FallbackFilter( {final bool geoip, - @JsonKey(name: "geoip-code") final String geoipCode, + @JsonKey(name: 'geoip-code') final String geoipCode, final List geosite, final List ipcidr, final List domain}) = _$FallbackFilterImpl; @@ -1824,7 +1824,7 @@ abstract class _FallbackFilter implements FallbackFilter { @override bool get geoip; @override - @JsonKey(name: "geoip-code") + @JsonKey(name: 'geoip-code') String get geoipCode; @override List get geosite; @@ -1849,31 +1849,31 @@ Dns _$DnsFromJson(Map json) { mixin _$Dns { bool get enable => throw _privateConstructorUsedError; String get listen => throw _privateConstructorUsedError; - @JsonKey(name: "prefer-h3") + @JsonKey(name: 'prefer-h3') bool get preferH3 => throw _privateConstructorUsedError; - @JsonKey(name: "use-hosts") + @JsonKey(name: 'use-hosts') bool get useHosts => throw _privateConstructorUsedError; - @JsonKey(name: "use-system-hosts") + @JsonKey(name: 'use-system-hosts') bool get useSystemHosts => throw _privateConstructorUsedError; - @JsonKey(name: "respect-rules") + @JsonKey(name: 'respect-rules') bool get respectRules => throw _privateConstructorUsedError; bool get ipv6 => throw _privateConstructorUsedError; - @JsonKey(name: "default-nameserver") + @JsonKey(name: 'default-nameserver') List get defaultNameserver => throw _privateConstructorUsedError; - @JsonKey(name: "enhanced-mode") + @JsonKey(name: 'enhanced-mode') DnsMode get enhancedMode => throw _privateConstructorUsedError; - @JsonKey(name: "fake-ip-range") + @JsonKey(name: 'fake-ip-range') String get fakeIpRange => throw _privateConstructorUsedError; - @JsonKey(name: "fake-ip-filter") + @JsonKey(name: 'fake-ip-filter') List get fakeIpFilter => throw _privateConstructorUsedError; - @JsonKey(name: "nameserver-policy") + @JsonKey(name: 'nameserver-policy') Map get nameserverPolicy => throw _privateConstructorUsedError; List get nameserver => throw _privateConstructorUsedError; List get fallback => throw _privateConstructorUsedError; - @JsonKey(name: "proxy-server-nameserver") + @JsonKey(name: 'proxy-server-nameserver') List get proxyServerNameserver => throw _privateConstructorUsedError; - @JsonKey(name: "fallback-filter") + @JsonKey(name: 'fallback-filter') FallbackFilter get fallbackFilter => throw _privateConstructorUsedError; /// Serializes this Dns to a JSON map. @@ -1893,21 +1893,21 @@ abstract class $DnsCopyWith<$Res> { $Res call( {bool enable, String listen, - @JsonKey(name: "prefer-h3") bool preferH3, - @JsonKey(name: "use-hosts") bool useHosts, - @JsonKey(name: "use-system-hosts") bool useSystemHosts, - @JsonKey(name: "respect-rules") bool respectRules, + @JsonKey(name: 'prefer-h3') bool preferH3, + @JsonKey(name: 'use-hosts') bool useHosts, + @JsonKey(name: 'use-system-hosts') bool useSystemHosts, + @JsonKey(name: 'respect-rules') bool respectRules, bool ipv6, - @JsonKey(name: "default-nameserver") List defaultNameserver, - @JsonKey(name: "enhanced-mode") DnsMode enhancedMode, - @JsonKey(name: "fake-ip-range") String fakeIpRange, - @JsonKey(name: "fake-ip-filter") List fakeIpFilter, - @JsonKey(name: "nameserver-policy") Map nameserverPolicy, + @JsonKey(name: 'default-nameserver') List defaultNameserver, + @JsonKey(name: 'enhanced-mode') DnsMode enhancedMode, + @JsonKey(name: 'fake-ip-range') String fakeIpRange, + @JsonKey(name: 'fake-ip-filter') List fakeIpFilter, + @JsonKey(name: 'nameserver-policy') Map nameserverPolicy, List nameserver, List fallback, - @JsonKey(name: "proxy-server-nameserver") + @JsonKey(name: 'proxy-server-nameserver') List proxyServerNameserver, - @JsonKey(name: "fallback-filter") FallbackFilter fallbackFilter}); + @JsonKey(name: 'fallback-filter') FallbackFilter fallbackFilter}); $FallbackFilterCopyWith<$Res> get fallbackFilter; } @@ -2031,21 +2031,21 @@ abstract class _$$DnsImplCopyWith<$Res> implements $DnsCopyWith<$Res> { $Res call( {bool enable, String listen, - @JsonKey(name: "prefer-h3") bool preferH3, - @JsonKey(name: "use-hosts") bool useHosts, - @JsonKey(name: "use-system-hosts") bool useSystemHosts, - @JsonKey(name: "respect-rules") bool respectRules, + @JsonKey(name: 'prefer-h3') bool preferH3, + @JsonKey(name: 'use-hosts') bool useHosts, + @JsonKey(name: 'use-system-hosts') bool useSystemHosts, + @JsonKey(name: 'respect-rules') bool respectRules, bool ipv6, - @JsonKey(name: "default-nameserver") List defaultNameserver, - @JsonKey(name: "enhanced-mode") DnsMode enhancedMode, - @JsonKey(name: "fake-ip-range") String fakeIpRange, - @JsonKey(name: "fake-ip-filter") List fakeIpFilter, - @JsonKey(name: "nameserver-policy") Map nameserverPolicy, + @JsonKey(name: 'default-nameserver') List defaultNameserver, + @JsonKey(name: 'enhanced-mode') DnsMode enhancedMode, + @JsonKey(name: 'fake-ip-range') String fakeIpRange, + @JsonKey(name: 'fake-ip-filter') List fakeIpFilter, + @JsonKey(name: 'nameserver-policy') Map nameserverPolicy, List nameserver, List fallback, - @JsonKey(name: "proxy-server-nameserver") + @JsonKey(name: 'proxy-server-nameserver') List proxyServerNameserver, - @JsonKey(name: "fallback-filter") FallbackFilter fallbackFilter}); + @JsonKey(name: 'fallback-filter') FallbackFilter fallbackFilter}); @override $FallbackFilterCopyWith<$Res> get fallbackFilter; @@ -2153,36 +2153,36 @@ class __$$DnsImplCopyWithImpl<$Res> extends _$DnsCopyWithImpl<$Res, _$DnsImpl> class _$DnsImpl implements _Dns { const _$DnsImpl( {this.enable = true, - this.listen = "0.0.0.0:1053", - @JsonKey(name: "prefer-h3") this.preferH3 = false, - @JsonKey(name: "use-hosts") this.useHosts = true, - @JsonKey(name: "use-system-hosts") this.useSystemHosts = true, - @JsonKey(name: "respect-rules") this.respectRules = false, + this.listen = '0.0.0.0:1053', + @JsonKey(name: 'prefer-h3') this.preferH3 = false, + @JsonKey(name: 'use-hosts') this.useHosts = true, + @JsonKey(name: 'use-system-hosts') this.useSystemHosts = true, + @JsonKey(name: 'respect-rules') this.respectRules = false, this.ipv6 = false, - @JsonKey(name: "default-nameserver") - final List defaultNameserver = const ["223.5.5.5"], - @JsonKey(name: "enhanced-mode") this.enhancedMode = DnsMode.fakeIp, - @JsonKey(name: "fake-ip-range") this.fakeIpRange = "198.18.0.1/16", - @JsonKey(name: "fake-ip-filter") final List fakeIpFilter = const [ - "*.lan", - "localhost.ptlogin2.qq.com" + @JsonKey(name: 'default-nameserver') + final List defaultNameserver = const ['223.5.5.5'], + @JsonKey(name: 'enhanced-mode') this.enhancedMode = DnsMode.fakeIp, + @JsonKey(name: 'fake-ip-range') this.fakeIpRange = '198.18.0.1/16', + @JsonKey(name: 'fake-ip-filter') final List fakeIpFilter = const [ + '*.lan', + 'localhost.ptlogin2.qq.com' ], - @JsonKey(name: "nameserver-policy") + @JsonKey(name: 'nameserver-policy') final Map nameserverPolicy = const { - "www.baidu.com": "114.114.114.114", - "+.internal.crop.com": "10.0.0.1", - "geosite:cn": "https://doh.pub/dns-query" + 'www.baidu.com': '114.114.114.114', + '+.internal.crop.com': '10.0.0.1', + 'geosite:cn': 'https://doh.pub/dns-query' }, final List nameserver = const [ - "https://doh.pub/dns-query", - "https://dns.alidns.com/dns-query" + 'https://doh.pub/dns-query', + 'https://dns.alidns.com/dns-query' ], - final List fallback = const ["tls://8.8.4.4", "tls://1.1.1.1"], - @JsonKey(name: "proxy-server-nameserver") + final List fallback = const ['tls://8.8.4.4', 'tls://1.1.1.1'], + @JsonKey(name: 'proxy-server-nameserver') final List proxyServerNameserver = const [ - "https://doh.pub/dns-query" + 'https://doh.pub/dns-query' ], - @JsonKey(name: "fallback-filter") + @JsonKey(name: 'fallback-filter') this.fallbackFilter = const FallbackFilter()}) : _defaultNameserver = defaultNameserver, _fakeIpFilter = fakeIpFilter, @@ -2201,23 +2201,23 @@ class _$DnsImpl implements _Dns { @JsonKey() final String listen; @override - @JsonKey(name: "prefer-h3") + @JsonKey(name: 'prefer-h3') final bool preferH3; @override - @JsonKey(name: "use-hosts") + @JsonKey(name: 'use-hosts') final bool useHosts; @override - @JsonKey(name: "use-system-hosts") + @JsonKey(name: 'use-system-hosts') final bool useSystemHosts; @override - @JsonKey(name: "respect-rules") + @JsonKey(name: 'respect-rules') final bool respectRules; @override @JsonKey() final bool ipv6; final List _defaultNameserver; @override - @JsonKey(name: "default-nameserver") + @JsonKey(name: 'default-nameserver') List get defaultNameserver { if (_defaultNameserver is EqualUnmodifiableListView) return _defaultNameserver; @@ -2226,14 +2226,14 @@ class _$DnsImpl implements _Dns { } @override - @JsonKey(name: "enhanced-mode") + @JsonKey(name: 'enhanced-mode') final DnsMode enhancedMode; @override - @JsonKey(name: "fake-ip-range") + @JsonKey(name: 'fake-ip-range') final String fakeIpRange; final List _fakeIpFilter; @override - @JsonKey(name: "fake-ip-filter") + @JsonKey(name: 'fake-ip-filter') List get fakeIpFilter { if (_fakeIpFilter is EqualUnmodifiableListView) return _fakeIpFilter; // ignore: implicit_dynamic_type @@ -2242,7 +2242,7 @@ class _$DnsImpl implements _Dns { final Map _nameserverPolicy; @override - @JsonKey(name: "nameserver-policy") + @JsonKey(name: 'nameserver-policy') Map get nameserverPolicy { if (_nameserverPolicy is EqualUnmodifiableMapView) return _nameserverPolicy; // ignore: implicit_dynamic_type @@ -2269,7 +2269,7 @@ class _$DnsImpl implements _Dns { final List _proxyServerNameserver; @override - @JsonKey(name: "proxy-server-nameserver") + @JsonKey(name: 'proxy-server-nameserver') List get proxyServerNameserver { if (_proxyServerNameserver is EqualUnmodifiableListView) return _proxyServerNameserver; @@ -2278,7 +2278,7 @@ class _$DnsImpl implements _Dns { } @override - @JsonKey(name: "fallback-filter") + @JsonKey(name: 'fallback-filter') final FallbackFilter fallbackFilter; @override @@ -2362,22 +2362,22 @@ abstract class _Dns implements Dns { const factory _Dns( {final bool enable, final String listen, - @JsonKey(name: "prefer-h3") final bool preferH3, - @JsonKey(name: "use-hosts") final bool useHosts, - @JsonKey(name: "use-system-hosts") final bool useSystemHosts, - @JsonKey(name: "respect-rules") final bool respectRules, + @JsonKey(name: 'prefer-h3') final bool preferH3, + @JsonKey(name: 'use-hosts') final bool useHosts, + @JsonKey(name: 'use-system-hosts') final bool useSystemHosts, + @JsonKey(name: 'respect-rules') final bool respectRules, final bool ipv6, - @JsonKey(name: "default-nameserver") final List defaultNameserver, - @JsonKey(name: "enhanced-mode") final DnsMode enhancedMode, - @JsonKey(name: "fake-ip-range") final String fakeIpRange, - @JsonKey(name: "fake-ip-filter") final List fakeIpFilter, - @JsonKey(name: "nameserver-policy") + @JsonKey(name: 'default-nameserver') final List defaultNameserver, + @JsonKey(name: 'enhanced-mode') final DnsMode enhancedMode, + @JsonKey(name: 'fake-ip-range') final String fakeIpRange, + @JsonKey(name: 'fake-ip-filter') final List fakeIpFilter, + @JsonKey(name: 'nameserver-policy') final Map nameserverPolicy, final List nameserver, final List fallback, - @JsonKey(name: "proxy-server-nameserver") + @JsonKey(name: 'proxy-server-nameserver') final List proxyServerNameserver, - @JsonKey(name: "fallback-filter") + @JsonKey(name: 'fallback-filter') final FallbackFilter fallbackFilter}) = _$DnsImpl; factory _Dns.fromJson(Map json) = _$DnsImpl.fromJson; @@ -2387,43 +2387,43 @@ abstract class _Dns implements Dns { @override String get listen; @override - @JsonKey(name: "prefer-h3") + @JsonKey(name: 'prefer-h3') bool get preferH3; @override - @JsonKey(name: "use-hosts") + @JsonKey(name: 'use-hosts') bool get useHosts; @override - @JsonKey(name: "use-system-hosts") + @JsonKey(name: 'use-system-hosts') bool get useSystemHosts; @override - @JsonKey(name: "respect-rules") + @JsonKey(name: 'respect-rules') bool get respectRules; @override bool get ipv6; @override - @JsonKey(name: "default-nameserver") + @JsonKey(name: 'default-nameserver') List get defaultNameserver; @override - @JsonKey(name: "enhanced-mode") + @JsonKey(name: 'enhanced-mode') DnsMode get enhancedMode; @override - @JsonKey(name: "fake-ip-range") + @JsonKey(name: 'fake-ip-range') String get fakeIpRange; @override - @JsonKey(name: "fake-ip-filter") + @JsonKey(name: 'fake-ip-filter') List get fakeIpFilter; @override - @JsonKey(name: "nameserver-policy") + @JsonKey(name: 'nameserver-policy') Map get nameserverPolicy; @override List get nameserver; @override List get fallback; @override - @JsonKey(name: "proxy-server-nameserver") + @JsonKey(name: 'proxy-server-nameserver') List get proxyServerNameserver; @override - @JsonKey(name: "fallback-filter") + @JsonKey(name: 'fallback-filter') FallbackFilter get fallbackFilter; /// Create a copy of Dns @@ -2557,13 +2557,13 @@ class __$$GeoXUrlImplCopyWithImpl<$Res> class _$GeoXUrlImpl implements _GeoXUrl { const _$GeoXUrlImpl( {this.mmdb = - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb', this.asn = - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb', this.geoip = - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat', this.geosite = - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat"}); + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat'}); factory _$GeoXUrlImpl.fromJson(Map json) => _$$GeoXUrlImplFromJson(json); @@ -3214,13 +3214,13 @@ ClashConfigSnippet _$ClashConfigSnippetFromJson(Map json) { /// @nodoc mixin _$ClashConfigSnippet { - @JsonKey(name: "proxy-groups") + @JsonKey(name: 'proxy-groups') List get proxyGroups => throw _privateConstructorUsedError; - @JsonKey(fromJson: _genRule, name: "rules") + @JsonKey(fromJson: _genRule, name: 'rules') List get rule => throw _privateConstructorUsedError; - @JsonKey(name: "rule-providers", fromJson: _genRuleProviders) + @JsonKey(name: 'rule-providers', fromJson: _genRuleProviders) List get ruleProvider => throw _privateConstructorUsedError; - @JsonKey(name: "sub-rules", fromJson: _genSubRules) + @JsonKey(name: 'sub-rules', fromJson: _genSubRules) List get subRules => throw _privateConstructorUsedError; /// Serializes this ClashConfigSnippet to a JSON map. @@ -3240,11 +3240,11 @@ abstract class $ClashConfigSnippetCopyWith<$Res> { _$ClashConfigSnippetCopyWithImpl<$Res, ClashConfigSnippet>; @useResult $Res call( - {@JsonKey(name: "proxy-groups") List proxyGroups, - @JsonKey(fromJson: _genRule, name: "rules") List rule, - @JsonKey(name: "rule-providers", fromJson: _genRuleProviders) + {@JsonKey(name: 'proxy-groups') List proxyGroups, + @JsonKey(fromJson: _genRule, name: 'rules') List rule, + @JsonKey(name: 'rule-providers', fromJson: _genRuleProviders) List ruleProvider, - @JsonKey(name: "sub-rules", fromJson: _genSubRules) + @JsonKey(name: 'sub-rules', fromJson: _genSubRules) List subRules}); } @@ -3298,11 +3298,11 @@ abstract class _$$ClashConfigSnippetImplCopyWith<$Res> @override @useResult $Res call( - {@JsonKey(name: "proxy-groups") List proxyGroups, - @JsonKey(fromJson: _genRule, name: "rules") List rule, - @JsonKey(name: "rule-providers", fromJson: _genRuleProviders) + {@JsonKey(name: 'proxy-groups') List proxyGroups, + @JsonKey(fromJson: _genRule, name: 'rules') List rule, + @JsonKey(name: 'rule-providers', fromJson: _genRuleProviders) List ruleProvider, - @JsonKey(name: "sub-rules", fromJson: _genSubRules) + @JsonKey(name: 'sub-rules', fromJson: _genSubRules) List subRules}); } @@ -3349,13 +3349,13 @@ class __$$ClashConfigSnippetImplCopyWithImpl<$Res> @JsonSerializable() class _$ClashConfigSnippetImpl implements _ClashConfigSnippet { const _$ClashConfigSnippetImpl( - {@JsonKey(name: "proxy-groups") + {@JsonKey(name: 'proxy-groups') final List proxyGroups = const [], - @JsonKey(fromJson: _genRule, name: "rules") + @JsonKey(fromJson: _genRule, name: 'rules') final List rule = const [], - @JsonKey(name: "rule-providers", fromJson: _genRuleProviders) + @JsonKey(name: 'rule-providers', fromJson: _genRuleProviders) final List ruleProvider = const [], - @JsonKey(name: "sub-rules", fromJson: _genSubRules) + @JsonKey(name: 'sub-rules', fromJson: _genSubRules) final List subRules = const []}) : _proxyGroups = proxyGroups, _rule = rule, @@ -3367,7 +3367,7 @@ class _$ClashConfigSnippetImpl implements _ClashConfigSnippet { final List _proxyGroups; @override - @JsonKey(name: "proxy-groups") + @JsonKey(name: 'proxy-groups') List get proxyGroups { if (_proxyGroups is EqualUnmodifiableListView) return _proxyGroups; // ignore: implicit_dynamic_type @@ -3376,7 +3376,7 @@ class _$ClashConfigSnippetImpl implements _ClashConfigSnippet { final List _rule; @override - @JsonKey(fromJson: _genRule, name: "rules") + @JsonKey(fromJson: _genRule, name: 'rules') List get rule { if (_rule is EqualUnmodifiableListView) return _rule; // ignore: implicit_dynamic_type @@ -3385,7 +3385,7 @@ class _$ClashConfigSnippetImpl implements _ClashConfigSnippet { final List _ruleProvider; @override - @JsonKey(name: "rule-providers", fromJson: _genRuleProviders) + @JsonKey(name: 'rule-providers', fromJson: _genRuleProviders) List get ruleProvider { if (_ruleProvider is EqualUnmodifiableListView) return _ruleProvider; // ignore: implicit_dynamic_type @@ -3394,7 +3394,7 @@ class _$ClashConfigSnippetImpl implements _ClashConfigSnippet { final List _subRules; @override - @JsonKey(name: "sub-rules", fromJson: _genSubRules) + @JsonKey(name: 'sub-rules', fromJson: _genSubRules) List get subRules { if (_subRules is EqualUnmodifiableListView) return _subRules; // ignore: implicit_dynamic_type @@ -3447,27 +3447,27 @@ class _$ClashConfigSnippetImpl implements _ClashConfigSnippet { abstract class _ClashConfigSnippet implements ClashConfigSnippet { const factory _ClashConfigSnippet( - {@JsonKey(name: "proxy-groups") final List proxyGroups, - @JsonKey(fromJson: _genRule, name: "rules") final List rule, - @JsonKey(name: "rule-providers", fromJson: _genRuleProviders) + {@JsonKey(name: 'proxy-groups') final List proxyGroups, + @JsonKey(fromJson: _genRule, name: 'rules') final List rule, + @JsonKey(name: 'rule-providers', fromJson: _genRuleProviders) final List ruleProvider, - @JsonKey(name: "sub-rules", fromJson: _genSubRules) + @JsonKey(name: 'sub-rules', fromJson: _genSubRules) final List subRules}) = _$ClashConfigSnippetImpl; factory _ClashConfigSnippet.fromJson(Map json) = _$ClashConfigSnippetImpl.fromJson; @override - @JsonKey(name: "proxy-groups") + @JsonKey(name: 'proxy-groups') List get proxyGroups; @override - @JsonKey(fromJson: _genRule, name: "rules") + @JsonKey(fromJson: _genRule, name: 'rules') List get rule; @override - @JsonKey(name: "rule-providers", fromJson: _genRuleProviders) + @JsonKey(name: 'rule-providers', fromJson: _genRuleProviders) List get ruleProvider; @override - @JsonKey(name: "sub-rules", fromJson: _genSubRules) + @JsonKey(name: 'sub-rules', fromJson: _genSubRules) List get subRules; /// Create a copy of ClashConfigSnippet @@ -3484,44 +3484,44 @@ ClashConfig _$ClashConfigFromJson(Map json) { /// @nodoc mixin _$ClashConfig { - @JsonKey(name: "mixed-port") + @JsonKey(name: 'mixed-port') int get mixedPort => throw _privateConstructorUsedError; - @JsonKey(name: "socks-port") + @JsonKey(name: 'socks-port') int get socksPort => throw _privateConstructorUsedError; - @JsonKey(name: "port") + @JsonKey(name: 'port') int get port => throw _privateConstructorUsedError; - @JsonKey(name: "redir-port") + @JsonKey(name: 'redir-port') int get redirPort => throw _privateConstructorUsedError; - @JsonKey(name: "tproxy-port") + @JsonKey(name: 'tproxy-port') int get tproxyPort => throw _privateConstructorUsedError; Mode get mode => throw _privateConstructorUsedError; - @JsonKey(name: "allow-lan") + @JsonKey(name: 'allow-lan') bool get allowLan => throw _privateConstructorUsedError; - @JsonKey(name: "log-level") + @JsonKey(name: 'log-level') LogLevel get logLevel => throw _privateConstructorUsedError; bool get ipv6 => throw _privateConstructorUsedError; - @JsonKey(name: "find-process-mode", unknownEnumValue: FindProcessMode.always) + @JsonKey(name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) FindProcessMode get findProcessMode => throw _privateConstructorUsedError; - @JsonKey(name: "keep-alive-interval") + @JsonKey(name: 'keep-alive-interval') int get keepAliveInterval => throw _privateConstructorUsedError; - @JsonKey(name: "unified-delay") + @JsonKey(name: 'unified-delay') bool get unifiedDelay => throw _privateConstructorUsedError; - @JsonKey(name: "tcp-concurrent") + @JsonKey(name: 'tcp-concurrent') bool get tcpConcurrent => throw _privateConstructorUsedError; @JsonKey(fromJson: Tun.safeFormJson) Tun get tun => throw _privateConstructorUsedError; @JsonKey(fromJson: Dns.safeDnsFromJson) Dns get dns => throw _privateConstructorUsedError; - @JsonKey(name: "geox-url", fromJson: GeoXUrl.safeFormJson) + @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl get geoXUrl => throw _privateConstructorUsedError; - @JsonKey(name: "geodata-loader") + @JsonKey(name: 'geodata-loader') GeodataLoader get geodataLoader => throw _privateConstructorUsedError; - @JsonKey(name: "proxy-groups") + @JsonKey(name: 'proxy-groups') List get proxyGroups => throw _privateConstructorUsedError; List get rule => throw _privateConstructorUsedError; - @JsonKey(name: "global-ua") + @JsonKey(name: 'global-ua') String? get globalUa => throw _privateConstructorUsedError; - @JsonKey(name: "external-controller") + @JsonKey(name: 'external-controller') ExternalControllerStatus get externalController => throw _privateConstructorUsedError; Map get hosts => throw _privateConstructorUsedError; @@ -3543,30 +3543,30 @@ abstract class $ClashConfigCopyWith<$Res> { _$ClashConfigCopyWithImpl<$Res, ClashConfig>; @useResult $Res call( - {@JsonKey(name: "mixed-port") int mixedPort, - @JsonKey(name: "socks-port") int socksPort, - @JsonKey(name: "port") int port, - @JsonKey(name: "redir-port") int redirPort, - @JsonKey(name: "tproxy-port") int tproxyPort, + {@JsonKey(name: 'mixed-port') int mixedPort, + @JsonKey(name: 'socks-port') int socksPort, + @JsonKey(name: 'port') int port, + @JsonKey(name: 'redir-port') int redirPort, + @JsonKey(name: 'tproxy-port') int tproxyPort, Mode mode, - @JsonKey(name: "allow-lan") bool allowLan, - @JsonKey(name: "log-level") LogLevel logLevel, + @JsonKey(name: 'allow-lan') bool allowLan, + @JsonKey(name: 'log-level') LogLevel logLevel, bool ipv6, @JsonKey( - name: "find-process-mode", unknownEnumValue: FindProcessMode.always) + name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) FindProcessMode findProcessMode, - @JsonKey(name: "keep-alive-interval") int keepAliveInterval, - @JsonKey(name: "unified-delay") bool unifiedDelay, - @JsonKey(name: "tcp-concurrent") bool tcpConcurrent, + @JsonKey(name: 'keep-alive-interval') int keepAliveInterval, + @JsonKey(name: 'unified-delay') bool unifiedDelay, + @JsonKey(name: 'tcp-concurrent') bool tcpConcurrent, @JsonKey(fromJson: Tun.safeFormJson) Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, - @JsonKey(name: "geox-url", fromJson: GeoXUrl.safeFormJson) + @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, - @JsonKey(name: "geodata-loader") GeodataLoader geodataLoader, - @JsonKey(name: "proxy-groups") List proxyGroups, + @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, + @JsonKey(name: 'proxy-groups') List proxyGroups, List rule, - @JsonKey(name: "global-ua") String? globalUa, - @JsonKey(name: "external-controller") + @JsonKey(name: 'global-ua') String? globalUa, + @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, Map hosts}); @@ -3745,30 +3745,30 @@ abstract class _$$ClashConfigImplCopyWith<$Res> @override @useResult $Res call( - {@JsonKey(name: "mixed-port") int mixedPort, - @JsonKey(name: "socks-port") int socksPort, - @JsonKey(name: "port") int port, - @JsonKey(name: "redir-port") int redirPort, - @JsonKey(name: "tproxy-port") int tproxyPort, + {@JsonKey(name: 'mixed-port') int mixedPort, + @JsonKey(name: 'socks-port') int socksPort, + @JsonKey(name: 'port') int port, + @JsonKey(name: 'redir-port') int redirPort, + @JsonKey(name: 'tproxy-port') int tproxyPort, Mode mode, - @JsonKey(name: "allow-lan") bool allowLan, - @JsonKey(name: "log-level") LogLevel logLevel, + @JsonKey(name: 'allow-lan') bool allowLan, + @JsonKey(name: 'log-level') LogLevel logLevel, bool ipv6, @JsonKey( - name: "find-process-mode", unknownEnumValue: FindProcessMode.always) + name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) FindProcessMode findProcessMode, - @JsonKey(name: "keep-alive-interval") int keepAliveInterval, - @JsonKey(name: "unified-delay") bool unifiedDelay, - @JsonKey(name: "tcp-concurrent") bool tcpConcurrent, + @JsonKey(name: 'keep-alive-interval') int keepAliveInterval, + @JsonKey(name: 'unified-delay') bool unifiedDelay, + @JsonKey(name: 'tcp-concurrent') bool tcpConcurrent, @JsonKey(fromJson: Tun.safeFormJson) Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, - @JsonKey(name: "geox-url", fromJson: GeoXUrl.safeFormJson) + @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, - @JsonKey(name: "geodata-loader") GeodataLoader geodataLoader, - @JsonKey(name: "proxy-groups") List proxyGroups, + @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, + @JsonKey(name: 'proxy-groups') List proxyGroups, List rule, - @JsonKey(name: "global-ua") String? globalUa, - @JsonKey(name: "external-controller") + @JsonKey(name: 'global-ua') String? globalUa, + @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, Map hosts}); @@ -3913,33 +3913,33 @@ class __$$ClashConfigImplCopyWithImpl<$Res> @JsonSerializable() class _$ClashConfigImpl implements _ClashConfig { const _$ClashConfigImpl( - {@JsonKey(name: "mixed-port") this.mixedPort = defaultMixedPort, - @JsonKey(name: "socks-port") this.socksPort = 0, - @JsonKey(name: "port") this.port = 0, - @JsonKey(name: "redir-port") this.redirPort = 0, - @JsonKey(name: "tproxy-port") this.tproxyPort = 0, + {@JsonKey(name: 'mixed-port') this.mixedPort = defaultMixedPort, + @JsonKey(name: 'socks-port') this.socksPort = 0, + @JsonKey(name: 'port') this.port = 0, + @JsonKey(name: 'redir-port') this.redirPort = 0, + @JsonKey(name: 'tproxy-port') this.tproxyPort = 0, this.mode = Mode.rule, - @JsonKey(name: "allow-lan") this.allowLan = false, - @JsonKey(name: "log-level") this.logLevel = LogLevel.error, + @JsonKey(name: 'allow-lan') this.allowLan = false, + @JsonKey(name: 'log-level') this.logLevel = LogLevel.error, this.ipv6 = false, @JsonKey( - name: "find-process-mode", unknownEnumValue: FindProcessMode.always) + name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) this.findProcessMode = FindProcessMode.off, - @JsonKey(name: "keep-alive-interval") + @JsonKey(name: 'keep-alive-interval') this.keepAliveInterval = defaultKeepAliveInterval, - @JsonKey(name: "unified-delay") this.unifiedDelay = true, - @JsonKey(name: "tcp-concurrent") this.tcpConcurrent = true, + @JsonKey(name: 'unified-delay') this.unifiedDelay = true, + @JsonKey(name: 'tcp-concurrent') this.tcpConcurrent = true, @JsonKey(fromJson: Tun.safeFormJson) this.tun = defaultTun, @JsonKey(fromJson: Dns.safeDnsFromJson) this.dns = defaultDns, - @JsonKey(name: "geox-url", fromJson: GeoXUrl.safeFormJson) + @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) this.geoXUrl = defaultGeoXUrl, - @JsonKey(name: "geodata-loader") + @JsonKey(name: 'geodata-loader') this.geodataLoader = GeodataLoader.memconservative, - @JsonKey(name: "proxy-groups") + @JsonKey(name: 'proxy-groups') final List proxyGroups = const [], final List rule = const [], - @JsonKey(name: "global-ua") this.globalUa, - @JsonKey(name: "external-controller") + @JsonKey(name: 'global-ua') this.globalUa, + @JsonKey(name: 'external-controller') this.externalController = ExternalControllerStatus.close, final Map hosts = const {}}) : _proxyGroups = proxyGroups, @@ -3950,43 +3950,43 @@ class _$ClashConfigImpl implements _ClashConfig { _$$ClashConfigImplFromJson(json); @override - @JsonKey(name: "mixed-port") + @JsonKey(name: 'mixed-port') final int mixedPort; @override - @JsonKey(name: "socks-port") + @JsonKey(name: 'socks-port') final int socksPort; @override - @JsonKey(name: "port") + @JsonKey(name: 'port') final int port; @override - @JsonKey(name: "redir-port") + @JsonKey(name: 'redir-port') final int redirPort; @override - @JsonKey(name: "tproxy-port") + @JsonKey(name: 'tproxy-port') final int tproxyPort; @override @JsonKey() final Mode mode; @override - @JsonKey(name: "allow-lan") + @JsonKey(name: 'allow-lan') final bool allowLan; @override - @JsonKey(name: "log-level") + @JsonKey(name: 'log-level') final LogLevel logLevel; @override @JsonKey() final bool ipv6; @override - @JsonKey(name: "find-process-mode", unknownEnumValue: FindProcessMode.always) + @JsonKey(name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) final FindProcessMode findProcessMode; @override - @JsonKey(name: "keep-alive-interval") + @JsonKey(name: 'keep-alive-interval') final int keepAliveInterval; @override - @JsonKey(name: "unified-delay") + @JsonKey(name: 'unified-delay') final bool unifiedDelay; @override - @JsonKey(name: "tcp-concurrent") + @JsonKey(name: 'tcp-concurrent') final bool tcpConcurrent; @override @JsonKey(fromJson: Tun.safeFormJson) @@ -3995,14 +3995,14 @@ class _$ClashConfigImpl implements _ClashConfig { @JsonKey(fromJson: Dns.safeDnsFromJson) final Dns dns; @override - @JsonKey(name: "geox-url", fromJson: GeoXUrl.safeFormJson) + @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) final GeoXUrl geoXUrl; @override - @JsonKey(name: "geodata-loader") + @JsonKey(name: 'geodata-loader') final GeodataLoader geodataLoader; final List _proxyGroups; @override - @JsonKey(name: "proxy-groups") + @JsonKey(name: 'proxy-groups') List get proxyGroups { if (_proxyGroups is EqualUnmodifiableListView) return _proxyGroups; // ignore: implicit_dynamic_type @@ -4019,10 +4019,10 @@ class _$ClashConfigImpl implements _ClashConfig { } @override - @JsonKey(name: "global-ua") + @JsonKey(name: 'global-ua') final String? globalUa; @override - @JsonKey(name: "external-controller") + @JsonKey(name: 'external-controller') final ExternalControllerStatus externalController; final Map _hosts; @override @@ -4127,30 +4127,30 @@ class _$ClashConfigImpl implements _ClashConfig { abstract class _ClashConfig implements ClashConfig { const factory _ClashConfig( - {@JsonKey(name: "mixed-port") final int mixedPort, - @JsonKey(name: "socks-port") final int socksPort, - @JsonKey(name: "port") final int port, - @JsonKey(name: "redir-port") final int redirPort, - @JsonKey(name: "tproxy-port") final int tproxyPort, + {@JsonKey(name: 'mixed-port') final int mixedPort, + @JsonKey(name: 'socks-port') final int socksPort, + @JsonKey(name: 'port') final int port, + @JsonKey(name: 'redir-port') final int redirPort, + @JsonKey(name: 'tproxy-port') final int tproxyPort, final Mode mode, - @JsonKey(name: "allow-lan") final bool allowLan, - @JsonKey(name: "log-level") final LogLevel logLevel, + @JsonKey(name: 'allow-lan') final bool allowLan, + @JsonKey(name: 'log-level') final LogLevel logLevel, final bool ipv6, @JsonKey( - name: "find-process-mode", unknownEnumValue: FindProcessMode.always) + name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) final FindProcessMode findProcessMode, - @JsonKey(name: "keep-alive-interval") final int keepAliveInterval, - @JsonKey(name: "unified-delay") final bool unifiedDelay, - @JsonKey(name: "tcp-concurrent") final bool tcpConcurrent, + @JsonKey(name: 'keep-alive-interval') final int keepAliveInterval, + @JsonKey(name: 'unified-delay') final bool unifiedDelay, + @JsonKey(name: 'tcp-concurrent') final bool tcpConcurrent, @JsonKey(fromJson: Tun.safeFormJson) final Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) final Dns dns, - @JsonKey(name: "geox-url", fromJson: GeoXUrl.safeFormJson) + @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) final GeoXUrl geoXUrl, - @JsonKey(name: "geodata-loader") final GeodataLoader geodataLoader, - @JsonKey(name: "proxy-groups") final List proxyGroups, + @JsonKey(name: 'geodata-loader') final GeodataLoader geodataLoader, + @JsonKey(name: 'proxy-groups') final List proxyGroups, final List rule, - @JsonKey(name: "global-ua") final String? globalUa, - @JsonKey(name: "external-controller") + @JsonKey(name: 'global-ua') final String? globalUa, + @JsonKey(name: 'external-controller') final ExternalControllerStatus externalController, final Map hosts}) = _$ClashConfigImpl; @@ -4158,41 +4158,41 @@ abstract class _ClashConfig implements ClashConfig { _$ClashConfigImpl.fromJson; @override - @JsonKey(name: "mixed-port") + @JsonKey(name: 'mixed-port') int get mixedPort; @override - @JsonKey(name: "socks-port") + @JsonKey(name: 'socks-port') int get socksPort; @override - @JsonKey(name: "port") + @JsonKey(name: 'port') int get port; @override - @JsonKey(name: "redir-port") + @JsonKey(name: 'redir-port') int get redirPort; @override - @JsonKey(name: "tproxy-port") + @JsonKey(name: 'tproxy-port') int get tproxyPort; @override Mode get mode; @override - @JsonKey(name: "allow-lan") + @JsonKey(name: 'allow-lan') bool get allowLan; @override - @JsonKey(name: "log-level") + @JsonKey(name: 'log-level') LogLevel get logLevel; @override bool get ipv6; @override - @JsonKey(name: "find-process-mode", unknownEnumValue: FindProcessMode.always) + @JsonKey(name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) FindProcessMode get findProcessMode; @override - @JsonKey(name: "keep-alive-interval") + @JsonKey(name: 'keep-alive-interval') int get keepAliveInterval; @override - @JsonKey(name: "unified-delay") + @JsonKey(name: 'unified-delay') bool get unifiedDelay; @override - @JsonKey(name: "tcp-concurrent") + @JsonKey(name: 'tcp-concurrent') bool get tcpConcurrent; @override @JsonKey(fromJson: Tun.safeFormJson) @@ -4201,21 +4201,21 @@ abstract class _ClashConfig implements ClashConfig { @JsonKey(fromJson: Dns.safeDnsFromJson) Dns get dns; @override - @JsonKey(name: "geox-url", fromJson: GeoXUrl.safeFormJson) + @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl get geoXUrl; @override - @JsonKey(name: "geodata-loader") + @JsonKey(name: 'geodata-loader') GeodataLoader get geodataLoader; @override - @JsonKey(name: "proxy-groups") + @JsonKey(name: 'proxy-groups') List get proxyGroups; @override List get rule; @override - @JsonKey(name: "global-ua") + @JsonKey(name: 'global-ua') String? get globalUa; @override - @JsonKey(name: "external-controller") + @JsonKey(name: 'external-controller') ExternalControllerStatus get externalController; @override Map get hosts; diff --git a/lib/models/generated/clash_config.g.dart b/lib/models/generated/clash_config.g.dart index ed91bd7..38fd992 100644 --- a/lib/models/generated/clash_config.g.dart +++ b/lib/models/generated/clash_config.g.dart @@ -138,7 +138,7 @@ _$TunImpl _$$TunImplFromJson(Map json) => _$TunImpl( dnsHijack: (json['dns-hijack'] as List?) ?.map((e) => e as String) .toList() ?? - const ["any:53"], + const ['any:53'], routeAddress: (json['route-address'] as List?) ?.map((e) => e as String) .toList() ?? @@ -163,19 +163,19 @@ const _$TunStackEnumMap = { _$FallbackFilterImpl _$$FallbackFilterImplFromJson(Map json) => _$FallbackFilterImpl( geoip: json['geoip'] as bool? ?? true, - geoipCode: json['geoip-code'] as String? ?? "CN", + geoipCode: json['geoip-code'] as String? ?? 'CN', geosite: (json['geosite'] as List?) ?.map((e) => e as String) .toList() ?? - const ["gfw"], + const ['gfw'], ipcidr: (json['ipcidr'] as List?) ?.map((e) => e as String) .toList() ?? - const ["240.0.0.0/4"], + const ['240.0.0.0/4'], domain: (json['domain'] as List?) ?.map((e) => e as String) .toList() ?? - const ["+.google.com", "+.facebook.com", "+.youtube.com"], + const ['+.google.com', '+.facebook.com', '+.youtube.com'], ); Map _$$FallbackFilterImplToJson( @@ -190,7 +190,7 @@ Map _$$FallbackFilterImplToJson( _$DnsImpl _$$DnsImplFromJson(Map json) => _$DnsImpl( enable: json['enable'] as bool? ?? true, - listen: json['listen'] as String? ?? "0.0.0.0:1053", + listen: json['listen'] as String? ?? '0.0.0.0:1053', preferH3: json['prefer-h3'] as bool? ?? false, useHosts: json['use-hosts'] as bool? ?? true, useSystemHosts: json['use-system-hosts'] as bool? ?? true, @@ -199,39 +199,39 @@ _$DnsImpl _$$DnsImplFromJson(Map json) => _$DnsImpl( defaultNameserver: (json['default-nameserver'] as List?) ?.map((e) => e as String) .toList() ?? - const ["223.5.5.5"], + const ['223.5.5.5'], enhancedMode: $enumDecodeNullable(_$DnsModeEnumMap, json['enhanced-mode']) ?? DnsMode.fakeIp, - fakeIpRange: json['fake-ip-range'] as String? ?? "198.18.0.1/16", + fakeIpRange: json['fake-ip-range'] as String? ?? '198.18.0.1/16', fakeIpFilter: (json['fake-ip-filter'] as List?) ?.map((e) => e as String) .toList() ?? - const ["*.lan", "localhost.ptlogin2.qq.com"], + const ['*.lan', 'localhost.ptlogin2.qq.com'], nameserverPolicy: (json['nameserver-policy'] as Map?)?.map( (k, e) => MapEntry(k, e as String), ) ?? const { - "www.baidu.com": "114.114.114.114", - "+.internal.crop.com": "10.0.0.1", - "geosite:cn": "https://doh.pub/dns-query" + 'www.baidu.com': '114.114.114.114', + '+.internal.crop.com': '10.0.0.1', + 'geosite:cn': 'https://doh.pub/dns-query' }, nameserver: (json['nameserver'] as List?) ?.map((e) => e as String) .toList() ?? const [ - "https://doh.pub/dns-query", - "https://dns.alidns.com/dns-query" + 'https://doh.pub/dns-query', + 'https://dns.alidns.com/dns-query' ], fallback: (json['fallback'] as List?) ?.map((e) => e as String) .toList() ?? - const ["tls://8.8.4.4", "tls://1.1.1.1"], + const ['tls://8.8.4.4', 'tls://1.1.1.1'], proxyServerNameserver: (json['proxy-server-nameserver'] as List?) ?.map((e) => e as String) .toList() ?? - const ["https://doh.pub/dns-query"], + const ['https://doh.pub/dns-query'], fallbackFilter: json['fallback-filter'] == null ? const FallbackFilter() : FallbackFilter.fromJson( @@ -267,13 +267,13 @@ const _$DnsModeEnumMap = { _$GeoXUrlImpl _$$GeoXUrlImplFromJson(Map json) => _$GeoXUrlImpl( mmdb: json['mmdb'] as String? ?? - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb', asn: json['asn'] as String? ?? - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/GeoLite2-ASN.mmdb', geoip: json['geoip'] as String? ?? - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat', geosite: json['geosite'] as String? ?? - "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat", + 'https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat', ); Map _$$GeoXUrlImplToJson(_$GeoXUrlImpl instance) => @@ -418,7 +418,6 @@ const _$LogLevelEnumMap = { LogLevel.warning: 'warning', LogLevel.error: 'error', LogLevel.silent: 'silent', - LogLevel.app: 'app', }; const _$FindProcessModeEnumMap = { diff --git a/lib/models/generated/common.freezed.dart b/lib/models/generated/common.freezed.dart index b2b7819..190fc84 100644 --- a/lib/models/generated/common.freezed.dart +++ b/lib/models/generated/common.freezed.dart @@ -19,7 +19,7 @@ mixin _$NavigationItem { Icon get icon => throw _privateConstructorUsedError; PageLabel get label => throw _privateConstructorUsedError; String? get description => throw _privateConstructorUsedError; - Widget get view => throw _privateConstructorUsedError; + WidgetBuilder get builder => throw _privateConstructorUsedError; bool get keep => throw _privateConstructorUsedError; String? get path => throw _privateConstructorUsedError; List get modes => throw _privateConstructorUsedError; @@ -41,7 +41,7 @@ abstract class $NavigationItemCopyWith<$Res> { {Icon icon, PageLabel label, String? description, - Widget view, + WidgetBuilder builder, bool keep, String? path, List modes}); @@ -65,7 +65,7 @@ class _$NavigationItemCopyWithImpl<$Res, $Val extends NavigationItem> Object? icon = null, Object? label = null, Object? description = freezed, - Object? view = null, + Object? builder = null, Object? keep = null, Object? path = freezed, Object? modes = null, @@ -83,10 +83,10 @@ class _$NavigationItemCopyWithImpl<$Res, $Val extends NavigationItem> ? _value.description : description // ignore: cast_nullable_to_non_nullable as String?, - view: null == view - ? _value.view - : view // ignore: cast_nullable_to_non_nullable - as Widget, + builder: null == builder + ? _value.builder + : builder // ignore: cast_nullable_to_non_nullable + as WidgetBuilder, keep: null == keep ? _value.keep : keep // ignore: cast_nullable_to_non_nullable @@ -115,7 +115,7 @@ abstract class _$$NavigationItemImplCopyWith<$Res> {Icon icon, PageLabel label, String? description, - Widget view, + WidgetBuilder builder, bool keep, String? path, List modes}); @@ -137,7 +137,7 @@ class __$$NavigationItemImplCopyWithImpl<$Res> Object? icon = null, Object? label = null, Object? description = freezed, - Object? view = null, + Object? builder = null, Object? keep = null, Object? path = freezed, Object? modes = null, @@ -155,10 +155,10 @@ class __$$NavigationItemImplCopyWithImpl<$Res> ? _value.description : description // ignore: cast_nullable_to_non_nullable as String?, - view: null == view - ? _value.view - : view // ignore: cast_nullable_to_non_nullable - as Widget, + builder: null == builder + ? _value.builder + : builder // ignore: cast_nullable_to_non_nullable + as WidgetBuilder, keep: null == keep ? _value.keep : keep // ignore: cast_nullable_to_non_nullable @@ -182,7 +182,7 @@ class _$NavigationItemImpl implements _NavigationItem { {required this.icon, required this.label, this.description, - required this.view, + required this.builder, this.keep = true, this.path, final List modes = const [ @@ -198,7 +198,7 @@ class _$NavigationItemImpl implements _NavigationItem { @override final String? description; @override - final Widget view; + final WidgetBuilder builder; @override @JsonKey() final bool keep; @@ -215,7 +215,7 @@ class _$NavigationItemImpl implements _NavigationItem { @override String toString() { - return 'NavigationItem(icon: $icon, label: $label, description: $description, view: $view, keep: $keep, path: $path, modes: $modes)'; + return 'NavigationItem(icon: $icon, label: $label, description: $description, builder: $builder, keep: $keep, path: $path, modes: $modes)'; } @override @@ -227,15 +227,15 @@ class _$NavigationItemImpl implements _NavigationItem { (identical(other.label, label) || other.label == label) && (identical(other.description, description) || other.description == description) && - (identical(other.view, view) || other.view == view) && + (identical(other.builder, builder) || other.builder == builder) && (identical(other.keep, keep) || other.keep == keep) && (identical(other.path, path) || other.path == path) && const DeepCollectionEquality().equals(other._modes, _modes)); } @override - int get hashCode => Object.hash(runtimeType, icon, label, description, view, - keep, path, const DeepCollectionEquality().hash(_modes)); + int get hashCode => Object.hash(runtimeType, icon, label, description, + builder, keep, path, const DeepCollectionEquality().hash(_modes)); /// Create a copy of NavigationItem /// with the given fields replaced by the non-null parameter values. @@ -252,7 +252,7 @@ abstract class _NavigationItem implements NavigationItem { {required final Icon icon, required final PageLabel label, final String? description, - required final Widget view, + required final WidgetBuilder builder, final bool keep, final String? path, final List modes}) = _$NavigationItemImpl; @@ -264,7 +264,7 @@ abstract class _NavigationItem implements NavigationItem { @override String? get description; @override - Widget get view; + WidgetBuilder get builder; @override bool get keep; @override @@ -526,8 +526,16 @@ mixin _$Metadata { String get destinationIP => throw _privateConstructorUsedError; String get destinationPort => throw _privateConstructorUsedError; String get host => throw _privateConstructorUsedError; + DnsMode? get dnsMode => throw _privateConstructorUsedError; String get process => throw _privateConstructorUsedError; + String get processPath => throw _privateConstructorUsedError; String get remoteDestination => throw _privateConstructorUsedError; + List get sourceGeoIP => throw _privateConstructorUsedError; + List get destinationGeoIP => throw _privateConstructorUsedError; + String get destinationIPASN => throw _privateConstructorUsedError; + String get sourceIPASN => throw _privateConstructorUsedError; + String get specialRules => throw _privateConstructorUsedError; + String get specialProxy => throw _privateConstructorUsedError; /// Serializes this Metadata to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -552,8 +560,16 @@ abstract class $MetadataCopyWith<$Res> { String destinationIP, String destinationPort, String host, + DnsMode? dnsMode, String process, - String remoteDestination}); + String processPath, + String remoteDestination, + List sourceGeoIP, + List destinationGeoIP, + String destinationIPASN, + String sourceIPASN, + String specialRules, + String specialProxy}); } /// @nodoc @@ -578,8 +594,16 @@ class _$MetadataCopyWithImpl<$Res, $Val extends Metadata> Object? destinationIP = null, Object? destinationPort = null, Object? host = null, + Object? dnsMode = freezed, Object? process = null, + Object? processPath = null, Object? remoteDestination = null, + Object? sourceGeoIP = null, + Object? destinationGeoIP = null, + Object? destinationIPASN = null, + Object? sourceIPASN = null, + Object? specialRules = null, + Object? specialProxy = null, }) { return _then(_value.copyWith( uid: null == uid @@ -610,14 +634,46 @@ class _$MetadataCopyWithImpl<$Res, $Val extends Metadata> ? _value.host : host // ignore: cast_nullable_to_non_nullable as String, + dnsMode: freezed == dnsMode + ? _value.dnsMode + : dnsMode // ignore: cast_nullable_to_non_nullable + as DnsMode?, process: null == process ? _value.process : process // ignore: cast_nullable_to_non_nullable as String, + processPath: null == processPath + ? _value.processPath + : processPath // ignore: cast_nullable_to_non_nullable + as String, remoteDestination: null == remoteDestination ? _value.remoteDestination : remoteDestination // ignore: cast_nullable_to_non_nullable as String, + sourceGeoIP: null == sourceGeoIP + ? _value.sourceGeoIP + : sourceGeoIP // ignore: cast_nullable_to_non_nullable + as List, + destinationGeoIP: null == destinationGeoIP + ? _value.destinationGeoIP + : destinationGeoIP // ignore: cast_nullable_to_non_nullable + as List, + destinationIPASN: null == destinationIPASN + ? _value.destinationIPASN + : destinationIPASN // ignore: cast_nullable_to_non_nullable + as String, + sourceIPASN: null == sourceIPASN + ? _value.sourceIPASN + : sourceIPASN // ignore: cast_nullable_to_non_nullable + as String, + specialRules: null == specialRules + ? _value.specialRules + : specialRules // ignore: cast_nullable_to_non_nullable + as String, + specialProxy: null == specialProxy + ? _value.specialProxy + : specialProxy // ignore: cast_nullable_to_non_nullable + as String, ) as $Val); } } @@ -638,8 +694,16 @@ abstract class _$$MetadataImplCopyWith<$Res> String destinationIP, String destinationPort, String host, + DnsMode? dnsMode, String process, - String remoteDestination}); + String processPath, + String remoteDestination, + List sourceGeoIP, + List destinationGeoIP, + String destinationIPASN, + String sourceIPASN, + String specialRules, + String specialProxy}); } /// @nodoc @@ -662,8 +726,16 @@ class __$$MetadataImplCopyWithImpl<$Res> Object? destinationIP = null, Object? destinationPort = null, Object? host = null, + Object? dnsMode = freezed, Object? process = null, + Object? processPath = null, Object? remoteDestination = null, + Object? sourceGeoIP = null, + Object? destinationGeoIP = null, + Object? destinationIPASN = null, + Object? sourceIPASN = null, + Object? specialRules = null, + Object? specialProxy = null, }) { return _then(_$MetadataImpl( uid: null == uid @@ -694,14 +766,46 @@ class __$$MetadataImplCopyWithImpl<$Res> ? _value.host : host // ignore: cast_nullable_to_non_nullable as String, + dnsMode: freezed == dnsMode + ? _value.dnsMode + : dnsMode // ignore: cast_nullable_to_non_nullable + as DnsMode?, process: null == process ? _value.process : process // ignore: cast_nullable_to_non_nullable as String, + processPath: null == processPath + ? _value.processPath + : processPath // ignore: cast_nullable_to_non_nullable + as String, remoteDestination: null == remoteDestination ? _value.remoteDestination : remoteDestination // ignore: cast_nullable_to_non_nullable as String, + sourceGeoIP: null == sourceGeoIP + ? _value._sourceGeoIP + : sourceGeoIP // ignore: cast_nullable_to_non_nullable + as List, + destinationGeoIP: null == destinationGeoIP + ? _value._destinationGeoIP + : destinationGeoIP // ignore: cast_nullable_to_non_nullable + as List, + destinationIPASN: null == destinationIPASN + ? _value.destinationIPASN + : destinationIPASN // ignore: cast_nullable_to_non_nullable + as String, + sourceIPASN: null == sourceIPASN + ? _value.sourceIPASN + : sourceIPASN // ignore: cast_nullable_to_non_nullable + as String, + specialRules: null == specialRules + ? _value.specialRules + : specialRules // ignore: cast_nullable_to_non_nullable + as String, + specialProxy: null == specialProxy + ? _value.specialProxy + : specialProxy // ignore: cast_nullable_to_non_nullable + as String, )); } } @@ -710,41 +814,96 @@ class __$$MetadataImplCopyWithImpl<$Res> @JsonSerializable() class _$MetadataImpl implements _Metadata { const _$MetadataImpl( - {required this.uid, - required this.network, - required this.sourceIP, - required this.sourcePort, - required this.destinationIP, - required this.destinationPort, - required this.host, - required this.process, - required this.remoteDestination}); + {this.uid = 0, + this.network = '', + this.sourceIP = '', + this.sourcePort = '', + this.destinationIP = '', + this.destinationPort = '', + this.host = '', + this.dnsMode, + this.process = '', + this.processPath = '', + this.remoteDestination = '', + final List sourceGeoIP = const [], + final List destinationGeoIP = const [], + this.destinationIPASN = '', + this.sourceIPASN = '', + this.specialRules = '', + this.specialProxy = ''}) + : _sourceGeoIP = sourceGeoIP, + _destinationGeoIP = destinationGeoIP; factory _$MetadataImpl.fromJson(Map json) => _$$MetadataImplFromJson(json); @override + @JsonKey() final int uid; @override + @JsonKey() final String network; @override + @JsonKey() final String sourceIP; @override + @JsonKey() final String sourcePort; @override + @JsonKey() final String destinationIP; @override + @JsonKey() final String destinationPort; @override + @JsonKey() final String host; @override + final DnsMode? dnsMode; + @override + @JsonKey() final String process; @override + @JsonKey() + final String processPath; + @override + @JsonKey() final String remoteDestination; + final List _sourceGeoIP; + @override + @JsonKey() + List get sourceGeoIP { + if (_sourceGeoIP is EqualUnmodifiableListView) return _sourceGeoIP; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_sourceGeoIP); + } + + final List _destinationGeoIP; + @override + @JsonKey() + List get destinationGeoIP { + if (_destinationGeoIP is EqualUnmodifiableListView) + return _destinationGeoIP; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_destinationGeoIP); + } + + @override + @JsonKey() + final String destinationIPASN; + @override + @JsonKey() + final String sourceIPASN; + @override + @JsonKey() + final String specialRules; + @override + @JsonKey() + final String specialProxy; @override String toString() { - return 'Metadata(uid: $uid, network: $network, sourceIP: $sourceIP, sourcePort: $sourcePort, destinationIP: $destinationIP, destinationPort: $destinationPort, host: $host, process: $process, remoteDestination: $remoteDestination)'; + return 'Metadata(uid: $uid, network: $network, sourceIP: $sourceIP, sourcePort: $sourcePort, destinationIP: $destinationIP, destinationPort: $destinationPort, host: $host, dnsMode: $dnsMode, process: $process, processPath: $processPath, remoteDestination: $remoteDestination, sourceGeoIP: $sourceGeoIP, destinationGeoIP: $destinationGeoIP, destinationIPASN: $destinationIPASN, sourceIPASN: $sourceIPASN, specialRules: $specialRules, specialProxy: $specialProxy)'; } @override @@ -763,9 +922,24 @@ class _$MetadataImpl implements _Metadata { (identical(other.destinationPort, destinationPort) || other.destinationPort == destinationPort) && (identical(other.host, host) || other.host == host) && + (identical(other.dnsMode, dnsMode) || other.dnsMode == dnsMode) && (identical(other.process, process) || other.process == process) && + (identical(other.processPath, processPath) || + other.processPath == processPath) && (identical(other.remoteDestination, remoteDestination) || - other.remoteDestination == remoteDestination)); + other.remoteDestination == remoteDestination) && + const DeepCollectionEquality() + .equals(other._sourceGeoIP, _sourceGeoIP) && + const DeepCollectionEquality() + .equals(other._destinationGeoIP, _destinationGeoIP) && + (identical(other.destinationIPASN, destinationIPASN) || + other.destinationIPASN == destinationIPASN) && + (identical(other.sourceIPASN, sourceIPASN) || + other.sourceIPASN == sourceIPASN) && + (identical(other.specialRules, specialRules) || + other.specialRules == specialRules) && + (identical(other.specialProxy, specialProxy) || + other.specialProxy == specialProxy)); } @JsonKey(includeFromJson: false, includeToJson: false) @@ -779,8 +953,16 @@ class _$MetadataImpl implements _Metadata { destinationIP, destinationPort, host, + dnsMode, process, - remoteDestination); + processPath, + remoteDestination, + const DeepCollectionEquality().hash(_sourceGeoIP), + const DeepCollectionEquality().hash(_destinationGeoIP), + destinationIPASN, + sourceIPASN, + specialRules, + specialProxy); /// Create a copy of Metadata /// with the given fields replaced by the non-null parameter values. @@ -800,15 +982,23 @@ class _$MetadataImpl implements _Metadata { abstract class _Metadata implements Metadata { const factory _Metadata( - {required final int uid, - required final String network, - required final String sourceIP, - required final String sourcePort, - required final String destinationIP, - required final String destinationPort, - required final String host, - required final String process, - required final String remoteDestination}) = _$MetadataImpl; + {final int uid, + final String network, + final String sourceIP, + final String sourcePort, + final String destinationIP, + final String destinationPort, + final String host, + final DnsMode? dnsMode, + final String process, + final String processPath, + final String remoteDestination, + final List sourceGeoIP, + final List destinationGeoIP, + final String destinationIPASN, + final String sourceIPASN, + final String specialRules, + final String specialProxy}) = _$MetadataImpl; factory _Metadata.fromJson(Map json) = _$MetadataImpl.fromJson; @@ -828,9 +1018,25 @@ abstract class _Metadata implements Metadata { @override String get host; @override + DnsMode? get dnsMode; + @override String get process; @override + String get processPath; + @override String get remoteDestination; + @override + List get sourceGeoIP; + @override + List get destinationGeoIP; + @override + String get destinationIPASN; + @override + String get sourceIPASN; + @override + String get specialRules; + @override + String get specialProxy; /// Create a copy of Metadata /// with the given fields replaced by the non-null parameter values. @@ -840,81 +1046,93 @@ abstract class _Metadata implements Metadata { throw _privateConstructorUsedError; } -Connection _$ConnectionFromJson(Map json) { - return _Connection.fromJson(json); +TrackerInfo _$TrackerInfoFromJson(Map json) { + return _TrackerInfo.fromJson(json); } /// @nodoc -mixin _$Connection { +mixin _$TrackerInfo { String get id => throw _privateConstructorUsedError; - num? get upload => throw _privateConstructorUsedError; - num? get download => throw _privateConstructorUsedError; + int get upload => throw _privateConstructorUsedError; + int get download => throw _privateConstructorUsedError; DateTime get start => throw _privateConstructorUsedError; Metadata get metadata => throw _privateConstructorUsedError; List get chains => throw _privateConstructorUsedError; + String get rule => throw _privateConstructorUsedError; + String get rulePayload => throw _privateConstructorUsedError; + int? get downloadSpeed => throw _privateConstructorUsedError; + int? get uploadSpeed => throw _privateConstructorUsedError; - /// Serializes this Connection to a JSON map. + /// Serializes this TrackerInfo to a JSON map. Map toJson() => throw _privateConstructorUsedError; - /// Create a copy of Connection + /// Create a copy of TrackerInfo /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - $ConnectionCopyWith get copyWith => + $TrackerInfoCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $ConnectionCopyWith<$Res> { - factory $ConnectionCopyWith( - Connection value, $Res Function(Connection) then) = - _$ConnectionCopyWithImpl<$Res, Connection>; +abstract class $TrackerInfoCopyWith<$Res> { + factory $TrackerInfoCopyWith( + TrackerInfo value, $Res Function(TrackerInfo) then) = + _$TrackerInfoCopyWithImpl<$Res, TrackerInfo>; @useResult $Res call( {String id, - num? upload, - num? download, + int upload, + int download, DateTime start, Metadata metadata, - List chains}); + List chains, + String rule, + String rulePayload, + int? downloadSpeed, + int? uploadSpeed}); $MetadataCopyWith<$Res> get metadata; } /// @nodoc -class _$ConnectionCopyWithImpl<$Res, $Val extends Connection> - implements $ConnectionCopyWith<$Res> { - _$ConnectionCopyWithImpl(this._value, this._then); +class _$TrackerInfoCopyWithImpl<$Res, $Val extends TrackerInfo> + implements $TrackerInfoCopyWith<$Res> { + _$TrackerInfoCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; // ignore: unused_field final $Res Function($Val) _then; - /// Create a copy of Connection + /// Create a copy of TrackerInfo /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ Object? id = null, - Object? upload = freezed, - Object? download = freezed, + Object? upload = null, + Object? download = null, Object? start = null, Object? metadata = null, Object? chains = null, + Object? rule = null, + Object? rulePayload = null, + Object? downloadSpeed = freezed, + Object? uploadSpeed = freezed, }) { return _then(_value.copyWith( id: null == id ? _value.id : id // ignore: cast_nullable_to_non_nullable as String, - upload: freezed == upload + upload: null == upload ? _value.upload : upload // ignore: cast_nullable_to_non_nullable - as num?, - download: freezed == download + as int, + download: null == download ? _value.download : download // ignore: cast_nullable_to_non_nullable - as num?, + as int, start: null == start ? _value.start : start // ignore: cast_nullable_to_non_nullable @@ -927,10 +1145,26 @@ class _$ConnectionCopyWithImpl<$Res, $Val extends Connection> ? _value.chains : chains // ignore: cast_nullable_to_non_nullable as List, + rule: null == rule + ? _value.rule + : rule // ignore: cast_nullable_to_non_nullable + as String, + rulePayload: null == rulePayload + ? _value.rulePayload + : rulePayload // ignore: cast_nullable_to_non_nullable + as String, + downloadSpeed: freezed == downloadSpeed + ? _value.downloadSpeed + : downloadSpeed // ignore: cast_nullable_to_non_nullable + as int?, + uploadSpeed: freezed == uploadSpeed + ? _value.uploadSpeed + : uploadSpeed // ignore: cast_nullable_to_non_nullable + as int?, ) as $Val); } - /// Create a copy of Connection + /// Create a copy of TrackerInfo /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') @@ -942,58 +1176,66 @@ class _$ConnectionCopyWithImpl<$Res, $Val extends Connection> } /// @nodoc -abstract class _$$ConnectionImplCopyWith<$Res> - implements $ConnectionCopyWith<$Res> { - factory _$$ConnectionImplCopyWith( - _$ConnectionImpl value, $Res Function(_$ConnectionImpl) then) = - __$$ConnectionImplCopyWithImpl<$Res>; +abstract class _$$TrackerInfoImplCopyWith<$Res> + implements $TrackerInfoCopyWith<$Res> { + factory _$$TrackerInfoImplCopyWith( + _$TrackerInfoImpl value, $Res Function(_$TrackerInfoImpl) then) = + __$$TrackerInfoImplCopyWithImpl<$Res>; @override @useResult $Res call( {String id, - num? upload, - num? download, + int upload, + int download, DateTime start, Metadata metadata, - List chains}); + List chains, + String rule, + String rulePayload, + int? downloadSpeed, + int? uploadSpeed}); @override $MetadataCopyWith<$Res> get metadata; } /// @nodoc -class __$$ConnectionImplCopyWithImpl<$Res> - extends _$ConnectionCopyWithImpl<$Res, _$ConnectionImpl> - implements _$$ConnectionImplCopyWith<$Res> { - __$$ConnectionImplCopyWithImpl( - _$ConnectionImpl _value, $Res Function(_$ConnectionImpl) _then) +class __$$TrackerInfoImplCopyWithImpl<$Res> + extends _$TrackerInfoCopyWithImpl<$Res, _$TrackerInfoImpl> + implements _$$TrackerInfoImplCopyWith<$Res> { + __$$TrackerInfoImplCopyWithImpl( + _$TrackerInfoImpl _value, $Res Function(_$TrackerInfoImpl) _then) : super(_value, _then); - /// Create a copy of Connection + /// Create a copy of TrackerInfo /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ Object? id = null, - Object? upload = freezed, - Object? download = freezed, + Object? upload = null, + Object? download = null, Object? start = null, Object? metadata = null, Object? chains = null, + Object? rule = null, + Object? rulePayload = null, + Object? downloadSpeed = freezed, + Object? uploadSpeed = freezed, }) { - return _then(_$ConnectionImpl( + return _then(_$TrackerInfoImpl( id: null == id ? _value.id : id // ignore: cast_nullable_to_non_nullable as String, - upload: freezed == upload + upload: null == upload ? _value.upload : upload // ignore: cast_nullable_to_non_nullable - as num?, - download: freezed == download + as int, + download: null == download ? _value.download : download // ignore: cast_nullable_to_non_nullable - as num?, + as int, start: null == start ? _value.start : start // ignore: cast_nullable_to_non_nullable @@ -1006,31 +1248,53 @@ class __$$ConnectionImplCopyWithImpl<$Res> ? _value._chains : chains // ignore: cast_nullable_to_non_nullable as List, + rule: null == rule + ? _value.rule + : rule // ignore: cast_nullable_to_non_nullable + as String, + rulePayload: null == rulePayload + ? _value.rulePayload + : rulePayload // ignore: cast_nullable_to_non_nullable + as String, + downloadSpeed: freezed == downloadSpeed + ? _value.downloadSpeed + : downloadSpeed // ignore: cast_nullable_to_non_nullable + as int?, + uploadSpeed: freezed == uploadSpeed + ? _value.uploadSpeed + : uploadSpeed // ignore: cast_nullable_to_non_nullable + as int?, )); } } /// @nodoc @JsonSerializable() -class _$ConnectionImpl implements _Connection { - const _$ConnectionImpl( +class _$TrackerInfoImpl implements _TrackerInfo { + const _$TrackerInfoImpl( {required this.id, - this.upload, - this.download, + this.upload = 0, + this.download = 0, required this.start, required this.metadata, - required final List chains}) + required final List chains, + required this.rule, + required this.rulePayload, + this.downloadSpeed, + this.uploadSpeed}) : _chains = chains; - factory _$ConnectionImpl.fromJson(Map json) => - _$$ConnectionImplFromJson(json); + factory _$TrackerInfoImpl.fromJson(Map json) => + _$$TrackerInfoImplFromJson(json); @override final String id; @override - final num? upload; + @JsonKey() + final int upload; @override - final num? download; + @JsonKey() + final int download; @override final DateTime start; @override @@ -1043,16 +1307,25 @@ class _$ConnectionImpl implements _Connection { return EqualUnmodifiableListView(_chains); } + @override + final String rule; + @override + final String rulePayload; + @override + final int? downloadSpeed; + @override + final int? uploadSpeed; + @override String toString() { - return 'Connection(id: $id, upload: $upload, download: $download, start: $start, metadata: $metadata, chains: $chains)'; + return 'TrackerInfo(id: $id, upload: $upload, download: $download, start: $start, metadata: $metadata, chains: $chains, rule: $rule, rulePayload: $rulePayload, downloadSpeed: $downloadSpeed, uploadSpeed: $uploadSpeed)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ConnectionImpl && + other is _$TrackerInfoImpl && (identical(other.id, id) || other.id == id) && (identical(other.upload, upload) || other.upload == upload) && (identical(other.download, download) || @@ -1060,60 +1333,89 @@ class _$ConnectionImpl implements _Connection { (identical(other.start, start) || other.start == start) && (identical(other.metadata, metadata) || other.metadata == metadata) && - const DeepCollectionEquality().equals(other._chains, _chains)); + const DeepCollectionEquality().equals(other._chains, _chains) && + (identical(other.rule, rule) || other.rule == rule) && + (identical(other.rulePayload, rulePayload) || + other.rulePayload == rulePayload) && + (identical(other.downloadSpeed, downloadSpeed) || + other.downloadSpeed == downloadSpeed) && + (identical(other.uploadSpeed, uploadSpeed) || + other.uploadSpeed == uploadSpeed)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash(runtimeType, id, upload, download, start, - metadata, const DeepCollectionEquality().hash(_chains)); + int get hashCode => Object.hash( + runtimeType, + id, + upload, + download, + start, + metadata, + const DeepCollectionEquality().hash(_chains), + rule, + rulePayload, + downloadSpeed, + uploadSpeed); - /// Create a copy of Connection + /// Create a copy of TrackerInfo /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') - _$$ConnectionImplCopyWith<_$ConnectionImpl> get copyWith => - __$$ConnectionImplCopyWithImpl<_$ConnectionImpl>(this, _$identity); + _$$TrackerInfoImplCopyWith<_$TrackerInfoImpl> get copyWith => + __$$TrackerInfoImplCopyWithImpl<_$TrackerInfoImpl>(this, _$identity); @override Map toJson() { - return _$$ConnectionImplToJson( + return _$$TrackerInfoImplToJson( this, ); } } -abstract class _Connection implements Connection { - const factory _Connection( +abstract class _TrackerInfo implements TrackerInfo { + const factory _TrackerInfo( {required final String id, - final num? upload, - final num? download, + final int upload, + final int download, required final DateTime start, required final Metadata metadata, - required final List chains}) = _$ConnectionImpl; + required final List chains, + required final String rule, + required final String rulePayload, + final int? downloadSpeed, + final int? uploadSpeed}) = _$TrackerInfoImpl; - factory _Connection.fromJson(Map json) = - _$ConnectionImpl.fromJson; + factory _TrackerInfo.fromJson(Map json) = + _$TrackerInfoImpl.fromJson; @override String get id; @override - num? get upload; + int get upload; @override - num? get download; + int get download; @override DateTime get start; @override Metadata get metadata; @override List get chains; + @override + String get rule; + @override + String get rulePayload; + @override + int? get downloadSpeed; + @override + int? get uploadSpeed; - /// Create a copy of Connection + /// Create a copy of TrackerInfo /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConnectionImplCopyWith<_$ConnectionImpl> get copyWith => + _$$TrackerInfoImplCopyWith<_$TrackerInfoImpl> get copyWith => throw _privateConstructorUsedError; } @@ -1123,9 +1425,10 @@ Log _$LogFromJson(Map json) { /// @nodoc mixin _$Log { - @JsonKey(name: "LogLevel") +// @JsonKey(fromJson: _logId) required String id, + @JsonKey(name: 'LogLevel') LogLevel get logLevel => throw _privateConstructorUsedError; - @JsonKey(name: "Payload") + @JsonKey(name: 'Payload') String get payload => throw _privateConstructorUsedError; @JsonKey(fromJson: _logDateTime) String get dateTime => throw _privateConstructorUsedError; @@ -1145,8 +1448,8 @@ abstract class $LogCopyWith<$Res> { _$LogCopyWithImpl<$Res, Log>; @useResult $Res call( - {@JsonKey(name: "LogLevel") LogLevel logLevel, - @JsonKey(name: "Payload") String payload, + {@JsonKey(name: 'LogLevel') LogLevel logLevel, + @JsonKey(name: 'Payload') String payload, @JsonKey(fromJson: _logDateTime) String dateTime}); } @@ -1192,8 +1495,8 @@ abstract class _$$LogImplCopyWith<$Res> implements $LogCopyWith<$Res> { @override @useResult $Res call( - {@JsonKey(name: "LogLevel") LogLevel logLevel, - @JsonKey(name: "Payload") String payload, + {@JsonKey(name: 'LogLevel') LogLevel logLevel, + @JsonKey(name: 'Payload') String payload, @JsonKey(fromJson: _logDateTime) String dateTime}); } @@ -1233,18 +1536,19 @@ class __$$LogImplCopyWithImpl<$Res> extends _$LogCopyWithImpl<$Res, _$LogImpl> @JsonSerializable() class _$LogImpl implements _Log { const _$LogImpl( - {@JsonKey(name: "LogLevel") this.logLevel = LogLevel.app, - @JsonKey(name: "Payload") this.payload = "", + {@JsonKey(name: 'LogLevel') this.logLevel = LogLevel.info, + @JsonKey(name: 'Payload') this.payload = '', @JsonKey(fromJson: _logDateTime) required this.dateTime}); factory _$LogImpl.fromJson(Map json) => _$$LogImplFromJson(json); +// @JsonKey(fromJson: _logId) required String id, @override - @JsonKey(name: "LogLevel") + @JsonKey(name: 'LogLevel') final LogLevel logLevel; @override - @JsonKey(name: "Payload") + @JsonKey(name: 'Payload') final String payload; @override @JsonKey(fromJson: _logDateTime) @@ -1289,18 +1593,19 @@ class _$LogImpl implements _Log { abstract class _Log implements Log { const factory _Log( - {@JsonKey(name: "LogLevel") final LogLevel logLevel, - @JsonKey(name: "Payload") final String payload, + {@JsonKey(name: 'LogLevel') final LogLevel logLevel, + @JsonKey(name: 'Payload') final String payload, @JsonKey(fromJson: _logDateTime) required final String dateTime}) = _$LogImpl; factory _Log.fromJson(Map json) = _$LogImpl.fromJson; +// @JsonKey(fromJson: _logId) required String id, @override - @JsonKey(name: "LogLevel") + @JsonKey(name: 'LogLevel') LogLevel get logLevel; @override - @JsonKey(name: "Payload") + @JsonKey(name: 'Payload') String get payload; @override @JsonKey(fromJson: _logDateTime) @@ -1319,7 +1624,7 @@ mixin _$LogsState { List get logs => throw _privateConstructorUsedError; List get keywords => throw _privateConstructorUsedError; String get query => throw _privateConstructorUsedError; - bool get loading => throw _privateConstructorUsedError; + bool get autoScrollToEnd => throw _privateConstructorUsedError; /// Create a copy of LogsState /// with the given fields replaced by the non-null parameter values. @@ -1334,7 +1639,10 @@ abstract class $LogsStateCopyWith<$Res> { _$LogsStateCopyWithImpl<$Res, LogsState>; @useResult $Res call( - {List logs, List keywords, String query, bool loading}); + {List logs, + List keywords, + String query, + bool autoScrollToEnd}); } /// @nodoc @@ -1355,7 +1663,7 @@ class _$LogsStateCopyWithImpl<$Res, $Val extends LogsState> Object? logs = null, Object? keywords = null, Object? query = null, - Object? loading = null, + Object? autoScrollToEnd = null, }) { return _then(_value.copyWith( logs: null == logs @@ -1370,9 +1678,9 @@ class _$LogsStateCopyWithImpl<$Res, $Val extends LogsState> ? _value.query : query // ignore: cast_nullable_to_non_nullable as String, - loading: null == loading - ? _value.loading - : loading // ignore: cast_nullable_to_non_nullable + autoScrollToEnd: null == autoScrollToEnd + ? _value.autoScrollToEnd + : autoScrollToEnd // ignore: cast_nullable_to_non_nullable as bool, ) as $Val); } @@ -1387,7 +1695,10 @@ abstract class _$$LogsStateImplCopyWith<$Res> @override @useResult $Res call( - {List logs, List keywords, String query, bool loading}); + {List logs, + List keywords, + String query, + bool autoScrollToEnd}); } /// @nodoc @@ -1406,7 +1717,7 @@ class __$$LogsStateImplCopyWithImpl<$Res> Object? logs = null, Object? keywords = null, Object? query = null, - Object? loading = null, + Object? autoScrollToEnd = null, }) { return _then(_$LogsStateImpl( logs: null == logs @@ -1421,9 +1732,9 @@ class __$$LogsStateImplCopyWithImpl<$Res> ? _value.query : query // ignore: cast_nullable_to_non_nullable as String, - loading: null == loading - ? _value.loading - : loading // ignore: cast_nullable_to_non_nullable + autoScrollToEnd: null == autoScrollToEnd + ? _value.autoScrollToEnd + : autoScrollToEnd // ignore: cast_nullable_to_non_nullable as bool, )); } @@ -1435,8 +1746,8 @@ class _$LogsStateImpl implements _LogsState { const _$LogsStateImpl( {final List logs = const [], final List keywords = const [], - this.query = "", - this.loading = false}) + this.query = '', + this.autoScrollToEnd = true}) : _logs = logs, _keywords = keywords; @@ -1463,11 +1774,11 @@ class _$LogsStateImpl implements _LogsState { final String query; @override @JsonKey() - final bool loading; + final bool autoScrollToEnd; @override String toString() { - return 'LogsState(logs: $logs, keywords: $keywords, query: $query, loading: $loading)'; + return 'LogsState(logs: $logs, keywords: $keywords, query: $query, autoScrollToEnd: $autoScrollToEnd)'; } @override @@ -1478,7 +1789,8 @@ class _$LogsStateImpl implements _LogsState { const DeepCollectionEquality().equals(other._logs, _logs) && const DeepCollectionEquality().equals(other._keywords, _keywords) && (identical(other.query, query) || other.query == query) && - (identical(other.loading, loading) || other.loading == loading)); + (identical(other.autoScrollToEnd, autoScrollToEnd) || + other.autoScrollToEnd == autoScrollToEnd)); } @override @@ -1487,7 +1799,7 @@ class _$LogsStateImpl implements _LogsState { const DeepCollectionEquality().hash(_logs), const DeepCollectionEquality().hash(_keywords), query, - loading); + autoScrollToEnd); /// Create a copy of LogsState /// with the given fields replaced by the non-null parameter values. @@ -1503,7 +1815,7 @@ abstract class _LogsState implements LogsState { {final List logs, final List keywords, final String query, - final bool loading}) = _$LogsStateImpl; + final bool autoScrollToEnd}) = _$LogsStateImpl; @override List get logs; @@ -1512,7 +1824,7 @@ abstract class _LogsState implements LogsState { @override String get query; @override - bool get loading; + bool get autoScrollToEnd; /// Create a copy of LogsState /// with the given fields replaced by the non-null parameter values. @@ -1523,57 +1835,57 @@ abstract class _LogsState implements LogsState { } /// @nodoc -mixin _$ConnectionsState { - List get connections => throw _privateConstructorUsedError; +mixin _$TrackerInfosState { + List get trackerInfos => throw _privateConstructorUsedError; List get keywords => throw _privateConstructorUsedError; String get query => throw _privateConstructorUsedError; - bool get loading => throw _privateConstructorUsedError; + bool get autoScrollToEnd => throw _privateConstructorUsedError; - /// Create a copy of ConnectionsState + /// Create a copy of TrackerInfosState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - $ConnectionsStateCopyWith get copyWith => + $TrackerInfosStateCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $ConnectionsStateCopyWith<$Res> { - factory $ConnectionsStateCopyWith( - ConnectionsState value, $Res Function(ConnectionsState) then) = - _$ConnectionsStateCopyWithImpl<$Res, ConnectionsState>; +abstract class $TrackerInfosStateCopyWith<$Res> { + factory $TrackerInfosStateCopyWith( + TrackerInfosState value, $Res Function(TrackerInfosState) then) = + _$TrackerInfosStateCopyWithImpl<$Res, TrackerInfosState>; @useResult $Res call( - {List connections, + {List trackerInfos, List keywords, String query, - bool loading}); + bool autoScrollToEnd}); } /// @nodoc -class _$ConnectionsStateCopyWithImpl<$Res, $Val extends ConnectionsState> - implements $ConnectionsStateCopyWith<$Res> { - _$ConnectionsStateCopyWithImpl(this._value, this._then); +class _$TrackerInfosStateCopyWithImpl<$Res, $Val extends TrackerInfosState> + implements $TrackerInfosStateCopyWith<$Res> { + _$TrackerInfosStateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; // ignore: unused_field final $Res Function($Val) _then; - /// Create a copy of ConnectionsState + /// Create a copy of TrackerInfosState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ - Object? connections = null, + Object? trackerInfos = null, Object? keywords = null, Object? query = null, - Object? loading = null, + Object? autoScrollToEnd = null, }) { return _then(_value.copyWith( - connections: null == connections - ? _value.connections - : connections // ignore: cast_nullable_to_non_nullable - as List, + trackerInfos: null == trackerInfos + ? _value.trackerInfos + : trackerInfos // ignore: cast_nullable_to_non_nullable + as List, keywords: null == keywords ? _value.keywords : keywords // ignore: cast_nullable_to_non_nullable @@ -1582,52 +1894,52 @@ class _$ConnectionsStateCopyWithImpl<$Res, $Val extends ConnectionsState> ? _value.query : query // ignore: cast_nullable_to_non_nullable as String, - loading: null == loading - ? _value.loading - : loading // ignore: cast_nullable_to_non_nullable + autoScrollToEnd: null == autoScrollToEnd + ? _value.autoScrollToEnd + : autoScrollToEnd // ignore: cast_nullable_to_non_nullable as bool, ) as $Val); } } /// @nodoc -abstract class _$$ConnectionsStateImplCopyWith<$Res> - implements $ConnectionsStateCopyWith<$Res> { - factory _$$ConnectionsStateImplCopyWith(_$ConnectionsStateImpl value, - $Res Function(_$ConnectionsStateImpl) then) = - __$$ConnectionsStateImplCopyWithImpl<$Res>; +abstract class _$$TrackerInfosStateImplCopyWith<$Res> + implements $TrackerInfosStateCopyWith<$Res> { + factory _$$TrackerInfosStateImplCopyWith(_$TrackerInfosStateImpl value, + $Res Function(_$TrackerInfosStateImpl) then) = + __$$TrackerInfosStateImplCopyWithImpl<$Res>; @override @useResult $Res call( - {List connections, + {List trackerInfos, List keywords, String query, - bool loading}); + bool autoScrollToEnd}); } /// @nodoc -class __$$ConnectionsStateImplCopyWithImpl<$Res> - extends _$ConnectionsStateCopyWithImpl<$Res, _$ConnectionsStateImpl> - implements _$$ConnectionsStateImplCopyWith<$Res> { - __$$ConnectionsStateImplCopyWithImpl(_$ConnectionsStateImpl _value, - $Res Function(_$ConnectionsStateImpl) _then) +class __$$TrackerInfosStateImplCopyWithImpl<$Res> + extends _$TrackerInfosStateCopyWithImpl<$Res, _$TrackerInfosStateImpl> + implements _$$TrackerInfosStateImplCopyWith<$Res> { + __$$TrackerInfosStateImplCopyWithImpl(_$TrackerInfosStateImpl _value, + $Res Function(_$TrackerInfosStateImpl) _then) : super(_value, _then); - /// Create a copy of ConnectionsState + /// Create a copy of TrackerInfosState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ - Object? connections = null, + Object? trackerInfos = null, Object? keywords = null, Object? query = null, - Object? loading = null, + Object? autoScrollToEnd = null, }) { - return _then(_$ConnectionsStateImpl( - connections: null == connections - ? _value._connections - : connections // ignore: cast_nullable_to_non_nullable - as List, + return _then(_$TrackerInfosStateImpl( + trackerInfos: null == trackerInfos + ? _value._trackerInfos + : trackerInfos // ignore: cast_nullable_to_non_nullable + as List, keywords: null == keywords ? _value._keywords : keywords // ignore: cast_nullable_to_non_nullable @@ -1636,9 +1948,9 @@ class __$$ConnectionsStateImplCopyWithImpl<$Res> ? _value.query : query // ignore: cast_nullable_to_non_nullable as String, - loading: null == loading - ? _value.loading - : loading // ignore: cast_nullable_to_non_nullable + autoScrollToEnd: null == autoScrollToEnd + ? _value.autoScrollToEnd + : autoScrollToEnd // ignore: cast_nullable_to_non_nullable as bool, )); } @@ -1646,22 +1958,22 @@ class __$$ConnectionsStateImplCopyWithImpl<$Res> /// @nodoc -class _$ConnectionsStateImpl implements _ConnectionsState { - const _$ConnectionsStateImpl( - {final List connections = const [], +class _$TrackerInfosStateImpl implements _TrackerInfosState { + const _$TrackerInfosStateImpl( + {final List trackerInfos = const [], final List keywords = const [], - this.query = "", - this.loading = false}) - : _connections = connections, + this.query = '', + this.autoScrollToEnd = true}) + : _trackerInfos = trackerInfos, _keywords = keywords; - final List _connections; + final List _trackerInfos; @override @JsonKey() - List get connections { - if (_connections is EqualUnmodifiableListView) return _connections; + List get trackerInfos { + if (_trackerInfos is EqualUnmodifiableListView) return _trackerInfos; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_connections); + return EqualUnmodifiableListView(_trackerInfos); } final List _keywords; @@ -1678,64 +1990,65 @@ class _$ConnectionsStateImpl implements _ConnectionsState { final String query; @override @JsonKey() - final bool loading; + final bool autoScrollToEnd; @override String toString() { - return 'ConnectionsState(connections: $connections, keywords: $keywords, query: $query, loading: $loading)'; + return 'TrackerInfosState(trackerInfos: $trackerInfos, keywords: $keywords, query: $query, autoScrollToEnd: $autoScrollToEnd)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ConnectionsStateImpl && + other is _$TrackerInfosStateImpl && const DeepCollectionEquality() - .equals(other._connections, _connections) && + .equals(other._trackerInfos, _trackerInfos) && const DeepCollectionEquality().equals(other._keywords, _keywords) && (identical(other.query, query) || other.query == query) && - (identical(other.loading, loading) || other.loading == loading)); + (identical(other.autoScrollToEnd, autoScrollToEnd) || + other.autoScrollToEnd == autoScrollToEnd)); } @override int get hashCode => Object.hash( runtimeType, - const DeepCollectionEquality().hash(_connections), + const DeepCollectionEquality().hash(_trackerInfos), const DeepCollectionEquality().hash(_keywords), query, - loading); + autoScrollToEnd); - /// Create a copy of ConnectionsState + /// Create a copy of TrackerInfosState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') - _$$ConnectionsStateImplCopyWith<_$ConnectionsStateImpl> get copyWith => - __$$ConnectionsStateImplCopyWithImpl<_$ConnectionsStateImpl>( + _$$TrackerInfosStateImplCopyWith<_$TrackerInfosStateImpl> get copyWith => + __$$TrackerInfosStateImplCopyWithImpl<_$TrackerInfosStateImpl>( this, _$identity); } -abstract class _ConnectionsState implements ConnectionsState { - const factory _ConnectionsState( - {final List connections, +abstract class _TrackerInfosState implements TrackerInfosState { + const factory _TrackerInfosState( + {final List trackerInfos, final List keywords, final String query, - final bool loading}) = _$ConnectionsStateImpl; + final bool autoScrollToEnd}) = _$TrackerInfosStateImpl; @override - List get connections; + List get trackerInfos; @override List get keywords; @override String get query; @override - bool get loading; + bool get autoScrollToEnd; - /// Create a copy of ConnectionsState + /// Create a copy of TrackerInfosState /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) - _$$ConnectionsStateImplCopyWith<_$ConnectionsStateImpl> get copyWith => + _$$TrackerInfosStateImplCopyWith<_$TrackerInfosStateImpl> get copyWith => throw _privateConstructorUsedError; } @@ -2187,7 +2500,7 @@ class __$$VersionInfoImplCopyWithImpl<$Res> /// @nodoc @JsonSerializable() class _$VersionInfoImpl implements _VersionInfo { - const _$VersionInfoImpl({this.clashName = "", this.version = ""}); + const _$VersionInfoImpl({this.clashName = '', this.version = ''}); factory _$VersionInfoImpl.fromJson(Map json) => _$$VersionInfoImplFromJson(json); @@ -2608,7 +2921,7 @@ class _$GroupImpl implements _Group { this.now, this.hidden, this.testUrl, - this.icon = "", + this.icon = '', required this.name}) : _all = all; diff --git a/lib/models/generated/common.g.dart b/lib/models/generated/common.g.dart index 83c0b35..371744d 100644 --- a/lib/models/generated/common.g.dart +++ b/lib/models/generated/common.g.dart @@ -26,15 +26,29 @@ Map _$$PackageImplToJson(_$PackageImpl instance) => _$MetadataImpl _$$MetadataImplFromJson(Map json) => _$MetadataImpl( - uid: (json['uid'] as num).toInt(), - network: json['network'] as String, - sourceIP: json['sourceIP'] as String, - sourcePort: json['sourcePort'] as String, - destinationIP: json['destinationIP'] as String, - destinationPort: json['destinationPort'] as String, - host: json['host'] as String, - process: json['process'] as String, - remoteDestination: json['remoteDestination'] as String, + uid: (json['uid'] as num?)?.toInt() ?? 0, + network: json['network'] as String? ?? '', + sourceIP: json['sourceIP'] as String? ?? '', + sourcePort: json['sourcePort'] as String? ?? '', + destinationIP: json['destinationIP'] as String? ?? '', + destinationPort: json['destinationPort'] as String? ?? '', + host: json['host'] as String? ?? '', + dnsMode: $enumDecodeNullable(_$DnsModeEnumMap, json['dnsMode']), + process: json['process'] as String? ?? '', + processPath: json['processPath'] as String? ?? '', + remoteDestination: json['remoteDestination'] as String? ?? '', + sourceGeoIP: (json['sourceGeoIP'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], + destinationGeoIP: (json['destinationGeoIP'] as List?) + ?.map((e) => e as String) + .toList() ?? + const [], + destinationIPASN: json['destinationIPASN'] as String? ?? '', + sourceIPASN: json['sourceIPASN'] as String? ?? '', + specialRules: json['specialRules'] as String? ?? '', + specialProxy: json['specialProxy'] as String? ?? '', ); Map _$$MetadataImplToJson(_$MetadataImpl instance) => @@ -46,22 +60,41 @@ Map _$$MetadataImplToJson(_$MetadataImpl instance) => 'destinationIP': instance.destinationIP, 'destinationPort': instance.destinationPort, 'host': instance.host, + 'dnsMode': _$DnsModeEnumMap[instance.dnsMode], 'process': instance.process, + 'processPath': instance.processPath, 'remoteDestination': instance.remoteDestination, + 'sourceGeoIP': instance.sourceGeoIP, + 'destinationGeoIP': instance.destinationGeoIP, + 'destinationIPASN': instance.destinationIPASN, + 'sourceIPASN': instance.sourceIPASN, + 'specialRules': instance.specialRules, + 'specialProxy': instance.specialProxy, }; -_$ConnectionImpl _$$ConnectionImplFromJson(Map json) => - _$ConnectionImpl( +const _$DnsModeEnumMap = { + DnsMode.normal: 'normal', + DnsMode.fakeIp: 'fake-ip', + DnsMode.redirHost: 'redir-host', + DnsMode.hosts: 'hosts', +}; + +_$TrackerInfoImpl _$$TrackerInfoImplFromJson(Map json) => + _$TrackerInfoImpl( id: json['id'] as String, - upload: json['upload'] as num?, - download: json['download'] as num?, + upload: (json['upload'] as num?)?.toInt() ?? 0, + download: (json['download'] as num?)?.toInt() ?? 0, start: DateTime.parse(json['start'] as String), metadata: Metadata.fromJson(json['metadata'] as Map), chains: (json['chains'] as List).map((e) => e as String).toList(), + rule: json['rule'] as String, + rulePayload: json['rulePayload'] as String, + downloadSpeed: (json['downloadSpeed'] as num?)?.toInt(), + uploadSpeed: (json['uploadSpeed'] as num?)?.toInt(), ); -Map _$$ConnectionImplToJson(_$ConnectionImpl instance) => +Map _$$TrackerInfoImplToJson(_$TrackerInfoImpl instance) => { 'id': instance.id, 'upload': instance.upload, @@ -69,12 +102,16 @@ Map _$$ConnectionImplToJson(_$ConnectionImpl instance) => 'start': instance.start.toIso8601String(), 'metadata': instance.metadata, 'chains': instance.chains, + 'rule': instance.rule, + 'rulePayload': instance.rulePayload, + 'downloadSpeed': instance.downloadSpeed, + 'uploadSpeed': instance.uploadSpeed, }; _$LogImpl _$$LogImplFromJson(Map json) => _$LogImpl( logLevel: $enumDecodeNullable(_$LogLevelEnumMap, json['LogLevel']) ?? - LogLevel.app, - payload: json['Payload'] as String? ?? "", + LogLevel.info, + payload: json['Payload'] as String? ?? '', dateTime: _logDateTime(json['dateTime']), ); @@ -90,7 +127,6 @@ const _$LogLevelEnumMap = { LogLevel.warning: 'warning', LogLevel.error: 'error', LogLevel.silent: 'silent', - LogLevel.app: 'app', }; _$DAVImpl _$$DAVImplFromJson(Map json) => _$DAVImpl( @@ -109,8 +145,8 @@ Map _$$DAVImplToJson(_$DAVImpl instance) => { _$VersionInfoImpl _$$VersionInfoImplFromJson(Map json) => _$VersionInfoImpl( - clashName: json['clashName'] as String? ?? "", - version: json['version'] as String? ?? "", + clashName: json['clashName'] as String? ?? '', + version: json['version'] as String? ?? '', ); Map _$$VersionInfoImplToJson(_$VersionInfoImpl instance) => @@ -141,7 +177,7 @@ _$GroupImpl _$$GroupImplFromJson(Map json) => _$GroupImpl( now: json['now'] as String?, hidden: json['hidden'] as bool?, testUrl: json['testUrl'] as String?, - icon: json['icon'] as String? ?? "", + icon: json['icon'] as String? ?? '', name: json['name'] as String, ); diff --git a/lib/models/generated/config.freezed.dart b/lib/models/generated/config.freezed.dart index e9ed6d7..389bf1b 100644 --- a/lib/models/generated/config.freezed.dart +++ b/lib/models/generated/config.freezed.dart @@ -1824,8 +1824,8 @@ TextScale _$TextScaleFromJson(Map json) { /// @nodoc mixin _$TextScale { - dynamic get enable => throw _privateConstructorUsedError; - dynamic get scale => throw _privateConstructorUsedError; + bool get enable => throw _privateConstructorUsedError; + double get scale => throw _privateConstructorUsedError; /// Serializes this TextScale to a JSON map. Map toJson() => throw _privateConstructorUsedError; @@ -1842,7 +1842,7 @@ abstract class $TextScaleCopyWith<$Res> { factory $TextScaleCopyWith(TextScale value, $Res Function(TextScale) then) = _$TextScaleCopyWithImpl<$Res, TextScale>; @useResult - $Res call({dynamic enable, dynamic scale}); + $Res call({bool enable, double scale}); } /// @nodoc @@ -1860,18 +1860,18 @@ class _$TextScaleCopyWithImpl<$Res, $Val extends TextScale> @pragma('vm:prefer-inline') @override $Res call({ - Object? enable = freezed, - Object? scale = freezed, + Object? enable = null, + Object? scale = null, }) { return _then(_value.copyWith( - enable: freezed == enable + enable: null == enable ? _value.enable : enable // ignore: cast_nullable_to_non_nullable - as dynamic, - scale: freezed == scale + as bool, + scale: null == scale ? _value.scale : scale // ignore: cast_nullable_to_non_nullable - as dynamic, + as double, ) as $Val); } } @@ -1884,7 +1884,7 @@ abstract class _$$TextScaleImplCopyWith<$Res> __$$TextScaleImplCopyWithImpl<$Res>; @override @useResult - $Res call({dynamic enable, dynamic scale}); + $Res call({bool enable, double scale}); } /// @nodoc @@ -1900,12 +1900,18 @@ class __$$TextScaleImplCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({ - Object? enable = freezed, - Object? scale = freezed, + Object? enable = null, + Object? scale = null, }) { return _then(_$TextScaleImpl( - enable: freezed == enable ? _value.enable! : enable, - scale: freezed == scale ? _value.scale! : scale, + enable: null == enable + ? _value.enable + : enable // ignore: cast_nullable_to_non_nullable + as bool, + scale: null == scale + ? _value.scale + : scale // ignore: cast_nullable_to_non_nullable + as double, )); } } @@ -1920,10 +1926,10 @@ class _$TextScaleImpl implements _TextScale { @override @JsonKey() - final dynamic enable; + final bool enable; @override @JsonKey() - final dynamic scale; + final double scale; @override String toString() { @@ -1935,16 +1941,13 @@ class _$TextScaleImpl implements _TextScale { return identical(this, other) || (other.runtimeType == runtimeType && other is _$TextScaleImpl && - const DeepCollectionEquality().equals(other.enable, enable) && - const DeepCollectionEquality().equals(other.scale, scale)); + (identical(other.enable, enable) || other.enable == enable) && + (identical(other.scale, scale) || other.scale == scale)); } @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(enable), - const DeepCollectionEquality().hash(scale)); + int get hashCode => Object.hash(runtimeType, enable, scale); /// Create a copy of TextScale /// with the given fields replaced by the non-null parameter values. @@ -1963,16 +1966,16 @@ class _$TextScaleImpl implements _TextScale { } abstract class _TextScale implements TextScale { - const factory _TextScale({final dynamic enable, final dynamic scale}) = + const factory _TextScale({final bool enable, final double scale}) = _$TextScaleImpl; factory _TextScale.fromJson(Map json) = _$TextScaleImpl.fromJson; @override - dynamic get enable; + bool get enable; @override - dynamic get scale; + double get scale; /// Create a copy of TextScale /// with the given fields replaced by the non-null parameter values. diff --git a/lib/models/generated/config.g.dart b/lib/models/generated/config.g.dart index d962de1..708a473 100644 --- a/lib/models/generated/config.g.dart +++ b/lib/models/generated/config.g.dart @@ -238,8 +238,8 @@ const _$ProxyCardTypeEnumMap = { _$TextScaleImpl _$$TextScaleImplFromJson(Map json) => _$TextScaleImpl( - enable: json['enable'] ?? false, - scale: json['scale'] ?? 1.0, + enable: json['enable'] as bool? ?? false, + scale: (json['scale'] as num?)?.toDouble() ?? 1.0, ); Map _$$TextScaleImplToJson(_$TextScaleImpl instance) => diff --git a/lib/models/generated/core.freezed.dart b/lib/models/generated/core.freezed.dart index feb0a29..0e83f2d 100644 --- a/lib/models/generated/core.freezed.dart +++ b/lib/models/generated/core.freezed.dart @@ -20,11 +20,11 @@ SetupParams _$SetupParamsFromJson(Map json) { /// @nodoc mixin _$SetupParams { - @JsonKey(name: "config") + @JsonKey(name: 'config') Map get config => throw _privateConstructorUsedError; - @JsonKey(name: "selected-map") + @JsonKey(name: 'selected-map') Map get selectedMap => throw _privateConstructorUsedError; - @JsonKey(name: "test-url") + @JsonKey(name: 'test-url') String get testUrl => throw _privateConstructorUsedError; /// Serializes this SetupParams to a JSON map. @@ -44,9 +44,9 @@ abstract class $SetupParamsCopyWith<$Res> { _$SetupParamsCopyWithImpl<$Res, SetupParams>; @useResult $Res call( - {@JsonKey(name: "config") Map config, - @JsonKey(name: "selected-map") Map selectedMap, - @JsonKey(name: "test-url") String testUrl}); + {@JsonKey(name: 'config') Map config, + @JsonKey(name: 'selected-map') Map selectedMap, + @JsonKey(name: 'test-url') String testUrl}); } /// @nodoc @@ -94,9 +94,9 @@ abstract class _$$SetupParamsImplCopyWith<$Res> @override @useResult $Res call( - {@JsonKey(name: "config") Map config, - @JsonKey(name: "selected-map") Map selectedMap, - @JsonKey(name: "test-url") String testUrl}); + {@JsonKey(name: 'config') Map config, + @JsonKey(name: 'selected-map') Map selectedMap, + @JsonKey(name: 'test-url') String testUrl}); } /// @nodoc @@ -137,10 +137,10 @@ class __$$SetupParamsImplCopyWithImpl<$Res> @JsonSerializable() class _$SetupParamsImpl implements _SetupParams { const _$SetupParamsImpl( - {@JsonKey(name: "config") required final Map config, - @JsonKey(name: "selected-map") + {@JsonKey(name: 'config') required final Map config, + @JsonKey(name: 'selected-map') required final Map selectedMap, - @JsonKey(name: "test-url") required this.testUrl}) + @JsonKey(name: 'test-url') required this.testUrl}) : _config = config, _selectedMap = selectedMap; @@ -149,7 +149,7 @@ class _$SetupParamsImpl implements _SetupParams { final Map _config; @override - @JsonKey(name: "config") + @JsonKey(name: 'config') Map get config { if (_config is EqualUnmodifiableMapView) return _config; // ignore: implicit_dynamic_type @@ -158,7 +158,7 @@ class _$SetupParamsImpl implements _SetupParams { final Map _selectedMap; @override - @JsonKey(name: "selected-map") + @JsonKey(name: 'selected-map') Map get selectedMap { if (_selectedMap is EqualUnmodifiableMapView) return _selectedMap; // ignore: implicit_dynamic_type @@ -166,7 +166,7 @@ class _$SetupParamsImpl implements _SetupParams { } @override - @JsonKey(name: "test-url") + @JsonKey(name: 'test-url') final String testUrl; @override @@ -211,23 +211,23 @@ class _$SetupParamsImpl implements _SetupParams { abstract class _SetupParams implements SetupParams { const factory _SetupParams( - {@JsonKey(name: "config") required final Map config, - @JsonKey(name: "selected-map") + {@JsonKey(name: 'config') required final Map config, + @JsonKey(name: 'selected-map') required final Map selectedMap, - @JsonKey(name: "test-url") required final String testUrl}) = + @JsonKey(name: 'test-url') required final String testUrl}) = _$SetupParamsImpl; factory _SetupParams.fromJson(Map json) = _$SetupParamsImpl.fromJson; @override - @JsonKey(name: "config") + @JsonKey(name: 'config') Map get config; @override - @JsonKey(name: "selected-map") + @JsonKey(name: 'selected-map') Map get selectedMap; @override - @JsonKey(name: "test-url") + @JsonKey(name: 'test-url') String get testUrl; /// Create a copy of SetupParams @@ -637,13 +637,13 @@ CoreState _$CoreStateFromJson(Map json) { /// @nodoc mixin _$CoreState { - @JsonKey(name: "vpn-props") + @JsonKey(name: 'vpn-props') VpnProps get vpnProps => throw _privateConstructorUsedError; - @JsonKey(name: "only-statistics-proxy") + @JsonKey(name: 'only-statistics-proxy') bool get onlyStatisticsProxy => throw _privateConstructorUsedError; - @JsonKey(name: "current-profile-name") + @JsonKey(name: 'current-profile-name') String get currentProfileName => throw _privateConstructorUsedError; - @JsonKey(name: "bypass-domain") + @JsonKey(name: 'bypass-domain') List get bypassDomain => throw _privateConstructorUsedError; /// Serializes this CoreState to a JSON map. @@ -662,10 +662,10 @@ abstract class $CoreStateCopyWith<$Res> { _$CoreStateCopyWithImpl<$Res, CoreState>; @useResult $Res call( - {@JsonKey(name: "vpn-props") VpnProps vpnProps, - @JsonKey(name: "only-statistics-proxy") bool onlyStatisticsProxy, - @JsonKey(name: "current-profile-name") String currentProfileName, - @JsonKey(name: "bypass-domain") List bypassDomain}); + {@JsonKey(name: 'vpn-props') VpnProps vpnProps, + @JsonKey(name: 'only-statistics-proxy') bool onlyStatisticsProxy, + @JsonKey(name: 'current-profile-name') String currentProfileName, + @JsonKey(name: 'bypass-domain') List bypassDomain}); $VpnPropsCopyWith<$Res> get vpnProps; } @@ -730,10 +730,10 @@ abstract class _$$CoreStateImplCopyWith<$Res> @override @useResult $Res call( - {@JsonKey(name: "vpn-props") VpnProps vpnProps, - @JsonKey(name: "only-statistics-proxy") bool onlyStatisticsProxy, - @JsonKey(name: "current-profile-name") String currentProfileName, - @JsonKey(name: "bypass-domain") List bypassDomain}); + {@JsonKey(name: 'vpn-props') VpnProps vpnProps, + @JsonKey(name: 'only-statistics-proxy') bool onlyStatisticsProxy, + @JsonKey(name: 'current-profile-name') String currentProfileName, + @JsonKey(name: 'bypass-domain') List bypassDomain}); @override $VpnPropsCopyWith<$Res> get vpnProps; @@ -782,10 +782,10 @@ class __$$CoreStateImplCopyWithImpl<$Res> @JsonSerializable() class _$CoreStateImpl implements _CoreState { const _$CoreStateImpl( - {@JsonKey(name: "vpn-props") required this.vpnProps, - @JsonKey(name: "only-statistics-proxy") required this.onlyStatisticsProxy, - @JsonKey(name: "current-profile-name") required this.currentProfileName, - @JsonKey(name: "bypass-domain") + {@JsonKey(name: 'vpn-props') required this.vpnProps, + @JsonKey(name: 'only-statistics-proxy') required this.onlyStatisticsProxy, + @JsonKey(name: 'current-profile-name') required this.currentProfileName, + @JsonKey(name: 'bypass-domain') final List bypassDomain = const []}) : _bypassDomain = bypassDomain; @@ -793,17 +793,17 @@ class _$CoreStateImpl implements _CoreState { _$$CoreStateImplFromJson(json); @override - @JsonKey(name: "vpn-props") + @JsonKey(name: 'vpn-props') final VpnProps vpnProps; @override - @JsonKey(name: "only-statistics-proxy") + @JsonKey(name: 'only-statistics-proxy') final bool onlyStatisticsProxy; @override - @JsonKey(name: "current-profile-name") + @JsonKey(name: 'current-profile-name') final String currentProfileName; final List _bypassDomain; @override - @JsonKey(name: "bypass-domain") + @JsonKey(name: 'bypass-domain') List get bypassDomain { if (_bypassDomain is EqualUnmodifiableListView) return _bypassDomain; // ignore: implicit_dynamic_type @@ -853,28 +853,28 @@ class _$CoreStateImpl implements _CoreState { abstract class _CoreState implements CoreState { const factory _CoreState( - {@JsonKey(name: "vpn-props") required final VpnProps vpnProps, - @JsonKey(name: "only-statistics-proxy") + {@JsonKey(name: 'vpn-props') required final VpnProps vpnProps, + @JsonKey(name: 'only-statistics-proxy') required final bool onlyStatisticsProxy, - @JsonKey(name: "current-profile-name") + @JsonKey(name: 'current-profile-name') required final String currentProfileName, - @JsonKey(name: "bypass-domain") final List bypassDomain}) = + @JsonKey(name: 'bypass-domain') final List bypassDomain}) = _$CoreStateImpl; factory _CoreState.fromJson(Map json) = _$CoreStateImpl.fromJson; @override - @JsonKey(name: "vpn-props") + @JsonKey(name: 'vpn-props') VpnProps get vpnProps; @override - @JsonKey(name: "only-statistics-proxy") + @JsonKey(name: 'only-statistics-proxy') bool get onlyStatisticsProxy; @override - @JsonKey(name: "current-profile-name") + @JsonKey(name: 'current-profile-name') String get currentProfileName; @override - @JsonKey(name: "bypass-domain") + @JsonKey(name: 'bypass-domain') List get bypassDomain; /// Create a copy of CoreState @@ -1278,7 +1278,7 @@ InitParams _$InitParamsFromJson(Map json) { /// @nodoc mixin _$InitParams { - @JsonKey(name: "home-dir") + @JsonKey(name: 'home-dir') String get homeDir => throw _privateConstructorUsedError; int get version => throw _privateConstructorUsedError; @@ -1298,7 +1298,7 @@ abstract class $InitParamsCopyWith<$Res> { InitParams value, $Res Function(InitParams) then) = _$InitParamsCopyWithImpl<$Res, InitParams>; @useResult - $Res call({@JsonKey(name: "home-dir") String homeDir, int version}); + $Res call({@JsonKey(name: 'home-dir') String homeDir, int version}); } /// @nodoc @@ -1340,7 +1340,7 @@ abstract class _$$InitParamsImplCopyWith<$Res> __$$InitParamsImplCopyWithImpl<$Res>; @override @useResult - $Res call({@JsonKey(name: "home-dir") String homeDir, int version}); + $Res call({@JsonKey(name: 'home-dir') String homeDir, int version}); } /// @nodoc @@ -1376,14 +1376,14 @@ class __$$InitParamsImplCopyWithImpl<$Res> @JsonSerializable() class _$InitParamsImpl implements _InitParams { const _$InitParamsImpl( - {@JsonKey(name: "home-dir") required this.homeDir, + {@JsonKey(name: 'home-dir') required this.homeDir, required this.version}); factory _$InitParamsImpl.fromJson(Map json) => _$$InitParamsImplFromJson(json); @override - @JsonKey(name: "home-dir") + @JsonKey(name: 'home-dir') final String homeDir; @override final int version; @@ -1424,14 +1424,14 @@ class _$InitParamsImpl implements _InitParams { abstract class _InitParams implements InitParams { const factory _InitParams( - {@JsonKey(name: "home-dir") required final String homeDir, + {@JsonKey(name: 'home-dir') required final String homeDir, required final int version}) = _$InitParamsImpl; factory _InitParams.fromJson(Map json) = _$InitParamsImpl.fromJson; @override - @JsonKey(name: "home-dir") + @JsonKey(name: 'home-dir') String get homeDir; @override int get version; @@ -1450,9 +1450,9 @@ ChangeProxyParams _$ChangeProxyParamsFromJson(Map json) { /// @nodoc mixin _$ChangeProxyParams { - @JsonKey(name: "group-name") + @JsonKey(name: 'group-name') String get groupName => throw _privateConstructorUsedError; - @JsonKey(name: "proxy-name") + @JsonKey(name: 'proxy-name') String get proxyName => throw _privateConstructorUsedError; /// Serializes this ChangeProxyParams to a JSON map. @@ -1472,8 +1472,8 @@ abstract class $ChangeProxyParamsCopyWith<$Res> { _$ChangeProxyParamsCopyWithImpl<$Res, ChangeProxyParams>; @useResult $Res call( - {@JsonKey(name: "group-name") String groupName, - @JsonKey(name: "proxy-name") String proxyName}); + {@JsonKey(name: 'group-name') String groupName, + @JsonKey(name: 'proxy-name') String proxyName}); } /// @nodoc @@ -1516,8 +1516,8 @@ abstract class _$$ChangeProxyParamsImplCopyWith<$Res> @override @useResult $Res call( - {@JsonKey(name: "group-name") String groupName, - @JsonKey(name: "proxy-name") String proxyName}); + {@JsonKey(name: 'group-name') String groupName, + @JsonKey(name: 'proxy-name') String proxyName}); } /// @nodoc @@ -1553,17 +1553,17 @@ class __$$ChangeProxyParamsImplCopyWithImpl<$Res> @JsonSerializable() class _$ChangeProxyParamsImpl implements _ChangeProxyParams { const _$ChangeProxyParamsImpl( - {@JsonKey(name: "group-name") required this.groupName, - @JsonKey(name: "proxy-name") required this.proxyName}); + {@JsonKey(name: 'group-name') required this.groupName, + @JsonKey(name: 'proxy-name') required this.proxyName}); factory _$ChangeProxyParamsImpl.fromJson(Map json) => _$$ChangeProxyParamsImplFromJson(json); @override - @JsonKey(name: "group-name") + @JsonKey(name: 'group-name') final String groupName; @override - @JsonKey(name: "proxy-name") + @JsonKey(name: 'proxy-name') final String proxyName; @override @@ -1605,18 +1605,18 @@ class _$ChangeProxyParamsImpl implements _ChangeProxyParams { abstract class _ChangeProxyParams implements ChangeProxyParams { const factory _ChangeProxyParams( - {@JsonKey(name: "group-name") required final String groupName, - @JsonKey(name: "proxy-name") required final String proxyName}) = + {@JsonKey(name: 'group-name') required final String groupName, + @JsonKey(name: 'proxy-name') required final String proxyName}) = _$ChangeProxyParamsImpl; factory _ChangeProxyParams.fromJson(Map json) = _$ChangeProxyParamsImpl.fromJson; @override - @JsonKey(name: "group-name") + @JsonKey(name: 'group-name') String get groupName; @override - @JsonKey(name: "proxy-name") + @JsonKey(name: 'proxy-name') String get proxyName; /// Create a copy of ChangeProxyParams @@ -1633,9 +1633,9 @@ UpdateGeoDataParams _$UpdateGeoDataParamsFromJson(Map json) { /// @nodoc mixin _$UpdateGeoDataParams { - @JsonKey(name: "geo-type") + @JsonKey(name: 'geo-type') String get geoType => throw _privateConstructorUsedError; - @JsonKey(name: "geo-name") + @JsonKey(name: 'geo-name') String get geoName => throw _privateConstructorUsedError; /// Serializes this UpdateGeoDataParams to a JSON map. @@ -1655,8 +1655,8 @@ abstract class $UpdateGeoDataParamsCopyWith<$Res> { _$UpdateGeoDataParamsCopyWithImpl<$Res, UpdateGeoDataParams>; @useResult $Res call( - {@JsonKey(name: "geo-type") String geoType, - @JsonKey(name: "geo-name") String geoName}); + {@JsonKey(name: 'geo-type') String geoType, + @JsonKey(name: 'geo-name') String geoName}); } /// @nodoc @@ -1699,8 +1699,8 @@ abstract class _$$UpdateGeoDataParamsImplCopyWith<$Res> @override @useResult $Res call( - {@JsonKey(name: "geo-type") String geoType, - @JsonKey(name: "geo-name") String geoName}); + {@JsonKey(name: 'geo-type') String geoType, + @JsonKey(name: 'geo-name') String geoName}); } /// @nodoc @@ -1736,17 +1736,17 @@ class __$$UpdateGeoDataParamsImplCopyWithImpl<$Res> @JsonSerializable() class _$UpdateGeoDataParamsImpl implements _UpdateGeoDataParams { const _$UpdateGeoDataParamsImpl( - {@JsonKey(name: "geo-type") required this.geoType, - @JsonKey(name: "geo-name") required this.geoName}); + {@JsonKey(name: 'geo-type') required this.geoType, + @JsonKey(name: 'geo-name') required this.geoName}); factory _$UpdateGeoDataParamsImpl.fromJson(Map json) => _$$UpdateGeoDataParamsImplFromJson(json); @override - @JsonKey(name: "geo-type") + @JsonKey(name: 'geo-type') final String geoType; @override - @JsonKey(name: "geo-name") + @JsonKey(name: 'geo-name') final String geoName; @override @@ -1786,18 +1786,18 @@ class _$UpdateGeoDataParamsImpl implements _UpdateGeoDataParams { abstract class _UpdateGeoDataParams implements UpdateGeoDataParams { const factory _UpdateGeoDataParams( - {@JsonKey(name: "geo-type") required final String geoType, - @JsonKey(name: "geo-name") required final String geoName}) = + {@JsonKey(name: 'geo-type') required final String geoType, + @JsonKey(name: 'geo-name') required final String geoName}) = _$UpdateGeoDataParamsImpl; factory _UpdateGeoDataParams.fromJson(Map json) = _$UpdateGeoDataParamsImpl.fromJson; @override - @JsonKey(name: "geo-type") + @JsonKey(name: 'geo-type') String get geoType; @override - @JsonKey(name: "geo-name") + @JsonKey(name: 'geo-name') String get geoName; /// Create a copy of UpdateGeoDataParams @@ -2489,13 +2489,13 @@ ProviderSubscriptionInfo _$ProviderSubscriptionInfoFromJson( /// @nodoc mixin _$ProviderSubscriptionInfo { - @JsonKey(name: "UPLOAD") + @JsonKey(name: 'UPLOAD') int get upload => throw _privateConstructorUsedError; - @JsonKey(name: "DOWNLOAD") + @JsonKey(name: 'DOWNLOAD') int get download => throw _privateConstructorUsedError; - @JsonKey(name: "TOTAL") + @JsonKey(name: 'TOTAL') int get total => throw _privateConstructorUsedError; - @JsonKey(name: "EXPIRE") + @JsonKey(name: 'EXPIRE') int get expire => throw _privateConstructorUsedError; /// Serializes this ProviderSubscriptionInfo to a JSON map. @@ -2515,10 +2515,10 @@ abstract class $ProviderSubscriptionInfoCopyWith<$Res> { _$ProviderSubscriptionInfoCopyWithImpl<$Res, ProviderSubscriptionInfo>; @useResult $Res call( - {@JsonKey(name: "UPLOAD") int upload, - @JsonKey(name: "DOWNLOAD") int download, - @JsonKey(name: "TOTAL") int total, - @JsonKey(name: "EXPIRE") int expire}); + {@JsonKey(name: 'UPLOAD') int upload, + @JsonKey(name: 'DOWNLOAD') int download, + @JsonKey(name: 'TOTAL') int total, + @JsonKey(name: 'EXPIRE') int expire}); } /// @nodoc @@ -2573,10 +2573,10 @@ abstract class _$$ProviderSubscriptionInfoImplCopyWith<$Res> @override @useResult $Res call( - {@JsonKey(name: "UPLOAD") int upload, - @JsonKey(name: "DOWNLOAD") int download, - @JsonKey(name: "TOTAL") int total, - @JsonKey(name: "EXPIRE") int expire}); + {@JsonKey(name: 'UPLOAD') int upload, + @JsonKey(name: 'DOWNLOAD') int download, + @JsonKey(name: 'TOTAL') int total, + @JsonKey(name: 'EXPIRE') int expire}); } /// @nodoc @@ -2624,25 +2624,25 @@ class __$$ProviderSubscriptionInfoImplCopyWithImpl<$Res> @JsonSerializable() class _$ProviderSubscriptionInfoImpl implements _ProviderSubscriptionInfo { const _$ProviderSubscriptionInfoImpl( - {@JsonKey(name: "UPLOAD") this.upload = 0, - @JsonKey(name: "DOWNLOAD") this.download = 0, - @JsonKey(name: "TOTAL") this.total = 0, - @JsonKey(name: "EXPIRE") this.expire = 0}); + {@JsonKey(name: 'UPLOAD') this.upload = 0, + @JsonKey(name: 'DOWNLOAD') this.download = 0, + @JsonKey(name: 'TOTAL') this.total = 0, + @JsonKey(name: 'EXPIRE') this.expire = 0}); factory _$ProviderSubscriptionInfoImpl.fromJson(Map json) => _$$ProviderSubscriptionInfoImplFromJson(json); @override - @JsonKey(name: "UPLOAD") + @JsonKey(name: 'UPLOAD') final int upload; @override - @JsonKey(name: "DOWNLOAD") + @JsonKey(name: 'DOWNLOAD') final int download; @override - @JsonKey(name: "TOTAL") + @JsonKey(name: 'TOTAL') final int total; @override - @JsonKey(name: "EXPIRE") + @JsonKey(name: 'EXPIRE') final int expire; @override @@ -2685,26 +2685,26 @@ class _$ProviderSubscriptionInfoImpl implements _ProviderSubscriptionInfo { abstract class _ProviderSubscriptionInfo implements ProviderSubscriptionInfo { const factory _ProviderSubscriptionInfo( - {@JsonKey(name: "UPLOAD") final int upload, - @JsonKey(name: "DOWNLOAD") final int download, - @JsonKey(name: "TOTAL") final int total, - @JsonKey(name: "EXPIRE") final int expire}) = + {@JsonKey(name: 'UPLOAD') final int upload, + @JsonKey(name: 'DOWNLOAD') final int download, + @JsonKey(name: 'TOTAL') final int total, + @JsonKey(name: 'EXPIRE') final int expire}) = _$ProviderSubscriptionInfoImpl; factory _ProviderSubscriptionInfo.fromJson(Map json) = _$ProviderSubscriptionInfoImpl.fromJson; @override - @JsonKey(name: "UPLOAD") + @JsonKey(name: 'UPLOAD') int get upload; @override - @JsonKey(name: "DOWNLOAD") + @JsonKey(name: 'DOWNLOAD') int get download; @override - @JsonKey(name: "TOTAL") + @JsonKey(name: 'TOTAL') int get total; @override - @JsonKey(name: "EXPIRE") + @JsonKey(name: 'EXPIRE') int get expire; /// Create a copy of ProviderSubscriptionInfo @@ -2725,12 +2725,12 @@ mixin _$ExternalProvider { String get type => throw _privateConstructorUsedError; String? get path => throw _privateConstructorUsedError; int get count => throw _privateConstructorUsedError; - @JsonKey(name: "subscription-info", fromJson: subscriptionInfoFormCore) + @JsonKey(name: 'subscription-info', fromJson: subscriptionInfoFormCore) SubscriptionInfo? get subscriptionInfo => throw _privateConstructorUsedError; bool get isUpdating => throw _privateConstructorUsedError; - @JsonKey(name: "vehicle-type") + @JsonKey(name: 'vehicle-type') String get vehicleType => throw _privateConstructorUsedError; - @JsonKey(name: "update-at") + @JsonKey(name: 'update-at') DateTime get updateAt => throw _privateConstructorUsedError; /// Serializes this ExternalProvider to a JSON map. @@ -2754,11 +2754,11 @@ abstract class $ExternalProviderCopyWith<$Res> { String type, String? path, int count, - @JsonKey(name: "subscription-info", fromJson: subscriptionInfoFormCore) + @JsonKey(name: 'subscription-info', fromJson: subscriptionInfoFormCore) SubscriptionInfo? subscriptionInfo, bool isUpdating, - @JsonKey(name: "vehicle-type") String vehicleType, - @JsonKey(name: "update-at") DateTime updateAt}); + @JsonKey(name: 'vehicle-type') String vehicleType, + @JsonKey(name: 'update-at') DateTime updateAt}); $SubscriptionInfoCopyWith<$Res>? get subscriptionInfo; } @@ -2851,11 +2851,11 @@ abstract class _$$ExternalProviderImplCopyWith<$Res> String type, String? path, int count, - @JsonKey(name: "subscription-info", fromJson: subscriptionInfoFormCore) + @JsonKey(name: 'subscription-info', fromJson: subscriptionInfoFormCore) SubscriptionInfo? subscriptionInfo, bool isUpdating, - @JsonKey(name: "vehicle-type") String vehicleType, - @JsonKey(name: "update-at") DateTime updateAt}); + @JsonKey(name: 'vehicle-type') String vehicleType, + @JsonKey(name: 'update-at') DateTime updateAt}); @override $SubscriptionInfoCopyWith<$Res>? get subscriptionInfo; @@ -2928,11 +2928,11 @@ class _$ExternalProviderImpl implements _ExternalProvider { required this.type, this.path, required this.count, - @JsonKey(name: "subscription-info", fromJson: subscriptionInfoFormCore) + @JsonKey(name: 'subscription-info', fromJson: subscriptionInfoFormCore) this.subscriptionInfo, this.isUpdating = false, - @JsonKey(name: "vehicle-type") required this.vehicleType, - @JsonKey(name: "update-at") required this.updateAt}); + @JsonKey(name: 'vehicle-type') required this.vehicleType, + @JsonKey(name: 'update-at') required this.updateAt}); factory _$ExternalProviderImpl.fromJson(Map json) => _$$ExternalProviderImplFromJson(json); @@ -2946,16 +2946,16 @@ class _$ExternalProviderImpl implements _ExternalProvider { @override final int count; @override - @JsonKey(name: "subscription-info", fromJson: subscriptionInfoFormCore) + @JsonKey(name: 'subscription-info', fromJson: subscriptionInfoFormCore) final SubscriptionInfo? subscriptionInfo; @override @JsonKey() final bool isUpdating; @override - @JsonKey(name: "vehicle-type") + @JsonKey(name: 'vehicle-type') final String vehicleType; @override - @JsonKey(name: "update-at") + @JsonKey(name: 'update-at') final DateTime updateAt; @override @@ -3010,11 +3010,11 @@ abstract class _ExternalProvider implements ExternalProvider { required final String type, final String? path, required final int count, - @JsonKey(name: "subscription-info", fromJson: subscriptionInfoFormCore) + @JsonKey(name: 'subscription-info', fromJson: subscriptionInfoFormCore) final SubscriptionInfo? subscriptionInfo, final bool isUpdating, - @JsonKey(name: "vehicle-type") required final String vehicleType, - @JsonKey(name: "update-at") + @JsonKey(name: 'vehicle-type') required final String vehicleType, + @JsonKey(name: 'update-at') required final DateTime updateAt}) = _$ExternalProviderImpl; factory _ExternalProvider.fromJson(Map json) = @@ -3029,15 +3029,15 @@ abstract class _ExternalProvider implements ExternalProvider { @override int get count; @override - @JsonKey(name: "subscription-info", fromJson: subscriptionInfoFormCore) + @JsonKey(name: 'subscription-info', fromJson: subscriptionInfoFormCore) SubscriptionInfo? get subscriptionInfo; @override bool get isUpdating; @override - @JsonKey(name: "vehicle-type") + @JsonKey(name: 'vehicle-type') String get vehicleType; @override - @JsonKey(name: "update-at") + @JsonKey(name: 'update-at') DateTime get updateAt; /// Create a copy of ExternalProvider diff --git a/lib/models/generated/core.g.dart b/lib/models/generated/core.g.dart index 4ca94a0..f3ab32b 100644 --- a/lib/models/generated/core.g.dart +++ b/lib/models/generated/core.g.dart @@ -68,7 +68,6 @@ const _$LogLevelEnumMap = { LogLevel.warning: 'warning', LogLevel.error: 'error', LogLevel.silent: 'silent', - LogLevel.app: 'app', }; const _$ExternalControllerStatusEnumMap = { diff --git a/lib/models/generated/profile.freezed.dart b/lib/models/generated/profile.freezed.dart index 4919406..614014b 100644 --- a/lib/models/generated/profile.freezed.dart +++ b/lib/models/generated/profile.freezed.dart @@ -492,7 +492,7 @@ class _$ProfileImpl implements _Profile { {required this.id, this.label, this.currentGroupName, - this.url = "", + this.url = '', this.lastUpdateDate, required this.autoUpdateDuration, this.subscriptionInfo, diff --git a/lib/models/generated/profile.g.dart b/lib/models/generated/profile.g.dart index 7b76002..6cb41bc 100644 --- a/lib/models/generated/profile.g.dart +++ b/lib/models/generated/profile.g.dart @@ -29,7 +29,7 @@ _$ProfileImpl _$$ProfileImplFromJson(Map json) => id: json['id'] as String, label: json['label'] as String?, currentGroupName: json['currentGroupName'] as String?, - url: json['url'] as String? ?? "", + url: json['url'] as String? ?? '', lastUpdateDate: json['lastUpdateDate'] == null ? null : DateTime.parse(json['lastUpdateDate'] as String), diff --git a/lib/models/generated/selector.freezed.dart b/lib/models/generated/selector.freezed.dart index 79c9b9b..5442439 100644 --- a/lib/models/generated/selector.freezed.dart +++ b/lib/models/generated/selector.freezed.dart @@ -1061,7 +1061,6 @@ abstract class _ProfilesSelectorState implements ProfilesSelectorState { /// @nodoc mixin _$NetworkDetectionState { bool get isLoading => throw _privateConstructorUsedError; - bool get isTesting => throw _privateConstructorUsedError; IpInfo? get ipInfo => throw _privateConstructorUsedError; /// Create a copy of NetworkDetectionState @@ -1077,7 +1076,7 @@ abstract class $NetworkDetectionStateCopyWith<$Res> { $Res Function(NetworkDetectionState) then) = _$NetworkDetectionStateCopyWithImpl<$Res, NetworkDetectionState>; @useResult - $Res call({bool isLoading, bool isTesting, IpInfo? ipInfo}); + $Res call({bool isLoading, IpInfo? ipInfo}); } /// @nodoc @@ -1097,7 +1096,6 @@ class _$NetworkDetectionStateCopyWithImpl<$Res, @override $Res call({ Object? isLoading = null, - Object? isTesting = null, Object? ipInfo = freezed, }) { return _then(_value.copyWith( @@ -1105,10 +1103,6 @@ class _$NetworkDetectionStateCopyWithImpl<$Res, ? _value.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool, - isTesting: null == isTesting - ? _value.isTesting - : isTesting // ignore: cast_nullable_to_non_nullable - as bool, ipInfo: freezed == ipInfo ? _value.ipInfo : ipInfo // ignore: cast_nullable_to_non_nullable @@ -1126,7 +1120,7 @@ abstract class _$$NetworkDetectionStateImplCopyWith<$Res> __$$NetworkDetectionStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({bool isLoading, bool isTesting, IpInfo? ipInfo}); + $Res call({bool isLoading, IpInfo? ipInfo}); } /// @nodoc @@ -1144,7 +1138,6 @@ class __$$NetworkDetectionStateImplCopyWithImpl<$Res> @override $Res call({ Object? isLoading = null, - Object? isTesting = null, Object? ipInfo = freezed, }) { return _then(_$NetworkDetectionStateImpl( @@ -1152,10 +1145,6 @@ class __$$NetworkDetectionStateImplCopyWithImpl<$Res> ? _value.isLoading : isLoading // ignore: cast_nullable_to_non_nullable as bool, - isTesting: null == isTesting - ? _value.isTesting - : isTesting // ignore: cast_nullable_to_non_nullable - as bool, ipInfo: freezed == ipInfo ? _value.ipInfo : ipInfo // ignore: cast_nullable_to_non_nullable @@ -1168,18 +1157,16 @@ class __$$NetworkDetectionStateImplCopyWithImpl<$Res> class _$NetworkDetectionStateImpl implements _NetworkDetectionState { const _$NetworkDetectionStateImpl( - {required this.isLoading, required this.isTesting, required this.ipInfo}); + {required this.isLoading, required this.ipInfo}); @override final bool isLoading; @override - final bool isTesting; - @override final IpInfo? ipInfo; @override String toString() { - return 'NetworkDetectionState(isLoading: $isLoading, isTesting: $isTesting, ipInfo: $ipInfo)'; + return 'NetworkDetectionState(isLoading: $isLoading, ipInfo: $ipInfo)'; } @override @@ -1189,13 +1176,11 @@ class _$NetworkDetectionStateImpl implements _NetworkDetectionState { other is _$NetworkDetectionStateImpl && (identical(other.isLoading, isLoading) || other.isLoading == isLoading) && - (identical(other.isTesting, isTesting) || - other.isTesting == isTesting) && (identical(other.ipInfo, ipInfo) || other.ipInfo == ipInfo)); } @override - int get hashCode => Object.hash(runtimeType, isLoading, isTesting, ipInfo); + int get hashCode => Object.hash(runtimeType, isLoading, ipInfo); /// Create a copy of NetworkDetectionState /// with the given fields replaced by the non-null parameter values. @@ -1210,14 +1195,11 @@ class _$NetworkDetectionStateImpl implements _NetworkDetectionState { abstract class _NetworkDetectionState implements NetworkDetectionState { const factory _NetworkDetectionState( {required final bool isLoading, - required final bool isTesting, required final IpInfo? ipInfo}) = _$NetworkDetectionStateImpl; @override bool get isLoading; @override - bool get isTesting; - @override IpInfo? get ipInfo; /// Create a copy of NetworkDetectionState @@ -1569,43 +1551,46 @@ abstract class _TrayState implements TrayState { } /// @nodoc -mixin _$HomeState { +mixin _$NavigationState { PageLabel get pageLabel => throw _privateConstructorUsedError; List get navigationItems => throw _privateConstructorUsedError; ViewMode get viewMode => throw _privateConstructorUsedError; String? get locale => throw _privateConstructorUsedError; + int get currentIndex => throw _privateConstructorUsedError; - /// Create a copy of HomeState + /// Create a copy of NavigationState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - $HomeStateCopyWith get copyWith => + $NavigationStateCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $HomeStateCopyWith<$Res> { - factory $HomeStateCopyWith(HomeState value, $Res Function(HomeState) then) = - _$HomeStateCopyWithImpl<$Res, HomeState>; +abstract class $NavigationStateCopyWith<$Res> { + factory $NavigationStateCopyWith( + NavigationState value, $Res Function(NavigationState) then) = + _$NavigationStateCopyWithImpl<$Res, NavigationState>; @useResult $Res call( {PageLabel pageLabel, List navigationItems, ViewMode viewMode, - String? locale}); + String? locale, + int currentIndex}); } /// @nodoc -class _$HomeStateCopyWithImpl<$Res, $Val extends HomeState> - implements $HomeStateCopyWith<$Res> { - _$HomeStateCopyWithImpl(this._value, this._then); +class _$NavigationStateCopyWithImpl<$Res, $Val extends NavigationState> + implements $NavigationStateCopyWith<$Res> { + _$NavigationStateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; // ignore: unused_field final $Res Function($Val) _then; - /// Create a copy of HomeState + /// Create a copy of NavigationState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override @@ -1614,6 +1599,7 @@ class _$HomeStateCopyWithImpl<$Res, $Val extends HomeState> Object? navigationItems = null, Object? viewMode = null, Object? locale = freezed, + Object? currentIndex = null, }) { return _then(_value.copyWith( pageLabel: null == pageLabel @@ -1632,34 +1618,39 @@ class _$HomeStateCopyWithImpl<$Res, $Val extends HomeState> ? _value.locale : locale // ignore: cast_nullable_to_non_nullable as String?, + currentIndex: null == currentIndex + ? _value.currentIndex + : currentIndex // ignore: cast_nullable_to_non_nullable + as int, ) as $Val); } } /// @nodoc -abstract class _$$HomeStateImplCopyWith<$Res> - implements $HomeStateCopyWith<$Res> { - factory _$$HomeStateImplCopyWith( - _$HomeStateImpl value, $Res Function(_$HomeStateImpl) then) = - __$$HomeStateImplCopyWithImpl<$Res>; +abstract class _$$NavigationStateImplCopyWith<$Res> + implements $NavigationStateCopyWith<$Res> { + factory _$$NavigationStateImplCopyWith(_$NavigationStateImpl value, + $Res Function(_$NavigationStateImpl) then) = + __$$NavigationStateImplCopyWithImpl<$Res>; @override @useResult $Res call( {PageLabel pageLabel, List navigationItems, ViewMode viewMode, - String? locale}); + String? locale, + int currentIndex}); } /// @nodoc -class __$$HomeStateImplCopyWithImpl<$Res> - extends _$HomeStateCopyWithImpl<$Res, _$HomeStateImpl> - implements _$$HomeStateImplCopyWith<$Res> { - __$$HomeStateImplCopyWithImpl( - _$HomeStateImpl _value, $Res Function(_$HomeStateImpl) _then) +class __$$NavigationStateImplCopyWithImpl<$Res> + extends _$NavigationStateCopyWithImpl<$Res, _$NavigationStateImpl> + implements _$$NavigationStateImplCopyWith<$Res> { + __$$NavigationStateImplCopyWithImpl( + _$NavigationStateImpl _value, $Res Function(_$NavigationStateImpl) _then) : super(_value, _then); - /// Create a copy of HomeState + /// Create a copy of NavigationState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override @@ -1668,8 +1659,9 @@ class __$$HomeStateImplCopyWithImpl<$Res> Object? navigationItems = null, Object? viewMode = null, Object? locale = freezed, + Object? currentIndex = null, }) { - return _then(_$HomeStateImpl( + return _then(_$NavigationStateImpl( pageLabel: null == pageLabel ? _value.pageLabel : pageLabel // ignore: cast_nullable_to_non_nullable @@ -1686,18 +1678,23 @@ class __$$HomeStateImplCopyWithImpl<$Res> ? _value.locale : locale // ignore: cast_nullable_to_non_nullable as String?, + currentIndex: null == currentIndex + ? _value.currentIndex + : currentIndex // ignore: cast_nullable_to_non_nullable + as int, )); } } /// @nodoc -class _$HomeStateImpl implements _HomeState { - const _$HomeStateImpl( +class _$NavigationStateImpl implements _NavigationState { + const _$NavigationStateImpl( {required this.pageLabel, required final List navigationItems, required this.viewMode, - required this.locale}) + required this.locale, + required this.currentIndex}) : _navigationItems = navigationItems; @override @@ -1714,45 +1711,56 @@ class _$HomeStateImpl implements _HomeState { final ViewMode viewMode; @override final String? locale; + @override + final int currentIndex; @override String toString() { - return 'HomeState(pageLabel: $pageLabel, navigationItems: $navigationItems, viewMode: $viewMode, locale: $locale)'; + return 'NavigationState(pageLabel: $pageLabel, navigationItems: $navigationItems, viewMode: $viewMode, locale: $locale, currentIndex: $currentIndex)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$HomeStateImpl && + other is _$NavigationStateImpl && (identical(other.pageLabel, pageLabel) || other.pageLabel == pageLabel) && const DeepCollectionEquality() .equals(other._navigationItems, _navigationItems) && (identical(other.viewMode, viewMode) || other.viewMode == viewMode) && - (identical(other.locale, locale) || other.locale == locale)); + (identical(other.locale, locale) || other.locale == locale) && + (identical(other.currentIndex, currentIndex) || + other.currentIndex == currentIndex)); } @override - int get hashCode => Object.hash(runtimeType, pageLabel, - const DeepCollectionEquality().hash(_navigationItems), viewMode, locale); + int get hashCode => Object.hash( + runtimeType, + pageLabel, + const DeepCollectionEquality().hash(_navigationItems), + viewMode, + locale, + currentIndex); - /// Create a copy of HomeState + /// Create a copy of NavigationState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') - _$$HomeStateImplCopyWith<_$HomeStateImpl> get copyWith => - __$$HomeStateImplCopyWithImpl<_$HomeStateImpl>(this, _$identity); + _$$NavigationStateImplCopyWith<_$NavigationStateImpl> get copyWith => + __$$NavigationStateImplCopyWithImpl<_$NavigationStateImpl>( + this, _$identity); } -abstract class _HomeState implements HomeState { - const factory _HomeState( +abstract class _NavigationState implements NavigationState { + const factory _NavigationState( {required final PageLabel pageLabel, required final List navigationItems, required final ViewMode viewMode, - required final String? locale}) = _$HomeStateImpl; + required final String? locale, + required final int currentIndex}) = _$NavigationStateImpl; @override PageLabel get pageLabel; @@ -1762,310 +1770,14 @@ abstract class _HomeState implements HomeState { ViewMode get viewMode; @override String? get locale; + @override + int get currentIndex; - /// Create a copy of HomeState + /// Create a copy of NavigationState /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) - _$$HomeStateImplCopyWith<_$HomeStateImpl> get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -mixin _$ProxiesSelectorState { - List get groupNames => throw _privateConstructorUsedError; - String? get currentGroupName => throw _privateConstructorUsedError; - - /// Create a copy of ProxiesSelectorState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $ProxiesSelectorStateCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $ProxiesSelectorStateCopyWith<$Res> { - factory $ProxiesSelectorStateCopyWith(ProxiesSelectorState value, - $Res Function(ProxiesSelectorState) then) = - _$ProxiesSelectorStateCopyWithImpl<$Res, ProxiesSelectorState>; - @useResult - $Res call({List groupNames, String? currentGroupName}); -} - -/// @nodoc -class _$ProxiesSelectorStateCopyWithImpl<$Res, - $Val extends ProxiesSelectorState> - implements $ProxiesSelectorStateCopyWith<$Res> { - _$ProxiesSelectorStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of ProxiesSelectorState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? groupNames = null, - Object? currentGroupName = freezed, - }) { - return _then(_value.copyWith( - groupNames: null == groupNames - ? _value.groupNames - : groupNames // ignore: cast_nullable_to_non_nullable - as List, - currentGroupName: freezed == currentGroupName - ? _value.currentGroupName - : currentGroupName // ignore: cast_nullable_to_non_nullable - as String?, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$ProxiesSelectorStateImplCopyWith<$Res> - implements $ProxiesSelectorStateCopyWith<$Res> { - factory _$$ProxiesSelectorStateImplCopyWith(_$ProxiesSelectorStateImpl value, - $Res Function(_$ProxiesSelectorStateImpl) then) = - __$$ProxiesSelectorStateImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({List groupNames, String? currentGroupName}); -} - -/// @nodoc -class __$$ProxiesSelectorStateImplCopyWithImpl<$Res> - extends _$ProxiesSelectorStateCopyWithImpl<$Res, _$ProxiesSelectorStateImpl> - implements _$$ProxiesSelectorStateImplCopyWith<$Res> { - __$$ProxiesSelectorStateImplCopyWithImpl(_$ProxiesSelectorStateImpl _value, - $Res Function(_$ProxiesSelectorStateImpl) _then) - : super(_value, _then); - - /// Create a copy of ProxiesSelectorState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? groupNames = null, - Object? currentGroupName = freezed, - }) { - return _then(_$ProxiesSelectorStateImpl( - groupNames: null == groupNames - ? _value._groupNames - : groupNames // ignore: cast_nullable_to_non_nullable - as List, - currentGroupName: freezed == currentGroupName - ? _value.currentGroupName - : currentGroupName // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc - -class _$ProxiesSelectorStateImpl implements _ProxiesSelectorState { - const _$ProxiesSelectorStateImpl( - {required final List groupNames, required this.currentGroupName}) - : _groupNames = groupNames; - - final List _groupNames; - @override - List get groupNames { - if (_groupNames is EqualUnmodifiableListView) return _groupNames; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_groupNames); - } - - @override - final String? currentGroupName; - - @override - String toString() { - return 'ProxiesSelectorState(groupNames: $groupNames, currentGroupName: $currentGroupName)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$ProxiesSelectorStateImpl && - const DeepCollectionEquality() - .equals(other._groupNames, _groupNames) && - (identical(other.currentGroupName, currentGroupName) || - other.currentGroupName == currentGroupName)); - } - - @override - int get hashCode => Object.hash(runtimeType, - const DeepCollectionEquality().hash(_groupNames), currentGroupName); - - /// Create a copy of ProxiesSelectorState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$ProxiesSelectorStateImplCopyWith<_$ProxiesSelectorStateImpl> - get copyWith => - __$$ProxiesSelectorStateImplCopyWithImpl<_$ProxiesSelectorStateImpl>( - this, _$identity); -} - -abstract class _ProxiesSelectorState implements ProxiesSelectorState { - const factory _ProxiesSelectorState( - {required final List groupNames, - required final String? currentGroupName}) = _$ProxiesSelectorStateImpl; - - @override - List get groupNames; - @override - String? get currentGroupName; - - /// Create a copy of ProxiesSelectorState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$ProxiesSelectorStateImplCopyWith<_$ProxiesSelectorStateImpl> - get copyWith => throw _privateConstructorUsedError; -} - -/// @nodoc -mixin _$GroupNamesState { - List get groupNames => throw _privateConstructorUsedError; - - /// Create a copy of GroupNamesState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - $GroupNamesStateCopyWith get copyWith => - throw _privateConstructorUsedError; -} - -/// @nodoc -abstract class $GroupNamesStateCopyWith<$Res> { - factory $GroupNamesStateCopyWith( - GroupNamesState value, $Res Function(GroupNamesState) then) = - _$GroupNamesStateCopyWithImpl<$Res, GroupNamesState>; - @useResult - $Res call({List groupNames}); -} - -/// @nodoc -class _$GroupNamesStateCopyWithImpl<$Res, $Val extends GroupNamesState> - implements $GroupNamesStateCopyWith<$Res> { - _$GroupNamesStateCopyWithImpl(this._value, this._then); - - // ignore: unused_field - final $Val _value; - // ignore: unused_field - final $Res Function($Val) _then; - - /// Create a copy of GroupNamesState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? groupNames = null, - }) { - return _then(_value.copyWith( - groupNames: null == groupNames - ? _value.groupNames - : groupNames // ignore: cast_nullable_to_non_nullable - as List, - ) as $Val); - } -} - -/// @nodoc -abstract class _$$GroupNamesStateImplCopyWith<$Res> - implements $GroupNamesStateCopyWith<$Res> { - factory _$$GroupNamesStateImplCopyWith(_$GroupNamesStateImpl value, - $Res Function(_$GroupNamesStateImpl) then) = - __$$GroupNamesStateImplCopyWithImpl<$Res>; - @override - @useResult - $Res call({List groupNames}); -} - -/// @nodoc -class __$$GroupNamesStateImplCopyWithImpl<$Res> - extends _$GroupNamesStateCopyWithImpl<$Res, _$GroupNamesStateImpl> - implements _$$GroupNamesStateImplCopyWith<$Res> { - __$$GroupNamesStateImplCopyWithImpl( - _$GroupNamesStateImpl _value, $Res Function(_$GroupNamesStateImpl) _then) - : super(_value, _then); - - /// Create a copy of GroupNamesState - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? groupNames = null, - }) { - return _then(_$GroupNamesStateImpl( - groupNames: null == groupNames - ? _value._groupNames - : groupNames // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc - -class _$GroupNamesStateImpl implements _GroupNamesState { - const _$GroupNamesStateImpl({required final List groupNames}) - : _groupNames = groupNames; - - final List _groupNames; - @override - List get groupNames { - if (_groupNames is EqualUnmodifiableListView) return _groupNames; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_groupNames); - } - - @override - String toString() { - return 'GroupNamesState(groupNames: $groupNames)'; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _$GroupNamesStateImpl && - const DeepCollectionEquality() - .equals(other._groupNames, _groupNames)); - } - - @override - int get hashCode => Object.hash( - runtimeType, const DeepCollectionEquality().hash(_groupNames)); - - /// Create a copy of GroupNamesState - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @override - @pragma('vm:prefer-inline') - _$$GroupNamesStateImplCopyWith<_$GroupNamesStateImpl> get copyWith => - __$$GroupNamesStateImplCopyWithImpl<_$GroupNamesStateImpl>( - this, _$identity); -} - -abstract class _GroupNamesState implements GroupNamesState { - const factory _GroupNamesState({required final List groupNames}) = - _$GroupNamesStateImpl; - - @override - List get groupNames; - - /// Create a copy of GroupNamesState - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - _$$GroupNamesStateImplCopyWith<_$GroupNamesStateImpl> get copyWith => + _$$NavigationStateImplCopyWith<_$NavigationStateImpl> get copyWith => throw _privateConstructorUsedError; } @@ -2344,67 +2056,63 @@ abstract class _NavigationItemsState implements NavigationItemsState { } /// @nodoc -mixin _$ProxiesListSelectorState { - List get groupNames => throw _privateConstructorUsedError; +mixin _$ProxiesListState { + List get groups => throw _privateConstructorUsedError; Set get currentUnfoldSet => throw _privateConstructorUsedError; ProxiesSortType get proxiesSortType => throw _privateConstructorUsedError; ProxyCardType get proxyCardType => throw _privateConstructorUsedError; num get sortNum => throw _privateConstructorUsedError; int get columns => throw _privateConstructorUsedError; - String get query => throw _privateConstructorUsedError; - /// Create a copy of ProxiesListSelectorState + /// Create a copy of ProxiesListState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) - $ProxiesListSelectorStateCopyWith get copyWith => + $ProxiesListStateCopyWith get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class $ProxiesListSelectorStateCopyWith<$Res> { - factory $ProxiesListSelectorStateCopyWith(ProxiesListSelectorState value, - $Res Function(ProxiesListSelectorState) then) = - _$ProxiesListSelectorStateCopyWithImpl<$Res, ProxiesListSelectorState>; +abstract class $ProxiesListStateCopyWith<$Res> { + factory $ProxiesListStateCopyWith( + ProxiesListState value, $Res Function(ProxiesListState) then) = + _$ProxiesListStateCopyWithImpl<$Res, ProxiesListState>; @useResult $Res call( - {List groupNames, + {List groups, Set currentUnfoldSet, ProxiesSortType proxiesSortType, ProxyCardType proxyCardType, num sortNum, - int columns, - String query}); + int columns}); } /// @nodoc -class _$ProxiesListSelectorStateCopyWithImpl<$Res, - $Val extends ProxiesListSelectorState> - implements $ProxiesListSelectorStateCopyWith<$Res> { - _$ProxiesListSelectorStateCopyWithImpl(this._value, this._then); +class _$ProxiesListStateCopyWithImpl<$Res, $Val extends ProxiesListState> + implements $ProxiesListStateCopyWith<$Res> { + _$ProxiesListStateCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; // ignore: unused_field final $Res Function($Val) _then; - /// Create a copy of ProxiesListSelectorState + /// Create a copy of ProxiesListState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ - Object? groupNames = null, + Object? groups = null, Object? currentUnfoldSet = null, Object? proxiesSortType = null, Object? proxyCardType = null, Object? sortNum = null, Object? columns = null, - Object? query = null, }) { return _then(_value.copyWith( - groupNames: null == groupNames - ? _value.groupNames - : groupNames // ignore: cast_nullable_to_non_nullable - as List, + groups: null == groups + ? _value.groups + : groups // ignore: cast_nullable_to_non_nullable + as List, currentUnfoldSet: null == currentUnfoldSet ? _value.currentUnfoldSet : currentUnfoldSet // ignore: cast_nullable_to_non_nullable @@ -2425,61 +2133,52 @@ class _$ProxiesListSelectorStateCopyWithImpl<$Res, ? _value.columns : columns // ignore: cast_nullable_to_non_nullable as int, - query: null == query - ? _value.query - : query // ignore: cast_nullable_to_non_nullable - as String, ) as $Val); } } /// @nodoc -abstract class _$$ProxiesListSelectorStateImplCopyWith<$Res> - implements $ProxiesListSelectorStateCopyWith<$Res> { - factory _$$ProxiesListSelectorStateImplCopyWith( - _$ProxiesListSelectorStateImpl value, - $Res Function(_$ProxiesListSelectorStateImpl) then) = - __$$ProxiesListSelectorStateImplCopyWithImpl<$Res>; +abstract class _$$ProxiesListStateImplCopyWith<$Res> + implements $ProxiesListStateCopyWith<$Res> { + factory _$$ProxiesListStateImplCopyWith(_$ProxiesListStateImpl value, + $Res Function(_$ProxiesListStateImpl) then) = + __$$ProxiesListStateImplCopyWithImpl<$Res>; @override @useResult $Res call( - {List groupNames, + {List groups, Set currentUnfoldSet, ProxiesSortType proxiesSortType, ProxyCardType proxyCardType, num sortNum, - int columns, - String query}); + int columns}); } /// @nodoc -class __$$ProxiesListSelectorStateImplCopyWithImpl<$Res> - extends _$ProxiesListSelectorStateCopyWithImpl<$Res, - _$ProxiesListSelectorStateImpl> - implements _$$ProxiesListSelectorStateImplCopyWith<$Res> { - __$$ProxiesListSelectorStateImplCopyWithImpl( - _$ProxiesListSelectorStateImpl _value, - $Res Function(_$ProxiesListSelectorStateImpl) _then) +class __$$ProxiesListStateImplCopyWithImpl<$Res> + extends _$ProxiesListStateCopyWithImpl<$Res, _$ProxiesListStateImpl> + implements _$$ProxiesListStateImplCopyWith<$Res> { + __$$ProxiesListStateImplCopyWithImpl(_$ProxiesListStateImpl _value, + $Res Function(_$ProxiesListStateImpl) _then) : super(_value, _then); - /// Create a copy of ProxiesListSelectorState + /// Create a copy of ProxiesListState /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ - Object? groupNames = null, + Object? groups = null, Object? currentUnfoldSet = null, Object? proxiesSortType = null, Object? proxyCardType = null, Object? sortNum = null, Object? columns = null, - Object? query = null, }) { - return _then(_$ProxiesListSelectorStateImpl( - groupNames: null == groupNames - ? _value._groupNames - : groupNames // ignore: cast_nullable_to_non_nullable - as List, + return _then(_$ProxiesListStateImpl( + groups: null == groups + ? _value._groups + : groups // ignore: cast_nullable_to_non_nullable + as List, currentUnfoldSet: null == currentUnfoldSet ? _value._currentUnfoldSet : currentUnfoldSet // ignore: cast_nullable_to_non_nullable @@ -2500,34 +2199,29 @@ class __$$ProxiesListSelectorStateImplCopyWithImpl<$Res> ? _value.columns : columns // ignore: cast_nullable_to_non_nullable as int, - query: null == query - ? _value.query - : query // ignore: cast_nullable_to_non_nullable - as String, )); } } /// @nodoc -class _$ProxiesListSelectorStateImpl implements _ProxiesListSelectorState { - const _$ProxiesListSelectorStateImpl( - {required final List groupNames, +class _$ProxiesListStateImpl implements _ProxiesListState { + const _$ProxiesListStateImpl( + {required final List groups, required final Set currentUnfoldSet, required this.proxiesSortType, required this.proxyCardType, required this.sortNum, - required this.columns, - required this.query}) - : _groupNames = groupNames, + required this.columns}) + : _groups = groups, _currentUnfoldSet = currentUnfoldSet; - final List _groupNames; + final List _groups; @override - List get groupNames { - if (_groupNames is EqualUnmodifiableListView) return _groupNames; + List get groups { + if (_groups is EqualUnmodifiableListView) return _groups; // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_groupNames); + return EqualUnmodifiableListView(_groups); } final Set _currentUnfoldSet; @@ -2546,21 +2240,18 @@ class _$ProxiesListSelectorStateImpl implements _ProxiesListSelectorState { final num sortNum; @override final int columns; - @override - final String query; @override String toString() { - return 'ProxiesListSelectorState(groupNames: $groupNames, currentUnfoldSet: $currentUnfoldSet, proxiesSortType: $proxiesSortType, proxyCardType: $proxyCardType, sortNum: $sortNum, columns: $columns, query: $query)'; + return 'ProxiesListState(groups: $groups, currentUnfoldSet: $currentUnfoldSet, proxiesSortType: $proxiesSortType, proxyCardType: $proxyCardType, sortNum: $sortNum, columns: $columns)'; } @override bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$ProxiesListSelectorStateImpl && - const DeepCollectionEquality() - .equals(other._groupNames, _groupNames) && + other is _$ProxiesListStateImpl && + const DeepCollectionEquality().equals(other._groups, _groups) && const DeepCollectionEquality() .equals(other._currentUnfoldSet, _currentUnfoldSet) && (identical(other.proxiesSortType, proxiesSortType) || @@ -2568,43 +2259,40 @@ class _$ProxiesListSelectorStateImpl implements _ProxiesListSelectorState { (identical(other.proxyCardType, proxyCardType) || other.proxyCardType == proxyCardType) && (identical(other.sortNum, sortNum) || other.sortNum == sortNum) && - (identical(other.columns, columns) || other.columns == columns) && - (identical(other.query, query) || other.query == query)); + (identical(other.columns, columns) || other.columns == columns)); } @override int get hashCode => Object.hash( runtimeType, - const DeepCollectionEquality().hash(_groupNames), + const DeepCollectionEquality().hash(_groups), const DeepCollectionEquality().hash(_currentUnfoldSet), proxiesSortType, proxyCardType, sortNum, - columns, - query); + columns); - /// Create a copy of ProxiesListSelectorState + /// Create a copy of ProxiesListState /// with the given fields replaced by the non-null parameter values. @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') - _$$ProxiesListSelectorStateImplCopyWith<_$ProxiesListSelectorStateImpl> - get copyWith => __$$ProxiesListSelectorStateImplCopyWithImpl< - _$ProxiesListSelectorStateImpl>(this, _$identity); + _$$ProxiesListStateImplCopyWith<_$ProxiesListStateImpl> get copyWith => + __$$ProxiesListStateImplCopyWithImpl<_$ProxiesListStateImpl>( + this, _$identity); } -abstract class _ProxiesListSelectorState implements ProxiesListSelectorState { - const factory _ProxiesListSelectorState( - {required final List groupNames, +abstract class _ProxiesListState implements ProxiesListState { + const factory _ProxiesListState( + {required final List groups, required final Set currentUnfoldSet, required final ProxiesSortType proxiesSortType, required final ProxyCardType proxyCardType, required final num sortNum, - required final int columns, - required final String query}) = _$ProxiesListSelectorStateImpl; + required final int columns}) = _$ProxiesListStateImpl; @override - List get groupNames; + List get groups; @override Set get currentUnfoldSet; @override @@ -2615,15 +2303,263 @@ abstract class _ProxiesListSelectorState implements ProxiesListSelectorState { num get sortNum; @override int get columns; - @override - String get query; - /// Create a copy of ProxiesListSelectorState + /// Create a copy of ProxiesListState /// with the given fields replaced by the non-null parameter values. @override @JsonKey(includeFromJson: false, includeToJson: false) - _$$ProxiesListSelectorStateImplCopyWith<_$ProxiesListSelectorStateImpl> - get copyWith => throw _privateConstructorUsedError; + _$$ProxiesListStateImplCopyWith<_$ProxiesListStateImpl> get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +mixin _$ProxiesTabState { + List get groups => throw _privateConstructorUsedError; + String? get currentGroupName => throw _privateConstructorUsedError; + ProxiesSortType get proxiesSortType => throw _privateConstructorUsedError; + ProxyCardType get proxyCardType => throw _privateConstructorUsedError; + num get sortNum => throw _privateConstructorUsedError; + int get columns => throw _privateConstructorUsedError; + + /// Create a copy of ProxiesTabState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + $ProxiesTabStateCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $ProxiesTabStateCopyWith<$Res> { + factory $ProxiesTabStateCopyWith( + ProxiesTabState value, $Res Function(ProxiesTabState) then) = + _$ProxiesTabStateCopyWithImpl<$Res, ProxiesTabState>; + @useResult + $Res call( + {List groups, + String? currentGroupName, + ProxiesSortType proxiesSortType, + ProxyCardType proxyCardType, + num sortNum, + int columns}); +} + +/// @nodoc +class _$ProxiesTabStateCopyWithImpl<$Res, $Val extends ProxiesTabState> + implements $ProxiesTabStateCopyWith<$Res> { + _$ProxiesTabStateCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + /// Create a copy of ProxiesTabState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? groups = null, + Object? currentGroupName = freezed, + Object? proxiesSortType = null, + Object? proxyCardType = null, + Object? sortNum = null, + Object? columns = null, + }) { + return _then(_value.copyWith( + groups: null == groups + ? _value.groups + : groups // ignore: cast_nullable_to_non_nullable + as List, + currentGroupName: freezed == currentGroupName + ? _value.currentGroupName + : currentGroupName // ignore: cast_nullable_to_non_nullable + as String?, + proxiesSortType: null == proxiesSortType + ? _value.proxiesSortType + : proxiesSortType // ignore: cast_nullable_to_non_nullable + as ProxiesSortType, + proxyCardType: null == proxyCardType + ? _value.proxyCardType + : proxyCardType // ignore: cast_nullable_to_non_nullable + as ProxyCardType, + sortNum: null == sortNum + ? _value.sortNum + : sortNum // ignore: cast_nullable_to_non_nullable + as num, + columns: null == columns + ? _value.columns + : columns // ignore: cast_nullable_to_non_nullable + as int, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$ProxiesTabStateImplCopyWith<$Res> + implements $ProxiesTabStateCopyWith<$Res> { + factory _$$ProxiesTabStateImplCopyWith(_$ProxiesTabStateImpl value, + $Res Function(_$ProxiesTabStateImpl) then) = + __$$ProxiesTabStateImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {List groups, + String? currentGroupName, + ProxiesSortType proxiesSortType, + ProxyCardType proxyCardType, + num sortNum, + int columns}); +} + +/// @nodoc +class __$$ProxiesTabStateImplCopyWithImpl<$Res> + extends _$ProxiesTabStateCopyWithImpl<$Res, _$ProxiesTabStateImpl> + implements _$$ProxiesTabStateImplCopyWith<$Res> { + __$$ProxiesTabStateImplCopyWithImpl( + _$ProxiesTabStateImpl _value, $Res Function(_$ProxiesTabStateImpl) _then) + : super(_value, _then); + + /// Create a copy of ProxiesTabState + /// with the given fields replaced by the non-null parameter values. + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? groups = null, + Object? currentGroupName = freezed, + Object? proxiesSortType = null, + Object? proxyCardType = null, + Object? sortNum = null, + Object? columns = null, + }) { + return _then(_$ProxiesTabStateImpl( + groups: null == groups + ? _value._groups + : groups // ignore: cast_nullable_to_non_nullable + as List, + currentGroupName: freezed == currentGroupName + ? _value.currentGroupName + : currentGroupName // ignore: cast_nullable_to_non_nullable + as String?, + proxiesSortType: null == proxiesSortType + ? _value.proxiesSortType + : proxiesSortType // ignore: cast_nullable_to_non_nullable + as ProxiesSortType, + proxyCardType: null == proxyCardType + ? _value.proxyCardType + : proxyCardType // ignore: cast_nullable_to_non_nullable + as ProxyCardType, + sortNum: null == sortNum + ? _value.sortNum + : sortNum // ignore: cast_nullable_to_non_nullable + as num, + columns: null == columns + ? _value.columns + : columns // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$ProxiesTabStateImpl implements _ProxiesTabState { + const _$ProxiesTabStateImpl( + {required final List groups, + required this.currentGroupName, + required this.proxiesSortType, + required this.proxyCardType, + required this.sortNum, + required this.columns}) + : _groups = groups; + + final List _groups; + @override + List get groups { + if (_groups is EqualUnmodifiableListView) return _groups; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_groups); + } + + @override + final String? currentGroupName; + @override + final ProxiesSortType proxiesSortType; + @override + final ProxyCardType proxyCardType; + @override + final num sortNum; + @override + final int columns; + + @override + String toString() { + return 'ProxiesTabState(groups: $groups, currentGroupName: $currentGroupName, proxiesSortType: $proxiesSortType, proxyCardType: $proxyCardType, sortNum: $sortNum, columns: $columns)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$ProxiesTabStateImpl && + const DeepCollectionEquality().equals(other._groups, _groups) && + (identical(other.currentGroupName, currentGroupName) || + other.currentGroupName == currentGroupName) && + (identical(other.proxiesSortType, proxiesSortType) || + other.proxiesSortType == proxiesSortType) && + (identical(other.proxyCardType, proxyCardType) || + other.proxyCardType == proxyCardType) && + (identical(other.sortNum, sortNum) || other.sortNum == sortNum) && + (identical(other.columns, columns) || other.columns == columns)); + } + + @override + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(_groups), + currentGroupName, + proxiesSortType, + proxyCardType, + sortNum, + columns); + + /// Create a copy of ProxiesTabState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) + @override + @pragma('vm:prefer-inline') + _$$ProxiesTabStateImplCopyWith<_$ProxiesTabStateImpl> get copyWith => + __$$ProxiesTabStateImplCopyWithImpl<_$ProxiesTabStateImpl>( + this, _$identity); +} + +abstract class _ProxiesTabState implements ProxiesTabState { + const factory _ProxiesTabState( + {required final List groups, + required final String? currentGroupName, + required final ProxiesSortType proxiesSortType, + required final ProxyCardType proxyCardType, + required final num sortNum, + required final int columns}) = _$ProxiesTabStateImpl; + + @override + List get groups; + @override + String? get currentGroupName; + @override + ProxiesSortType get proxiesSortType; + @override + ProxyCardType get proxyCardType; + @override + num get sortNum; + @override + int get columns; + + /// Create a copy of ProxiesTabState + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) + _$$ProxiesTabStateImplCopyWith<_$ProxiesTabStateImpl> get copyWith => + throw _privateConstructorUsedError; } /// @nodoc diff --git a/lib/models/generated/widget.freezed.dart b/lib/models/generated/widget.freezed.dart index cc373eb..78f7a3c 100644 --- a/lib/models/generated/widget.freezed.dart +++ b/lib/models/generated/widget.freezed.dart @@ -531,7 +531,7 @@ abstract class _AppBarState implements AppBarState { /// @nodoc mixin _$AppBarSearchState { dynamic Function(String) get onSearch => throw _privateConstructorUsedError; - bool get isSearch => throw _privateConstructorUsedError; + String? get query => throw _privateConstructorUsedError; /// Create a copy of AppBarSearchState /// with the given fields replaced by the non-null parameter values. @@ -546,7 +546,7 @@ abstract class $AppBarSearchStateCopyWith<$Res> { AppBarSearchState value, $Res Function(AppBarSearchState) then) = _$AppBarSearchStateCopyWithImpl<$Res, AppBarSearchState>; @useResult - $Res call({dynamic Function(String) onSearch, bool isSearch}); + $Res call({dynamic Function(String) onSearch, String? query}); } /// @nodoc @@ -565,17 +565,17 @@ class _$AppBarSearchStateCopyWithImpl<$Res, $Val extends AppBarSearchState> @override $Res call({ Object? onSearch = null, - Object? isSearch = null, + Object? query = freezed, }) { return _then(_value.copyWith( onSearch: null == onSearch ? _value.onSearch : onSearch // ignore: cast_nullable_to_non_nullable as dynamic Function(String), - isSearch: null == isSearch - ? _value.isSearch - : isSearch // ignore: cast_nullable_to_non_nullable - as bool, + query: freezed == query + ? _value.query + : query // ignore: cast_nullable_to_non_nullable + as String?, ) as $Val); } } @@ -588,7 +588,7 @@ abstract class _$$AppBarSearchStateImplCopyWith<$Res> __$$AppBarSearchStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({dynamic Function(String) onSearch, bool isSearch}); + $Res call({dynamic Function(String) onSearch, String? query}); } /// @nodoc @@ -605,17 +605,17 @@ class __$$AppBarSearchStateImplCopyWithImpl<$Res> @override $Res call({ Object? onSearch = null, - Object? isSearch = null, + Object? query = freezed, }) { return _then(_$AppBarSearchStateImpl( onSearch: null == onSearch ? _value.onSearch : onSearch // ignore: cast_nullable_to_non_nullable as dynamic Function(String), - isSearch: null == isSearch - ? _value.isSearch - : isSearch // ignore: cast_nullable_to_non_nullable - as bool, + query: freezed == query + ? _value.query + : query // ignore: cast_nullable_to_non_nullable + as String?, )); } } @@ -623,18 +623,17 @@ class __$$AppBarSearchStateImplCopyWithImpl<$Res> /// @nodoc class _$AppBarSearchStateImpl implements _AppBarSearchState { - const _$AppBarSearchStateImpl( - {required this.onSearch, this.isSearch = false}); + const _$AppBarSearchStateImpl({required this.onSearch, this.query = null}); @override final dynamic Function(String) onSearch; @override @JsonKey() - final bool isSearch; + final String? query; @override String toString() { - return 'AppBarSearchState(onSearch: $onSearch, isSearch: $isSearch)'; + return 'AppBarSearchState(onSearch: $onSearch, query: $query)'; } @override @@ -644,12 +643,11 @@ class _$AppBarSearchStateImpl implements _AppBarSearchState { other is _$AppBarSearchStateImpl && (identical(other.onSearch, onSearch) || other.onSearch == onSearch) && - (identical(other.isSearch, isSearch) || - other.isSearch == isSearch)); + (identical(other.query, query) || other.query == query)); } @override - int get hashCode => Object.hash(runtimeType, onSearch, isSearch); + int get hashCode => Object.hash(runtimeType, onSearch, query); /// Create a copy of AppBarSearchState /// with the given fields replaced by the non-null parameter values. @@ -664,12 +662,12 @@ class _$AppBarSearchStateImpl implements _AppBarSearchState { abstract class _AppBarSearchState implements AppBarSearchState { const factory _AppBarSearchState( {required final dynamic Function(String) onSearch, - final bool isSearch}) = _$AppBarSearchStateImpl; + final String? query}) = _$AppBarSearchStateImpl; @override dynamic Function(String) get onSearch; @override - bool get isSearch; + String? get query; /// Create a copy of AppBarSearchState /// with the given fields replaced by the non-null parameter values. @@ -681,8 +679,7 @@ abstract class _AppBarSearchState implements AppBarSearchState { /// @nodoc mixin _$AppBarEditState { - dynamic get editCount => throw _privateConstructorUsedError; - bool get isEdit => throw _privateConstructorUsedError; + int get editCount => throw _privateConstructorUsedError; dynamic Function() get onExit => throw _privateConstructorUsedError; /// Create a copy of AppBarEditState @@ -698,7 +695,7 @@ abstract class $AppBarEditStateCopyWith<$Res> { AppBarEditState value, $Res Function(AppBarEditState) then) = _$AppBarEditStateCopyWithImpl<$Res, AppBarEditState>; @useResult - $Res call({dynamic editCount, bool isEdit, dynamic Function() onExit}); + $Res call({int editCount, dynamic Function() onExit}); } /// @nodoc @@ -716,19 +713,14 @@ class _$AppBarEditStateCopyWithImpl<$Res, $Val extends AppBarEditState> @pragma('vm:prefer-inline') @override $Res call({ - Object? editCount = freezed, - Object? isEdit = null, + Object? editCount = null, Object? onExit = null, }) { return _then(_value.copyWith( - editCount: freezed == editCount + editCount: null == editCount ? _value.editCount : editCount // ignore: cast_nullable_to_non_nullable - as dynamic, - isEdit: null == isEdit - ? _value.isEdit - : isEdit // ignore: cast_nullable_to_non_nullable - as bool, + as int, onExit: null == onExit ? _value.onExit : onExit // ignore: cast_nullable_to_non_nullable @@ -745,7 +737,7 @@ abstract class _$$AppBarEditStateImplCopyWith<$Res> __$$AppBarEditStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({dynamic editCount, bool isEdit, dynamic Function() onExit}); + $Res call({int editCount, dynamic Function() onExit}); } /// @nodoc @@ -761,16 +753,14 @@ class __$$AppBarEditStateImplCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({ - Object? editCount = freezed, - Object? isEdit = null, + Object? editCount = null, Object? onExit = null, }) { return _then(_$AppBarEditStateImpl( - editCount: freezed == editCount ? _value.editCount! : editCount, - isEdit: null == isEdit - ? _value.isEdit - : isEdit // ignore: cast_nullable_to_non_nullable - as bool, + editCount: null == editCount + ? _value.editCount + : editCount // ignore: cast_nullable_to_non_nullable + as int, onExit: null == onExit ? _value.onExit : onExit // ignore: cast_nullable_to_non_nullable @@ -782,21 +772,17 @@ class __$$AppBarEditStateImplCopyWithImpl<$Res> /// @nodoc class _$AppBarEditStateImpl implements _AppBarEditState { - const _$AppBarEditStateImpl( - {this.editCount = 0, this.isEdit = false, required this.onExit}); + const _$AppBarEditStateImpl({this.editCount = 0, required this.onExit}); @override @JsonKey() - final dynamic editCount; - @override - @JsonKey() - final bool isEdit; + final int editCount; @override final dynamic Function() onExit; @override String toString() { - return 'AppBarEditState(editCount: $editCount, isEdit: $isEdit, onExit: $onExit)'; + return 'AppBarEditState(editCount: $editCount, onExit: $onExit)'; } @override @@ -804,14 +790,13 @@ class _$AppBarEditStateImpl implements _AppBarEditState { return identical(this, other) || (other.runtimeType == runtimeType && other is _$AppBarEditStateImpl && - const DeepCollectionEquality().equals(other.editCount, editCount) && - (identical(other.isEdit, isEdit) || other.isEdit == isEdit) && + (identical(other.editCount, editCount) || + other.editCount == editCount) && (identical(other.onExit, onExit) || other.onExit == onExit)); } @override - int get hashCode => Object.hash(runtimeType, - const DeepCollectionEquality().hash(editCount), isEdit, onExit); + int get hashCode => Object.hash(runtimeType, editCount, onExit); /// Create a copy of AppBarEditState /// with the given fields replaced by the non-null parameter values. @@ -825,14 +810,11 @@ class _$AppBarEditStateImpl implements _AppBarEditState { abstract class _AppBarEditState implements AppBarEditState { const factory _AppBarEditState( - {final dynamic editCount, - final bool isEdit, + {final int editCount, required final dynamic Function() onExit}) = _$AppBarEditStateImpl; @override - dynamic get editCount; - @override - bool get isEdit; + int get editCount; @override dynamic Function() get onExit; diff --git a/lib/models/profile.dart b/lib/models/profile.dart index 30079e2..fbc71ee 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -29,17 +29,17 @@ class SubscriptionInfo with _$SubscriptionInfo { factory SubscriptionInfo.formHString(String? info) { if (info == null) return const SubscriptionInfo(); - final list = info.split(";"); + final list = info.split(';'); Map map = {}; for (final i in list) { - final keyValue = i.trim().split("="); + final keyValue = i.trim().split('='); map[keyValue[0]] = int.tryParse(keyValue[1]); } return SubscriptionInfo( - upload: map["upload"] ?? 0, - download: map["download"] ?? 0, - total: map["total"] ?? 0, - expire: map["expire"] ?? 0, + upload: map['upload'] ?? 0, + download: map['download'] ?? 0, + total: map['total'] ?? 0, + expire: map['expire'] ?? 0, ); } } @@ -50,7 +50,7 @@ class Profile with _$Profile { required String id, String? label, String? currentGroupName, - @Default("") String url, + @Default('') String url, DateTime? lastUpdateDate, required Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, @@ -169,7 +169,7 @@ extension ProfileExtension on Profile { Future update() async { final response = await request.getFileResponseForUrl(url); - final disposition = response.headers.value("content-disposition"); + final disposition = response.headers.value('content-disposition'); final userinfo = response.headers.value('subscription-userinfo'); return await copyWith( label: label ?? utils.getFileNameForDisposition(disposition) ?? id, diff --git a/lib/models/selector.dart b/lib/models/selector.dart index d28f0a3..a339412 100644 --- a/lib/models/selector.dart +++ b/lib/models/selector.dart @@ -66,7 +66,6 @@ class ProfilesSelectorState with _$ProfilesSelectorState { class NetworkDetectionState with _$NetworkDetectionState { const factory NetworkDetectionState({ required bool isLoading, - required bool isTesting, required IpInfo? ipInfo, }) = _NetworkDetectionState; } @@ -88,28 +87,14 @@ class TrayState with _$TrayState { } @freezed -class HomeState with _$HomeState { - const factory HomeState({ +class NavigationState with _$NavigationState { + const factory NavigationState({ required PageLabel pageLabel, required List navigationItems, required ViewMode viewMode, required String? locale, - }) = _HomeState; -} - -@freezed -class ProxiesSelectorState with _$ProxiesSelectorState { - const factory ProxiesSelectorState({ - required List groupNames, - required String? currentGroupName, - }) = _ProxiesSelectorState; -} - -@freezed -class GroupNamesState with _$GroupNamesState { - const factory GroupNamesState({ - required List groupNames, - }) = _GroupNamesState; + required int currentIndex, + }) = _NavigationState; } @freezed @@ -127,16 +112,27 @@ class NavigationItemsState with _$NavigationItemsState { } @freezed -class ProxiesListSelectorState with _$ProxiesListSelectorState { - const factory ProxiesListSelectorState({ - required List groupNames, +class ProxiesListState with _$ProxiesListState { + const factory ProxiesListState({ + required List groups, required Set currentUnfoldSet, required ProxiesSortType proxiesSortType, required ProxyCardType proxyCardType, required num sortNum, required int columns, - required String query, - }) = _ProxiesListSelectorState; + }) = _ProxiesListState; +} + +@freezed +class ProxiesTabState with _$ProxiesTabState { + const factory ProxiesTabState({ + required List groups, + required String? currentGroupName, + required ProxiesSortType proxiesSortType, + required ProxyCardType proxyCardType, + required num sortNum, + required int columns, + }) = _ProxiesTabState; } @freezed diff --git a/lib/models/widget.dart b/lib/models/widget.dart index b25bde2..49eddef 100644 --- a/lib/models/widget.dart +++ b/lib/models/widget.dart @@ -32,15 +32,14 @@ class AppBarState with _$AppBarState { class AppBarSearchState with _$AppBarSearchState { const factory AppBarSearchState({ required Function(String) onSearch, - @Default(false) bool isSearch, + @Default(null) String? query, }) = _AppBarSearchState; } @freezed class AppBarEditState with _$AppBarEditState { const factory AppBarEditState({ - @Default(0) editCount, - @Default(false) bool isEdit, + @Default(0) int editCount, required Function() onExit, }) = _AppBarEditState; } diff --git a/lib/pages/editor.dart b/lib/pages/editor.dart index c6d45b8..5c61dd3 100644 --- a/lib/pages/editor.dart +++ b/lib/pages/editor.dart @@ -107,11 +107,11 @@ class _EditorPageState extends ConsumerState { ); } - _handleSearch() { + void _handleSearch() { _findController.findMode(); } - _handleImport() async { + Future _handleImport() async { final option = await globalState.showCommonDialog( child: _ImportOptionsDialog(), ); @@ -129,8 +129,8 @@ class _EditorPageState extends ConsumerState { } final url = await globalState.showCommonDialog( child: InputDialog( - title: "导入", - value: "", + title: '导入', + value: '', labelText: appLocalizations.url, validator: (value) { if (value == null || value.isEmpty) { @@ -292,7 +292,7 @@ class _EditorPageState extends ConsumerState { mode: langYaml, ), if (widget.languages.contains(Language.javaScript)) - "javascript": CodeHighlightThemeMode( + 'javascript': CodeHighlightThemeMode( mode: langJavascript, ), }, @@ -433,7 +433,7 @@ class FindPanel extends StatelessWidget implements PreferredSizeWidget { return bar; } - _buildFindInput(BuildContext context, CodeFindValue value) { + Stack _buildFindInput(BuildContext context, CodeFindValue value) { return Stack( alignment: Alignment.center, children: [ @@ -550,7 +550,7 @@ class ContextMenuControllerImpl implements SelectionToolbarController { OverlayEntry? _overlayEntry; bool _isFirstRender = true; - _removeOverLayEntry() { + void _removeOverLayEntry() { _overlayEntry?.remove(); _overlayEntry = null; _isFirstRender = true; @@ -689,7 +689,7 @@ class _ImportOptionsDialog extends StatefulWidget { } class _ImportOptionsDialogState extends State<_ImportOptionsDialog> { - _handleOnTab(ImportOption value) { + void _handleOnTab(ImportOption value) { Navigator.of(context).pop(value); } diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 933897c..ac5bef7 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -1,12 +1,10 @@ -import 'dart:io'; - import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/enum/enum.dart'; -import 'package:fl_clash/models/models.dart'; import 'package:fl_clash/providers/providers.dart'; import 'package:fl_clash/state.dart'; import 'package:fl_clash/widgets/widgets.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:intl/intl.dart'; @@ -18,43 +16,99 @@ class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return HomeBackScope( - child: Consumer( - builder: (_, ref, child) { - final state = ref.watch(homeStateProvider); - final viewMode = state.viewMode; - final navigationItems = state.navigationItems; - final pageLabel = state.pageLabel; - final index = navigationItems.lastIndexWhere( - (element) => element.label == pageLabel, - ); - final currentIndex = index == -1 ? 0 : index; - final navigationBar = CommonNavigationBar( - viewMode: viewMode, - navigationItems: navigationItems, - currentIndex: currentIndex, - ); - final bottomNavigationBar = - viewMode == ViewMode.mobile ? navigationBar : null; - final sideNavigationBar = - viewMode != ViewMode.mobile ? navigationBar : null; - return CommonScaffold( - key: globalState.homeScaffoldKey, - title: Intl.message( - pageLabel.name, - ), - sideNavigationBar: sideNavigationBar, - body: child!, - bottomNavigationBar: bottomNavigationBar, - ); - }, - child: _HomePageView(), + child: Material( + color: context.colorScheme.surface, + child: Consumer( + builder: (context, ref, __) { + final state = ref.watch(navigationStateProvider); + final isMobile = state.viewMode == ViewMode.mobile; + final navigationItems = state.navigationItems; + final pageView = _HomePageView(pageBuilder: (_, index) { + final navigationItem = state.navigationItems[index]; + final navigationView = navigationItem.builder(context); + final view = isMobile + ? KeepScope( + keep: navigationItem.keep, + child: navigationView, + ) + : KeepScope( + keep: navigationItem.keep, + child: Navigator( + onGenerateRoute: (_) { + return CommonRoute( + builder: (_) => navigationView, + ); + }, + ), + ); + return view; + }); + final currentIndex = state.currentIndex; + final bottomNavigationBar = NavigationBarTheme( + data: _NavigationBarDefaultsM3(context), + child: NavigationBar( + destinations: navigationItems + .map( + (e) => NavigationDestination( + icon: e.icon, + label: Intl.message(e.label.name), + ), + ) + .toList(), + onDestinationSelected: (index) { + globalState.appController.toPage( + navigationItems[index].label, + ); + }, + selectedIndex: currentIndex, + ), + ); + if (isMobile) { + return AnnotatedRegion( + value: globalState.appState.systemUiOverlayStyle.copyWith( + systemNavigationBarColor: + context.colorScheme.surfaceContainer, + ), + child: Column( + children: [ + Flexible( + flex: 1, + child: MediaQuery.removePadding( + removeTop: false, + removeBottom: true, + removeLeft: true, + removeRight: true, + context: context, + child: pageView, + ), + ), + MediaQuery.removePadding( + removeTop: true, + removeBottom: false, + removeLeft: true, + removeRight: true, + context: context, + child: bottomNavigationBar, + ), + ], + ), + ); + } else { + return pageView; + } + }, + ), ), ); } } class _HomePageView extends ConsumerStatefulWidget { - const _HomePageView(); + final IndexedWidgetBuilder pageBuilder; + + const _HomePageView({ + required this.pageBuilder, + }); @override ConsumerState createState() => _HomePageViewState(); @@ -64,18 +118,17 @@ class _HomePageViewState extends ConsumerState<_HomePageView> { late PageController _pageController; @override - void initState() { + initState() { super.initState(); _pageController = PageController( initialPage: _pageIndex, - keepPage: true, ); ref.listenManual(currentPageLabelProvider, (prev, next) { if (prev != next) { _toPage(next); } }); - ref.listenManual(currentNavigationsStateProvider, (prev, next) { + ref.listenManual(currentNavigationItemsStateProvider, (prev, next) { if (prev?.value.length != next.value.length) { _updatePageController(); } @@ -83,17 +136,18 @@ class _HomePageViewState extends ConsumerState<_HomePageView> { } int get _pageIndex { - final navigationItems = ref.read(currentNavigationsStateProvider).value; + final navigationItems = ref.read(currentNavigationItemsStateProvider).value; return navigationItems.indexWhere( (item) => item.label == globalState.appState.pageLabel, ); } - _toPage(PageLabel pageLabel, [bool ignoreAnimateTo = false]) async { + Future _toPage(PageLabel pageLabel, + [bool ignoreAnimateTo = false]) async { if (!mounted) { return; } - final navigationItems = ref.read(currentNavigationsStateProvider).value; + final navigationItems = ref.read(currentNavigationItemsStateProvider).value; final index = navigationItems.indexWhere((item) => item.label == pageLabel); if (index == -1) { return; @@ -111,7 +165,7 @@ class _HomePageViewState extends ConsumerState<_HomePageView> { } } - _updatePageController() { + void _updatePageController() { final pageLabel = globalState.appState.pageLabel; _toPage(pageLabel, true); } @@ -124,138 +178,19 @@ class _HomePageViewState extends ConsumerState<_HomePageView> { @override Widget build(BuildContext context) { - final navigationItems = ref.watch(currentNavigationsStateProvider).value; + final itemCount = ref.watch(currentNavigationItemsStateProvider + .select((state) => state.value.length)); return PageView.builder( controller: _pageController, physics: const NeverScrollableScrollPhysics(), - itemCount: navigationItems.length, - // onPageChanged: (index) { - // debouncer.call(DebounceTag.pageChange, () { - // WidgetsBinding.instance.addPostFrameCallback((_) { - // if (_pageIndex != index) { - // final pageLabel = navigationItems[index].label; - // _toPage(pageLabel, true); - // } - // }); - // }); - // }, - itemBuilder: (_, index) { - final navigationItem = navigationItems[index]; - return KeepScope( - keep: navigationItem.keep, - key: Key(navigationItem.label.name), - child: navigationItem.view, - ); + itemCount: itemCount, + itemBuilder: (context, index) { + return widget.pageBuilder(context, index); }, ); } } -class CommonNavigationBar extends ConsumerWidget { - final ViewMode viewMode; - final List navigationItems; - final int currentIndex; - - const CommonNavigationBar({ - super.key, - required this.viewMode, - required this.navigationItems, - required this.currentIndex, - }); - - @override - Widget build(BuildContext context, ref) { - if (viewMode == ViewMode.mobile) { - return NavigationBarTheme( - data: _NavigationBarDefaultsM3(context), - child: NavigationBar( - destinations: navigationItems - .map( - (e) => NavigationDestination( - icon: e.icon, - label: Intl.message(e.label.name), - ), - ) - .toList(), - onDestinationSelected: (index) { - globalState.appController.toPage(navigationItems[index].label); - }, - selectedIndex: currentIndex, - ), - ); - } - final showLabel = ref.watch(appSettingProvider).showLabel; - return Material( - color: context.colorScheme.surfaceContainer, - child: Column( - children: [ - Expanded( - child: ScrollConfiguration( - behavior: HiddenBarScrollBehavior(), - child: SingleChildScrollView( - child: IntrinsicHeight( - child: NavigationRail( - backgroundColor: context.colorScheme.surfaceContainer, - selectedIconTheme: IconThemeData( - color: context.colorScheme.onSurfaceVariant, - ), - unselectedIconTheme: IconThemeData( - color: context.colorScheme.onSurfaceVariant, - ), - selectedLabelTextStyle: - context.textTheme.labelLarge!.copyWith( - color: context.colorScheme.onSurface, - ), - unselectedLabelTextStyle: - context.textTheme.labelLarge!.copyWith( - color: context.colorScheme.onSurface, - ), - destinations: navigationItems - .map( - (e) => NavigationRailDestination( - icon: e.icon, - label: Text( - Intl.message(e.label.name), - ), - ), - ) - .toList(), - onDestinationSelected: (index) { - globalState.appController - .toPage(navigationItems[index].label); - }, - extended: false, - selectedIndex: currentIndex, - labelType: showLabel - ? NavigationRailLabelType.all - : NavigationRailLabelType.none, - ), - ), - ), - ), - ), - const SizedBox( - height: 16, - ), - IconButton( - onPressed: () { - ref.read(appSettingProvider.notifier).updateState( - (state) => state.copyWith( - showLabel: !state.showLabel, - ), - ); - }, - icon: const Icon(Icons.menu), - ), - const SizedBox( - height: 16, - ), - ], - ), - ); - } -} - class _NavigationBarDefaultsM3 extends NavigationBarThemeData { _NavigationBarDefaultsM3(this.context) : super( @@ -319,7 +254,7 @@ class HomeBackScope extends StatelessWidget { @override Widget build(BuildContext context) { - if (Platform.isAndroid) { + if (system.isAndroid) { return CommonPopScope( onPop: () async { final canPop = Navigator.canPop(context); diff --git a/lib/pages/scan.dart b/lib/pages/scan.dart index 1c65c60..5e84bbb 100644 --- a/lib/pages/scan.dart +++ b/lib/pages/scan.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:math'; + import 'package:fl_clash/common/color.dart'; import 'package:fl_clash/state.dart'; import 'package:fl_clash/widgets/activate_box.dart'; @@ -29,7 +30,7 @@ class _ScanPageState extends State with WidgetsBindingObserver { unawaited(controller.start()); } - _handleBarcode(BarcodeCapture barcodeCapture) { + void _handleBarcode(BarcodeCapture barcodeCapture) { final barcode = barcodeCapture.barcodes.first; if (barcode.type == BarcodeType.url) { Navigator.pop( diff --git a/lib/plugins/app.dart b/lib/plugins/app.dart index 19d0edb..4062e7a 100644 --- a/lib/plugins/app.dart +++ b/lib/plugins/app.dart @@ -1,9 +1,9 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:io'; import 'dart:isolate'; import 'package:fl_clash/common/app_localizations.dart'; +import 'package:fl_clash/common/system.dart'; import 'package:fl_clash/models/models.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -15,18 +15,18 @@ class App { Function()? onExit; App._internal() { - methodChannel = const MethodChannel("app"); + methodChannel = const MethodChannel('app'); methodChannel.setMethodCallHandler((call) async { switch (call.method) { - case "exit": + case 'exit': if (onExit != null) { await onExit!(); } - case "getText": + case 'getText': try { return Intl.message(call.arguments as String); } catch (_) { - return ""; + return ''; } default: throw MissingPluginException(); @@ -40,12 +40,12 @@ class App { } Future moveTaskToBack() async { - return await methodChannel.invokeMethod("moveTaskToBack"); + return await methodChannel.invokeMethod('moveTaskToBack'); } Future> getPackages() async { final packagesString = - await methodChannel.invokeMethod("getPackages"); + await methodChannel.invokeMethod('getPackages'); return Isolate.run>(() { final List packagesRaw = packagesString != null ? json.decode(packagesString) : []; @@ -55,7 +55,7 @@ class App { Future> getChinaPackageNames() async { final packageNamesString = - await methodChannel.invokeMethod("getChinaPackageNames"); + await methodChannel.invokeMethod('getChinaPackageNames'); return Isolate.run>(() { final List packageNamesRaw = packageNamesString != null ? json.decode(packageNamesString) : []; @@ -64,15 +64,15 @@ class App { } Future openFile(String path) async { - return await methodChannel.invokeMethod("openFile", { - "path": path, + return await methodChannel.invokeMethod('openFile', { + 'path': path, }) ?? false; } Future getPackageIcon(String packageName) async { - final base64 = await methodChannel.invokeMethod("getPackageIcon", { - "packageName": packageName, + final base64 = await methodChannel.invokeMethod('getPackageIcon', { + 'packageName': packageName, }); if (base64 == null) { return null; @@ -81,23 +81,23 @@ class App { } Future tip(String? message) async { - return await methodChannel.invokeMethod("tip", { - "message": "$message", + return await methodChannel.invokeMethod('tip', { + 'message': '$message', }); } Future initShortcuts() async { return await methodChannel.invokeMethod( - "initShortcuts", + 'initShortcuts', appLocalizations.toggle, ); } Future updateExcludeFromRecents(bool value) async { - return await methodChannel.invokeMethod("updateExcludeFromRecents", { - "value": value, + return await methodChannel.invokeMethod('updateExcludeFromRecents', { + 'value': value, }); } } -final app = Platform.isAndroid ? App() : null; +final app = system.isAndroid ? App() : null; diff --git a/lib/plugins/service.dart b/lib/plugins/service.dart index f324601..ce6ba22 100644 --- a/lib/plugins/service.dart +++ b/lib/plugins/service.dart @@ -1,7 +1,8 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:io'; import 'dart:isolate'; + +import 'package:fl_clash/common/system.dart'; import 'package:fl_clash/state.dart'; import 'package:flutter/services.dart'; @@ -13,7 +14,7 @@ class Service { ReceivePort? receiver; Service._internal() { - methodChannel = const MethodChannel("service"); + methodChannel = const MethodChannel('service'); } factory Service() { @@ -22,23 +23,24 @@ class Service { } Future init() async { - return await methodChannel.invokeMethod("init"); + return await methodChannel.invokeMethod('init'); } Future destroy() async { - return await methodChannel.invokeMethod("destroy"); + return await methodChannel.invokeMethod('destroy'); } Future startVpn() async { final options = await clashLib?.getAndroidVpnOptions(); - return await methodChannel.invokeMethod("startVpn", { + return await methodChannel.invokeMethod('startVpn', { 'data': json.encode(options), }); } Future stopVpn() async { - return await methodChannel.invokeMethod("stopVpn"); + return await methodChannel.invokeMethod('stopVpn'); } } -Service? get service => Platform.isAndroid && !globalState.isService ? Service() : null; +Service? get service => + system.isAndroid && !globalState.isService ? Service() : null; diff --git a/lib/plugins/tile.dart b/lib/plugins/tile.dart index f325db9..bf1ce86 100644 --- a/lib/plugins/tile.dart +++ b/lib/plugins/tile.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'dart:io'; +import 'package:fl_clash/common/system.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; @@ -9,13 +9,10 @@ abstract mixin class TileListener { void onStop() {} - void onDetached(){ - - } + void onDetached() {} } class Tile { - final MethodChannel _channel = const MethodChannel('tile'); Tile._() { @@ -29,13 +26,13 @@ class Tile { Future _methodCallHandler(MethodCall call) async { for (final TileListener listener in _listeners) { switch (call.method) { - case "start": + case 'start': listener.onStart(); break; - case "stop": + case 'stop': listener.onStop(); break; - case "detached": + case 'detached': listener.onDetached(); break; } @@ -55,4 +52,4 @@ class Tile { } } -final tile = Platform.isAndroid ? Tile.instance : null; +final tile = system.isAndroid ? Tile.instance : null; diff --git a/lib/plugins/vpn.dart b/lib/plugins/vpn.dart index 212e5a0..5bc87cb 100644 --- a/lib/plugins/vpn.dart +++ b/lib/plugins/vpn.dart @@ -17,22 +17,22 @@ class Vpn { FutureOr Function()? handleGetStartForegroundParams; Vpn._internal() { - methodChannel = const MethodChannel("vpn"); + methodChannel = const MethodChannel('vpn'); methodChannel.setMethodCallHandler((call) async { switch (call.method) { - case "gc": + case 'gc': clashCore.requestGc(); - case "getStartForegroundParams": + case 'getStartForegroundParams': if (handleGetStartForegroundParams != null) { return await handleGetStartForegroundParams!(); } - return ""; - case "status": + return ''; + case 'status': return clashLibHandler?.getRunTime() != null; default: for (final VpnListener listener in _listeners) { switch (call.method) { - case "dnsChanged": + case 'dnsChanged': final dns = call.arguments as String; listener.onDnsChanged(dns); } @@ -49,13 +49,13 @@ class Vpn { final ObserverList _listeners = ObserverList(); Future start(AndroidVpnOptions options) async { - return await methodChannel.invokeMethod("start", { + return await methodChannel.invokeMethod('start', { 'data': json.encode(options), }); } Future stop() async { - return await methodChannel.invokeMethod("stop"); + return await methodChannel.invokeMethod('stop'); } void addListener(VpnListener listener) { diff --git a/lib/providers/app.dart b/lib/providers/app.dart index af16f73..d55b848 100644 --- a/lib/providers/app.dart +++ b/lib/providers/app.dart @@ -2,7 +2,7 @@ import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/enum/enum.dart'; import 'package:fl_clash/models/models.dart'; import 'package:fl_clash/state.dart'; -import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; @@ -30,7 +30,7 @@ class Logs extends _$Logs with AutoDisposeNotifierMixin { return globalState.appState.logs; } - addLog(Log value) { + void addLog(Log value) { state = state.copyWith()..add(value); } @@ -45,7 +45,7 @@ class Logs extends _$Logs with AutoDisposeNotifierMixin { @riverpod class Requests extends _$Requests with AutoDisposeNotifierMixin { @override - FixedList build() { + FixedList build() { return globalState.appState.requests; } @@ -56,7 +56,7 @@ class Requests extends _$Requests with AutoDisposeNotifierMixin { ); } - addRequest(Connection value) { + void addRequest(TrackerInfo value) { state = state.copyWith()..add(value); } } @@ -75,7 +75,7 @@ class Providers extends _$Providers with AutoDisposeNotifierMixin { ); } - setProvider(ExternalProvider? provider) { + void setProvider(ExternalProvider? provider) { if (provider == null) return; final index = state.indexWhere((item) => item.name == provider.name); if (index == -1) return; @@ -99,9 +99,10 @@ class Packages extends _$Packages with AutoDisposeNotifierMixin { } @riverpod -class AppBrightness extends _$AppBrightness with AutoDisposeNotifierMixin { +class SystemBrightness extends _$SystemBrightness + with AutoDisposeNotifierMixin { @override - Brightness? build() { + Brightness build() { return globalState.appState.brightness; } @@ -112,7 +113,7 @@ class AppBrightness extends _$AppBrightness with AutoDisposeNotifierMixin { ); } - setState(Brightness? value) { + void setState(Brightness value) { state = value; } } @@ -131,11 +132,11 @@ class Traffics extends _$Traffics with AutoDisposeNotifierMixin { ); } - addTraffic(Traffic value) { + void addTraffic(Traffic value) { state = state.copyWith()..add(value); } - clear() { + void clear() { state = state.copyWith()..clear(); } } @@ -281,7 +282,7 @@ class SortNum extends _$SortNum with AutoDisposeNotifierMixin { ); } - add() => state++; + int add() => state++; } @riverpod @@ -298,7 +299,7 @@ class CheckIpNum extends _$CheckIpNum with AutoDisposeNotifierMixin { ); } - add() => state++; + int add() => state++; } @riverpod @@ -316,6 +317,21 @@ class BackBlock extends _$BackBlock with AutoDisposeNotifierMixin { } } +@riverpod +class Loading extends _$Loading with AutoDisposeNotifierMixin { + @override + bool build() { + return globalState.appState.loading; + } + + @override + onUpdate(value) { + globalState.appState = globalState.appState.copyWith( + loading: value, + ); + } +} + @riverpod class Version extends _$Version with AutoDisposeNotifierMixin { @override @@ -360,7 +376,7 @@ class DelayDataSource extends _$DelayDataSource with AutoDisposeNotifierMixin { ); } - setDelay(Delay delay) { + void setDelay(Delay delay) { if (state[delay.url]?[delay.name] != delay.value) { final DelayMap newDelayMap = Map.from(state); if (newDelayMap[delay.url] == null) { @@ -373,16 +389,17 @@ class DelayDataSource extends _$DelayDataSource with AutoDisposeNotifierMixin { } @riverpod -class ProxiesQuery extends _$ProxiesQuery with AutoDisposeNotifierMixin { +class SystemUiOverlayStyleState extends _$SystemUiOverlayStyleState + with AutoDisposeNotifierMixin { @override - String build() { - return globalState.appState.proxiesQuery; + SystemUiOverlayStyle build() { + return globalState.appState.systemUiOverlayStyle; } @override onUpdate(value) { globalState.appState = globalState.appState.copyWith( - proxiesQuery: value, + systemUiOverlayStyle: value, ); } } diff --git a/lib/providers/config.dart b/lib/providers/config.dart index 0bd820c..1dc438f 100644 --- a/lib/providers/config.dart +++ b/lib/providers/config.dart @@ -19,7 +19,7 @@ class AppSetting extends _$AppSetting with AutoDisposeNotifierMixin { ); } - updateState(AppSettingProps Function(AppSettingProps state) builder) { + void updateState(AppSettingProps Function(AppSettingProps state) builder) { state = builder(state); } } @@ -38,7 +38,7 @@ class WindowSetting extends _$WindowSetting with AutoDisposeNotifierMixin { ); } - updateState(WindowProps Function(WindowProps state) builder) { + void updateState(WindowProps Function(WindowProps state) builder) { state = builder(state); } } @@ -57,7 +57,7 @@ class VpnSetting extends _$VpnSetting with AutoDisposeNotifierMixin { ); } - updateState(VpnProps Function(VpnProps state) builder) { + void updateState(VpnProps Function(VpnProps state) builder) { state = builder(state); } } @@ -76,7 +76,7 @@ class NetworkSetting extends _$NetworkSetting with AutoDisposeNotifierMixin { ); } - updateState(NetworkProps Function(NetworkProps state) builder) { + void updateState(NetworkProps Function(NetworkProps state) builder) { state = builder(state); } } @@ -95,7 +95,7 @@ class ThemeSetting extends _$ThemeSetting with AutoDisposeNotifierMixin { ); } - updateState(ThemeProps Function(ThemeProps state) builder) { + void updateState(ThemeProps Function(ThemeProps state) builder) { state = builder(state); } } @@ -126,7 +126,7 @@ class Profiles extends _$Profiles with AutoDisposeNotifierMixin { } } - setProfile(Profile profile) { + void setProfile(Profile profile) { final List profilesTemp = List.from(state); final index = profilesTemp.indexWhere((element) => element.id == profile.id); @@ -141,7 +141,8 @@ class Profiles extends _$Profiles with AutoDisposeNotifierMixin { state = profilesTemp; } - updateProfile(String profileId, Profile Function(Profile profile) builder) { + void updateProfile( + String profileId, Profile Function(Profile profile) builder) { final List profilesTemp = List.from(state); final index = profilesTemp.indexWhere((element) => element.id == profileId); if (index != -1) { @@ -150,7 +151,7 @@ class Profiles extends _$Profiles with AutoDisposeNotifierMixin { state = profilesTemp; } - deleteProfileById(String id) { + void deleteProfileById(String id) { state = state.where((element) => element.id != id).toList(); } } @@ -185,7 +186,7 @@ class AppDAVSetting extends _$AppDAVSetting with AutoDisposeNotifierMixin { ); } - updateState(DAV? Function(DAV? state) builder) { + void updateState(DAV? Function(DAV? state) builder) { state = builder(state); } } @@ -235,7 +236,7 @@ class ProxiesStyleSetting extends _$ProxiesStyleSetting ); } - updateState(ProxiesStyle Function(ProxiesStyle state) builder) { + void updateState(ProxiesStyle Function(ProxiesStyle state) builder) { state = builder(state); } } @@ -254,7 +255,7 @@ class ScriptState extends _$ScriptState with AutoDisposeNotifierMixin { ); } - setScript(Script script) { + void setScript(Script script) { final list = List