Compare commits

..

1 Commits

Author SHA1 Message Date
chen08209
9271d59f72 Fix windows tun issues
Fix windows backup recovery issues

Optimize overwrite handle

Optimize access control page

Optimize some details
2025-11-28 17:35:27 +08:00
88 changed files with 1784 additions and 2713 deletions

View File

@@ -177,23 +177,21 @@ jobs:
- name: Generate release.md
run: |
tags=($(git tag --merged HEAD --sort=-creatordate))
preTag=$(curl -s "https://api.github.com/repos/chen08209/FlClash/releases/latest" | \
sed -nE 's/.*"tag_name": "([^"]+)".*/\1/p')
[ -z "$preTag" ] && preTag=""
preTag=$(curl -s "https://api.github.com/repos/chen08209/FlClash/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
out="release.md" > "$out"
for i in "${!tags[@]}"; do
curr="${tags[i]}"
[[ "$curr" == "$preTag" ]] && break
prev="${tags[i+1]}"
range="${prev:+$prev..}$curr"
echo -e "## $curr\n" >> "$out"
git log --no-merges --pretty=format:"%B" "$range" | \
awk '!/Update changelog/ && NF {print "- " $0 "\n"}' >> "$out"
done
- name: Push to telegram
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}

4
.gitmodules vendored
View File

@@ -6,9 +6,5 @@
path = plugins/flutter_distributor
url = git@github.com:chen08209/flutter_distributor.git
branch = FlClash
[submodule "plugins/tray_manager"]
path = plugins/tray_manager
url = git@github.com:chen08209/tray_manager.git
branch = main

View File

@@ -1,25 +1,25 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="240"
android:viewportHeight="240">
<group android:scaleX="0.924"
android:scaleY="0.924"
android:translateX="9.12"
android:translateY="9.12">
<group android:scaleX="0.63461536"
android:scaleY="0.63461536"
android:translateX="45.96154"
android:translateY="43.846153">
<path
android:pathData="M60.65,89.6L154.18,35.6A18,18 107.59,0 1,178.77 42.19L178.77,42.19A18,18 107.59,0 1,172.18 66.78L78.65,120.78A18,18 106.67,0 1,54.06 114.19L54.06,114.19A18,18 106.67,0 1,60.65 89.6z"
android:fillColor="#6666FB"/>
<path
android:pathData="M84.65,131.17L131.42,104.17A18,18 107.83,0 1,156 110.76L156,110.76A18,18 107.83,0 1,149.42 135.35L102.65,162.35A18,18 106.67,0 1,78.06 155.76L78.06,155.76A18,18 106.67,0 1,84.65 131.17z"
android:fillColor="#336AB6"/>
<path
android:pathData="M108.65,172.74L108.65,172.74A18,18 116.03,0 1,133.24 179.33L133.24,179.33A18,18 116.03,0 1,126.65 203.92L126.65,203.92A18,18 116.03,0 1,102.06 197.33L102.06,197.33A18,18 116.03,0 1,108.65 172.74z"
android:fillColor="#5CA8E9"/>
</group>
android:width="108dp"
android:height="108dp"
android:viewportWidth="240"
android:viewportHeight="240">
<group android:scaleX="0.924"
android:scaleY="0.924"
android:translateX="9.12"
android:translateY="9.12">
<group android:scaleX="0.63461536"
android:scaleY="0.63461536"
android:translateX="45.96154"
android:translateY="43.846153">
<path
android:pathData="M60.65,89.6L154.18,35.6A18,18 107.59,0 1,178.77 42.19L178.77,42.19A18,18 107.59,0 1,172.18 66.78L78.65,120.78A18,18 106.67,0 1,54.06 114.19L54.06,114.19A18,18 106.67,0 1,60.65 89.6z"
android:fillColor="#6666FB"/>
<path
android:pathData="M84.65,131.17L131.42,104.17A18,18 107.83,0 1,156 110.76L156,110.76A18,18 107.83,0 1,149.42 135.35L102.65,162.35A18,18 106.67,0 1,78.06 155.76L78.06,155.76A18,18 106.67,0 1,84.65 131.17z"
android:fillColor="#336AB6"/>
<path
android:pathData="M108.65,172.74L108.65,172.74A18,18 116.03,0 1,133.24 179.33L133.24,179.33A18,18 116.03,0 1,126.65 203.92L126.65,203.92A18,18 116.03,0 1,102.06 197.33L102.06,197.33A18,18 116.03,0 1,108.65 172.74z"
android:fillColor="#5CA8E9"/>
</group>
</group>
</vector>

View File

@@ -463,7 +463,5 @@
"coreConfigChangeDetected": "Core configuration change detected",
"reload": "Reload",
"vpnConfigChangeDetected": "VPN configuration change detected",
"restart": "Restart",
"speedStatistics": "Speed statistics",
"resetPageChangesTip": "The current page has changes. Are you sure you want to reset?"
"restart": "Restart"
}

View File

@@ -464,7 +464,5 @@
"coreConfigChangeDetected": "コア設定の変更が検出されました",
"reload": "リロード",
"vpnConfigChangeDetected": "VPN設定の変更が検出されました",
"restart": "再起動",
"speedStatistics": "速度統計",
"resetPageChangesTip": "現在のページに変更があります。リセットしてもよろしいですか?"
"restart": "再起動"
}

View File

@@ -464,7 +464,5 @@
"coreConfigChangeDetected": "Обнаружено изменение конфигурации ядра",
"reload": "Перезагрузить",
"vpnConfigChangeDetected": "Обнаружено изменение конфигурации VPN",
"restart": "Перезапустить",
"speedStatistics": "Статистика скорости",
"resetPageChangesTip": "На текущей странице есть изменения. Вы уверены, что хотите сбросить?"
"restart": "Перезапустить"
}

View File

@@ -464,7 +464,5 @@
"coreConfigChangeDetected": "检测到核心配置更改",
"reload": "重载",
"vpnConfigChangeDetected": "检测到VPN相关配置改动",
"restart": "重启",
"speedStatistics": "网速统计",
"resetPageChangesTip": "当前页面存在更改,确定重置吗?"
"restart": "重启"
}

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -7,7 +7,7 @@ List<Group> computeSort({
required List<Group> groups,
required ProxiesSortType sortType,
required DelayMap delayMap,
required Map<String, String> selectedMap,
required SelectedMap selectedMap,
required String defaultTestUrl,
}) {
return groups.map((group) {
@@ -31,7 +31,7 @@ DelayState computeProxyDelayState({
required String proxyName,
required String testUrl,
required List<Group> groups,
required Map<String, String> selectedMap,
required SelectedMap selectedMap,
required DelayMap delayMap,
}) {
final state = computeRealSelectedProxyState(
@@ -47,7 +47,7 @@ DelayState computeProxyDelayState({
SelectedProxyState computeRealSelectedProxyState(
String proxyName, {
required List<Group> groups,
required Map<String, String> selectedMap,
required SelectedMap selectedMap,
}) {
return _getRealSelectedProxyState(
SelectedProxyState(proxyName: proxyName),
@@ -59,7 +59,7 @@ SelectedProxyState computeRealSelectedProxyState(
SelectedProxyState _getRealSelectedProxyState(
SelectedProxyState state, {
required List<Group> groups,
required Map<String, String> selectedMap,
required SelectedMap selectedMap,
}) {
if (state.proxyName.isEmpty) return state;
final index = groups.indexWhere((element) => element.name == state.proxyName);
@@ -83,7 +83,7 @@ List<Proxy> _sortOfDelay({
required List<Group> groups,
required List<Proxy> proxies,
required DelayMap delayMap,
required Map<String, String> selectedMap,
required SelectedMap selectedMap,
required String testUrl,
}) {
return List.from(proxies)..sort((a, b) {

View File

@@ -69,14 +69,11 @@ const stringListEquality = ListEquality<String>();
const intListEquality = ListEquality<int>();
const logListEquality = ListEquality<Log>();
const groupListEquality = ListEquality<Group>();
const ruleListEquality = ListEquality<Rule>();
const scriptEquality = ListEquality<Script>();
const ruleEquality = ListEquality<Rule>();
const externalProviderListEquality = ListEquality<ExternalProvider>();
const packageListEquality = ListEquality<Package>();
const hotKeyActionListEquality = ListEquality<HotKeyAction>();
const stringAndStringMapEquality = MapEquality<String, String>();
const stringAndStringMapEntryListEquality =
ListEquality<MapEntry<String, String>>();
const stringAndStringMapEntryIterableEquality =
IterableEquality<MapEntry<String, String>>();
const delayMapEquality = MapEquality<String, Map<String, int?>>();

View File

@@ -83,13 +83,6 @@ extension ListExt<T> on List<T> {
return last;
}
T safeLast(T value) {
if (isNotEmpty) {
return last;
}
return value;
}
void addOrRemove(T value) {
if (contains(value)) {
remove(value);
@@ -142,14 +135,4 @@ extension MapExt<K, V> on Map<K, V> {
}
return this[key]!;
}
Map<K, V> copyWitUpdate(K key, V? value) {
final newMap = Map<K, V>.from(this);
if (value == null) {
newMap.remove(key);
} else {
newMap[key] = value;
}
return newMap;
}
}

View File

@@ -33,25 +33,11 @@ extension NumExt on num {
unit: units[unitIndex].name,
);
}
TrafficShow get shortTraffic {
final units = TrafficUnit.values;
var size = toDouble();
var unitIndex = 0;
while (size >= 1024 && unitIndex < units.length - 1) {
size /= 1024;
unitIndex++;
}
return TrafficShow(
value: size.toStringAsFixed(0),
unit: ' ${units[unitIndex].name}',
);
}
}
extension DoubleExt on double {
bool moreOrEqual(double value) {
return this > value || (value - this).abs() < precisionErrorTolerance + 2;
return this > value || (value - this).abs() < precisionErrorTolerance + 1;
}
}

View File

@@ -22,16 +22,6 @@ extension StringExtension on String {
return toLowerCase().compareTo(other.toLowerCase());
}
String safeSubstring(int start, [int? end]) {
if (isEmpty) return '';
final safeStart = start.clamp(0, length);
if (end == null) {
return substring(safeStart);
}
final safeEnd = end.clamp(safeStart, length);
return substring(safeStart, safeEnd);
}
List<int> get encodeUtf16LeWithBom {
final byteData = ByteData(length * 2);
final bom = [0xFF, 0xFE];

View File

@@ -1,9 +1,10 @@
import 'dart:io';
import 'package:fl_clash/common/iterable.dart';
import 'package:fl_clash/common/utils.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:intl/intl.dart';
import 'package:tray_manager/tray_manager.dart';
@@ -14,34 +15,24 @@ import 'system.dart';
import 'window.dart';
class Tray {
String get trayIconSuffix {
return system.isWindows ? 'ico' : 'png';
}
String getTryIcon({required bool isStart, required bool tunEnable}) {
if (system.isMacOS || !isStart) {
return 'assets/images/icon/status_1.$trayIconSuffix';
}
if (!tunEnable) {
return 'assets/images/icon/status_2.$trayIconSuffix';
}
return 'assets/images/icon/status_3.$trayIconSuffix';
}
Future _updateSystemTray({
required Brightness? brightness,
bool force = false,
required bool isStart,
required bool tunEnable,
}) async {
if (Platform.isLinux || force) {
await trayManager.destroy();
}
await trayManager.setIcon(
getTryIcon(isStart: isStart, tunEnable: tunEnable),
utils.getTrayIconPath(
brightness: brightness ??
WidgetsBinding.instance.platformDispatcher.platformBrightness,
),
isTemplate: true,
);
if (!Platform.isLinux) {
await trayManager.setToolTip(appName);
await trayManager.setToolTip(
appName,
);
}
}
@@ -52,10 +43,9 @@ class Tray {
if (system.isAndroid) {
return;
}
if (!system.isLinux) {
if (!Platform.isLinux) {
await _updateSystemTray(
isStart: trayState.isStart,
tunEnable: trayState.tunEnable,
brightness: trayState.brightness,
force: focus,
);
}
@@ -75,16 +65,6 @@ class Tray {
checked: false,
);
menuItems.add(startMenuItem);
if (system.isMacOS) {
final speedStatistics = MenuItem.checkbox(
label: appLocalizations.speedStatistics,
onClick: (_) async {
globalState.appController.updateSpeedStatistics();
},
checked: trayState.showTrayTitle,
);
menuItems.add(speedStatistics);
}
menuItems.add(MenuItem.separator());
for (final mode in Mode.values) {
menuItems.add(
@@ -108,7 +88,10 @@ class Tray {
checked: trayState.selectedMap[group.name] == proxy.name,
onClick: (_) {
final appController = globalState.appController;
appController.updateCurrentSelectedMap(group.name, proxy.name);
appController.updateCurrentSelectedMap(
group.name,
proxy.name,
);
appController.changeProxy(
groupName: group.name,
proxyName: proxy.name,
@@ -120,7 +103,9 @@ class Tray {
menuItems.add(
MenuItem.submenu(
label: group.name,
submenu: Menu(items: subMenuItems),
submenu: Menu(
items: subMenuItems,
),
),
);
}
@@ -174,41 +159,38 @@ class Tray {
menuItems.add(exitMenuItem);
final menu = Menu(items: menuItems);
await trayManager.setContextMenu(menu);
if (system.isLinux) {
if (Platform.isLinux) {
await _updateSystemTray(
isStart: trayState.isStart,
tunEnable: trayState.tunEnable,
brightness: trayState.brightness,
force: focus,
);
}
updateTrayTitle(
showTrayTitle: trayState.showTrayTitle,
traffic: globalState.appState.traffics.list.safeLast(Traffic()),
);
}
Future<void> updateTrayTitle({
required bool showTrayTitle,
required Traffic traffic,
}) async {
if (!system.isMacOS) {
return;
}
if (!showTrayTitle) {
await trayManager.setTitle('');
} else {
await trayManager.setTitle(traffic.trayTitle);
}
Future<void> updateTrayTitle([Traffic? traffic]) async {
// if (!system.isMacOS) {
// return;
// }
// if (traffic == null) {
// await trayManager.setTitle("");
// } else {
// await trayManager.setTitle(
// "${traffic.up.shortShow} ↑ \n${traffic.down.shortShow} ↓",
// );
// }
}
Future<void> _copyEnv(int port) async {
final url = 'http://127.0.0.1:$port';
final cmdline = system.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(text: cmdline));
await Clipboard.setData(
ClipboardData(
text: cmdline,
),
);
}
}

View File

@@ -142,9 +142,16 @@ class Utils {
}
}
String get traySuffix {
String getTrayIconPath({required Brightness brightness}) {
if (system.isMacOS) {
return 'assets/images/icon_white.png';
}
final suffix = system.isWindows ? 'ico' : 'png';
return 'assets/images/icon/status_2.$suffix';
return 'assets/images/icon.$suffix';
// return switch (brightness) {
// Brightness.dark => "assets/images/icon_white.$suffix",
// Brightness.light => "assets/images/icon_black.$suffix",
// };
}
int compareVersions(String version1, String version2) {

View File

@@ -1,7 +1,6 @@
import 'dart:io';
import 'package:fl_clash/common/common.dart';
import 'package:fl_clash/models/config.dart';
import 'package:fl_clash/state.dart';
import 'package:flutter/material.dart';
import 'package:screen_retriever/screen_retriever.dart';
@@ -20,22 +19,13 @@ class Window {
protocol.register('flclash');
}
await windowManager.ensureInitialized();
// kDebugMode ? Size(680, 580) :
WindowOptions windowOptions = WindowOptions(
size: props.size,
size: Size(props.width, props.height),
minimumSize: const Size(380, 400),
);
if (!system.isMacOS || version > 10) {
await windowManager.setTitleBarStyle(TitleBarStyle.hidden);
}
await windowManager.setMaximizable(false);
await _windowPosition(props);
await windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.setPreventClose(true);
});
}
Future<void> _windowPosition(WindowProps props) async {
if (!system.isMacOS) {
final left = props.left ?? 0;
final top = props.top ?? 0;
@@ -60,6 +50,9 @@ class Window {
}
}
}
await windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.setPreventClose(true);
});
}
Future<void> show() async {

View File

@@ -796,17 +796,11 @@ class AppController {
updateStatus(!_ref.read(isStartProvider));
}
void updateSpeedStatistics() {
_ref
.read(appSettingProvider.notifier)
.update((state) => state.copyWith(showTrayTitle: !state.showTrayTitle));
}
void updateCurrentSelectedMap(String groupName, String proxyName) {
final currentProfile = _ref.read(currentProfileProvider);
if (currentProfile != null &&
currentProfile.selectedMap[groupName] != proxyName) {
final selectedMap = Map<String, String>.from(currentProfile.selectedMap)
final SelectedMap selectedMap = Map.from(currentProfile.selectedMap)
..[groupName] = proxyName;
_ref
.read(profilesProvider.notifier)

View File

@@ -108,7 +108,7 @@ class CoreController {
Future<List<Group>> getProxiesGroups({
required ProxiesSortType sortType,
required DelayMap delayMap,
required Map<String, String> selectedMap,
required SelectedMap selectedMap,
required String defaultTestUrl,
}) async {
final proxies = await _interface.getProxies();

View File

@@ -415,6 +415,6 @@ enum ImportOption { file, url }
enum ScrollPositionCacheKey { tools, profiles, proxiesList, proxiesTabList }
enum QueryTag { proxies, access }
enum QueryTag { proxies }
enum CoreStatus { connecting, connected, disconnected }

View File

@@ -7,7 +7,6 @@ import 'package:fl_clash/state.dart';
import 'package:fl_clash/widgets/card.dart';
import 'package:fl_clash/widgets/dialog.dart';
import 'package:fl_clash/widgets/input.dart';
import 'package:fl_clash/widgets/list.dart';
import 'package:flutter/material.dart';
class RuleItem extends StatelessWidget {
@@ -28,18 +27,48 @@ class RuleItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CommonSelectedListItem(
isSelected: isSelected,
onSelected: () {
onSelected(rule.id);
},
title: Text(
rule.value,
style: context.textTheme.bodyMedium?.toJetBrainsMono,
return Material(
color: Colors.transparent,
child: Container(
margin: EdgeInsets.symmetric(vertical: 4),
child: CommonCard(
padding: EdgeInsets.zero,
radius: 18,
type: CommonCardType.filled,
isSelected: isSelected,
onPressed: () {
if (isEditing) {
onSelected(rule.id);
return;
}
onEdit(rule);
},
onLongPress: () {
onSelected(rule.id);
},
child: ListTile(
minTileHeight: 0,
minVerticalPadding: 0,
titleTextStyle: context.textTheme.bodyMedium?.toJetBrainsMono,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 16,
),
trailing: SizedBox(
width: 24,
height: 24,
child: CommonCheckBox(
value: isSelected,
isCircle: true,
onChanged: (_) {
onSelected(rule.id);
},
),
),
title: Text(rule.value),
),
),
),
onPressed: () {
onEdit(rule);
},
);
}
}
@@ -204,10 +233,6 @@ class _AddOrEditRuleDialogState extends State<AddOrEditRuleDialog> {
),
SizedBox(height: 24),
TextFormField(
keyboardType: TextInputType.text,
onFieldSubmitted: (_) {
_handleSubmit();
},
controller: _contentController,
decoration: InputDecoration(
border: const OutlineInputBorder(),

View File

@@ -678,9 +678,6 @@ class MessageLookup extends MessageLookupByLibrary {
"View recently request records",
),
"reset": MessageLookupByLibrary.simpleMessage("Reset"),
"resetPageChangesTip": MessageLookupByLibrary.simpleMessage(
"The current page has changes. Are you sure you want to reset?",
),
"resetTip": MessageLookupByLibrary.simpleMessage("Make sure to reset"),
"resources": MessageLookupByLibrary.simpleMessage("Resources"),
"resourcesDesc": MessageLookupByLibrary.simpleMessage(
@@ -738,7 +735,6 @@ class MessageLookup extends MessageLookupByLibrary {
"sourceIp": MessageLookupByLibrary.simpleMessage("Source IP"),
"specialProxy": MessageLookupByLibrary.simpleMessage("Special proxy"),
"specialRules": MessageLookupByLibrary.simpleMessage("special rules"),
"speedStatistics": MessageLookupByLibrary.simpleMessage("Speed statistics"),
"stackMode": MessageLookupByLibrary.simpleMessage("Stack mode"),
"standard": MessageLookupByLibrary.simpleMessage("Standard"),
"standardModeDesc": MessageLookupByLibrary.simpleMessage(

View File

@@ -513,9 +513,6 @@ class MessageLookup extends MessageLookupByLibrary {
"requests": MessageLookupByLibrary.simpleMessage("リクエスト"),
"requestsDesc": MessageLookupByLibrary.simpleMessage("最近のリクエスト記録を表示"),
"reset": MessageLookupByLibrary.simpleMessage("リセット"),
"resetPageChangesTip": MessageLookupByLibrary.simpleMessage(
"現在のページに変更があります。リセットしてもよろしいですか?",
),
"resetTip": MessageLookupByLibrary.simpleMessage("リセットを確定"),
"resources": MessageLookupByLibrary.simpleMessage("リソース"),
"resourcesDesc": MessageLookupByLibrary.simpleMessage("外部リソース関連情報"),
@@ -561,7 +558,6 @@ class MessageLookup extends MessageLookupByLibrary {
"sourceIp": MessageLookupByLibrary.simpleMessage("送信元IP"),
"specialProxy": MessageLookupByLibrary.simpleMessage("特殊プロキシ"),
"specialRules": MessageLookupByLibrary.simpleMessage("特殊ルール"),
"speedStatistics": MessageLookupByLibrary.simpleMessage("速度統計"),
"stackMode": MessageLookupByLibrary.simpleMessage("スタックモード"),
"standard": MessageLookupByLibrary.simpleMessage("標準"),
"standardModeDesc": MessageLookupByLibrary.simpleMessage(

View File

@@ -715,9 +715,6 @@ class MessageLookup extends MessageLookupByLibrary {
"Просмотр последних записей запросов",
),
"reset": MessageLookupByLibrary.simpleMessage("Сброс"),
"resetPageChangesTip": MessageLookupByLibrary.simpleMessage(
"На текущей странице есть изменения. Вы уверены, что хотите сбросить?",
),
"resetTip": MessageLookupByLibrary.simpleMessage(
"Убедитесь, что хотите сбросить",
),
@@ -777,9 +774,6 @@ class MessageLookup extends MessageLookupByLibrary {
"sourceIp": MessageLookupByLibrary.simpleMessage("Исходный IP"),
"specialProxy": MessageLookupByLibrary.simpleMessage("Специальный прокси"),
"specialRules": MessageLookupByLibrary.simpleMessage("Специальные правила"),
"speedStatistics": MessageLookupByLibrary.simpleMessage(
"Статистика скорости",
),
"stackMode": MessageLookupByLibrary.simpleMessage("Режим стека"),
"standard": MessageLookupByLibrary.simpleMessage("Стандартный"),
"standardModeDesc": MessageLookupByLibrary.simpleMessage(

View File

@@ -447,9 +447,6 @@ class MessageLookup extends MessageLookupByLibrary {
"requests": MessageLookupByLibrary.simpleMessage("请求"),
"requestsDesc": MessageLookupByLibrary.simpleMessage("查看最近请求记录"),
"reset": MessageLookupByLibrary.simpleMessage("重置"),
"resetPageChangesTip": MessageLookupByLibrary.simpleMessage(
"当前页面存在更改,确定重置吗?",
),
"resetTip": MessageLookupByLibrary.simpleMessage("确定要重置吗?"),
"resources": MessageLookupByLibrary.simpleMessage("资源"),
"resourcesDesc": MessageLookupByLibrary.simpleMessage("外部资源相关信息"),
@@ -493,7 +490,6 @@ class MessageLookup extends MessageLookupByLibrary {
"sourceIp": MessageLookupByLibrary.simpleMessage("源IP"),
"specialProxy": MessageLookupByLibrary.simpleMessage("特殊代理"),
"specialRules": MessageLookupByLibrary.simpleMessage("特殊规则"),
"speedStatistics": MessageLookupByLibrary.simpleMessage("网速统计"),
"stackMode": MessageLookupByLibrary.simpleMessage("栈模式"),
"standard": MessageLookupByLibrary.simpleMessage("标准"),
"standardModeDesc": MessageLookupByLibrary.simpleMessage(

View File

@@ -3638,26 +3638,6 @@ class AppLocalizations {
String get restart {
return Intl.message('Restart', name: 'restart', desc: '', args: []);
}
/// `Speed statistics`
String get speedStatistics {
return Intl.message(
'Speed statistics',
name: 'speedStatistics',
desc: '',
args: [],
);
}
/// `The current page has changes. Are you sure you want to reset?`
String get resetPageChangesTip {
return Intl.message(
'The current page has changes. Are you sure you want to reset?',
name: 'resetPageChangesTip',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<AppLocalizations> {

View File

@@ -8,7 +8,10 @@ import 'package:tray_manager/tray_manager.dart';
class TrayManager extends ConsumerStatefulWidget {
final Widget child;
const TrayManager({super.key, required this.child});
const TrayManager({
super.key,
required this.child,
});
@override
ConsumerState<TrayManager> createState() => _TrayContainerState();
@@ -19,21 +22,14 @@ class _TrayContainerState extends ConsumerState<TrayManager> with TrayListener {
void initState() {
super.initState();
trayManager.addListener(this);
ref.listenManual(trayStateProvider, (prev, next) {
if (prev != next) {
globalState.appController.updateTray();
}
});
if (system.isMacOS) {
ref.listenManual(trayTitleStateProvider, (prev, next) {
ref.listenManual(
trayStateProvider,
(prev, next) {
if (prev != next) {
tray?.updateTrayTitle(
showTrayTitle: next.showTrayTitle,
traffic: next.traffic,
);
globalState.appController.updateTray();
}
});
}
},
);
}
@override

View File

@@ -38,8 +38,6 @@ abstract class AppState with _$AppState {
required SystemUiOverlayStyle systemUiOverlayStyle,
ProfileOverrideModel? profileOverrideModel,
@Default({}) Map<QueryTag, String> queryMap,
@Default({}) Map<String, String> selectedItemMap,
@Default({}) Map<String, Set<String>> selectedItemsMap,
@Default(CoreStatus.connecting) CoreStatus coreStatus,
}) = _AppState;
}

View File

@@ -5,6 +5,8 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'generated/clash_config.freezed.dart';
part 'generated/clash_config.g.dart';
typedef HostsMap = Map<String, String>;
const defaultClashConfig = ClashConfig();
const defaultTun = Tun();
@@ -474,7 +476,7 @@ abstract class ClashConfig with _$ClashConfig {
@Default(ExternalControllerStatus.close)
@JsonKey(name: 'external-controller')
ExternalControllerStatus externalController,
@Default({}) Map<String, String> hosts,
@Default({}) HostsMap hosts,
}) = _ClashConfig;
factory ClashConfig.fromJson(Map<String, Object?> json) =>

View File

@@ -259,10 +259,6 @@ extension TrafficExt on Traffic {
return '${up.traffic.show}${down.traffic.show}';
}
String get trayTitle {
return '${up.shortTraffic.show}/s \n ${down.shortTraffic.show}/s';
}
num get speed => up + down;
}

View File

@@ -83,7 +83,6 @@ abstract class AppSettingProps with _$AppSettingProps {
@Default(false) bool hidden,
@Default(false) bool developerMode,
@Default(RecoveryStrategy.compatible) RecoveryStrategy recoveryStrategy,
@Default(true) bool showTrayTitle,
}) = _AppSettingProps;
factory AppSettingProps.fromJson(Map<String, Object?> json) =>
@@ -127,8 +126,8 @@ extension AccessControlExt on AccessControl {
@freezed
abstract class WindowProps with _$WindowProps {
const factory WindowProps({
@Default(0) double width,
@Default(0) double height,
@Default(750) double width,
@Default(600) double height,
double? top,
double? left,
}) = _WindowProps;
@@ -137,12 +136,6 @@ abstract class WindowProps with _$WindowProps {
json == null ? const WindowProps() : _$WindowPropsFromJson(json);
}
extension WindowPropsExt on WindowProps {
Size get _size => Size(width, height);
Size get size => _size.isEmpty ? Size(680, 580) : _size;
}
@freezed
abstract class VpnProps with _$VpnProps {
const factory VpnProps({
@@ -180,6 +173,7 @@ abstract class ProxiesStyle with _$ProxiesStyle {
@Default(ProxiesLayout.standard) ProxiesLayout layout,
@Default(ProxiesIconStyle.standard) ProxiesIconStyle iconStyle,
@Default(ProxyCardType.expand) ProxyCardType cardType,
@Default({}) Map<String, String> iconMap,
}) = _ProxiesStyle;
factory ProxiesStyle.fromJson(Map<String, Object?>? json) =>

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AppState {
bool get isInit; bool get backBlock; PageLabel get pageLabel; List<Package> get packages; int get sortNum; Size get viewSize; double get sideWidth; DelayMap get delayMap; List<Group> get groups; int get checkIpNum; Brightness get brightness; int? get runTime; List<ExternalProvider> get providers; String? get localIp; FixedList<TrackerInfo> get requests; int get version; FixedList<Log> get logs; FixedList<Traffic> get traffics; Traffic get totalTraffic; bool get realTunEnable; bool get loading; SystemUiOverlayStyle get systemUiOverlayStyle; ProfileOverrideModel? get profileOverrideModel; Map<QueryTag, String> get queryMap; Map<String, String> get selectedItemMap; Map<String, Set<String>> get selectedItemsMap; CoreStatus get coreStatus;
bool get isInit; bool get backBlock; PageLabel get pageLabel; List<Package> get packages; int get sortNum; Size get viewSize; double get sideWidth; DelayMap get delayMap; List<Group> get groups; int get checkIpNum; Brightness get brightness; int? get runTime; List<ExternalProvider> get providers; String? get localIp; FixedList<TrackerInfo> get requests; int get version; FixedList<Log> get logs; FixedList<Traffic> get traffics; Traffic get totalTraffic; bool get realTunEnable; bool get loading; SystemUiOverlayStyle get systemUiOverlayStyle; ProfileOverrideModel? get profileOverrideModel; Map<QueryTag, String> get queryMap; CoreStatus get coreStatus;
/// Create a copy of AppState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $AppStateCopyWith<AppState> get copyWith => _$AppStateCopyWithImpl<AppState>(thi
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppState&&(identical(other.isInit, isInit) || other.isInit == isInit)&&(identical(other.backBlock, backBlock) || other.backBlock == backBlock)&&(identical(other.pageLabel, pageLabel) || other.pageLabel == pageLabel)&&const DeepCollectionEquality().equals(other.packages, packages)&&(identical(other.sortNum, sortNum) || other.sortNum == sortNum)&&(identical(other.viewSize, viewSize) || other.viewSize == viewSize)&&(identical(other.sideWidth, sideWidth) || other.sideWidth == sideWidth)&&const DeepCollectionEquality().equals(other.delayMap, delayMap)&&const DeepCollectionEquality().equals(other.groups, groups)&&(identical(other.checkIpNum, checkIpNum) || other.checkIpNum == checkIpNum)&&(identical(other.brightness, brightness) || other.brightness == brightness)&&(identical(other.runTime, runTime) || other.runTime == runTime)&&const DeepCollectionEquality().equals(other.providers, providers)&&(identical(other.localIp, localIp) || other.localIp == localIp)&&(identical(other.requests, requests) || other.requests == requests)&&(identical(other.version, version) || other.version == version)&&(identical(other.logs, logs) || other.logs == logs)&&(identical(other.traffics, traffics) || other.traffics == traffics)&&(identical(other.totalTraffic, totalTraffic) || other.totalTraffic == totalTraffic)&&(identical(other.realTunEnable, realTunEnable) || other.realTunEnable == realTunEnable)&&(identical(other.loading, loading) || other.loading == loading)&&(identical(other.systemUiOverlayStyle, systemUiOverlayStyle) || other.systemUiOverlayStyle == systemUiOverlayStyle)&&(identical(other.profileOverrideModel, profileOverrideModel) || other.profileOverrideModel == profileOverrideModel)&&const DeepCollectionEquality().equals(other.queryMap, queryMap)&&const DeepCollectionEquality().equals(other.selectedItemMap, selectedItemMap)&&const DeepCollectionEquality().equals(other.selectedItemsMap, selectedItemsMap)&&(identical(other.coreStatus, coreStatus) || other.coreStatus == coreStatus));
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppState&&(identical(other.isInit, isInit) || other.isInit == isInit)&&(identical(other.backBlock, backBlock) || other.backBlock == backBlock)&&(identical(other.pageLabel, pageLabel) || other.pageLabel == pageLabel)&&const DeepCollectionEquality().equals(other.packages, packages)&&(identical(other.sortNum, sortNum) || other.sortNum == sortNum)&&(identical(other.viewSize, viewSize) || other.viewSize == viewSize)&&(identical(other.sideWidth, sideWidth) || other.sideWidth == sideWidth)&&const DeepCollectionEquality().equals(other.delayMap, delayMap)&&const DeepCollectionEquality().equals(other.groups, groups)&&(identical(other.checkIpNum, checkIpNum) || other.checkIpNum == checkIpNum)&&(identical(other.brightness, brightness) || other.brightness == brightness)&&(identical(other.runTime, runTime) || other.runTime == runTime)&&const DeepCollectionEquality().equals(other.providers, providers)&&(identical(other.localIp, localIp) || other.localIp == localIp)&&(identical(other.requests, requests) || other.requests == requests)&&(identical(other.version, version) || other.version == version)&&(identical(other.logs, logs) || other.logs == logs)&&(identical(other.traffics, traffics) || other.traffics == traffics)&&(identical(other.totalTraffic, totalTraffic) || other.totalTraffic == totalTraffic)&&(identical(other.realTunEnable, realTunEnable) || other.realTunEnable == realTunEnable)&&(identical(other.loading, loading) || other.loading == loading)&&(identical(other.systemUiOverlayStyle, systemUiOverlayStyle) || other.systemUiOverlayStyle == systemUiOverlayStyle)&&(identical(other.profileOverrideModel, profileOverrideModel) || other.profileOverrideModel == profileOverrideModel)&&const DeepCollectionEquality().equals(other.queryMap, queryMap)&&(identical(other.coreStatus, coreStatus) || other.coreStatus == coreStatus));
}
@override
int get hashCode => Object.hashAll([runtimeType,isInit,backBlock,pageLabel,const DeepCollectionEquality().hash(packages),sortNum,viewSize,sideWidth,const DeepCollectionEquality().hash(delayMap),const DeepCollectionEquality().hash(groups),checkIpNum,brightness,runTime,const DeepCollectionEquality().hash(providers),localIp,requests,version,logs,traffics,totalTraffic,realTunEnable,loading,systemUiOverlayStyle,profileOverrideModel,const DeepCollectionEquality().hash(queryMap),const DeepCollectionEquality().hash(selectedItemMap),const DeepCollectionEquality().hash(selectedItemsMap),coreStatus]);
int get hashCode => Object.hashAll([runtimeType,isInit,backBlock,pageLabel,const DeepCollectionEquality().hash(packages),sortNum,viewSize,sideWidth,const DeepCollectionEquality().hash(delayMap),const DeepCollectionEquality().hash(groups),checkIpNum,brightness,runTime,const DeepCollectionEquality().hash(providers),localIp,requests,version,logs,traffics,totalTraffic,realTunEnable,loading,systemUiOverlayStyle,profileOverrideModel,const DeepCollectionEquality().hash(queryMap),coreStatus]);
@override
String toString() {
return 'AppState(isInit: $isInit, backBlock: $backBlock, pageLabel: $pageLabel, packages: $packages, sortNum: $sortNum, viewSize: $viewSize, sideWidth: $sideWidth, 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, profileOverrideModel: $profileOverrideModel, queryMap: $queryMap, selectedItemMap: $selectedItemMap, selectedItemsMap: $selectedItemsMap, coreStatus: $coreStatus)';
return 'AppState(isInit: $isInit, backBlock: $backBlock, pageLabel: $pageLabel, packages: $packages, sortNum: $sortNum, viewSize: $viewSize, sideWidth: $sideWidth, 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, profileOverrideModel: $profileOverrideModel, queryMap: $queryMap, coreStatus: $coreStatus)';
}
@@ -45,7 +45,7 @@ abstract mixin class $AppStateCopyWith<$Res> {
factory $AppStateCopyWith(AppState value, $Res Function(AppState) _then) = _$AppStateCopyWithImpl;
@useResult
$Res call({
bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, Map<String, String> selectedItemMap, Map<String, Set<String>> selectedItemsMap, CoreStatus coreStatus
bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, CoreStatus coreStatus
});
@@ -62,7 +62,7 @@ class _$AppStateCopyWithImpl<$Res>
/// Create a copy of AppState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isInit = null,Object? backBlock = null,Object? pageLabel = null,Object? packages = null,Object? sortNum = null,Object? viewSize = null,Object? sideWidth = null,Object? delayMap = null,Object? groups = null,Object? checkIpNum = null,Object? brightness = null,Object? runTime = freezed,Object? providers = null,Object? localIp = freezed,Object? requests = null,Object? version = null,Object? logs = null,Object? traffics = null,Object? totalTraffic = null,Object? realTunEnable = null,Object? loading = null,Object? systemUiOverlayStyle = null,Object? profileOverrideModel = freezed,Object? queryMap = null,Object? selectedItemMap = null,Object? selectedItemsMap = null,Object? coreStatus = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? isInit = null,Object? backBlock = null,Object? pageLabel = null,Object? packages = null,Object? sortNum = null,Object? viewSize = null,Object? sideWidth = null,Object? delayMap = null,Object? groups = null,Object? checkIpNum = null,Object? brightness = null,Object? runTime = freezed,Object? providers = null,Object? localIp = freezed,Object? requests = null,Object? version = null,Object? logs = null,Object? traffics = null,Object? totalTraffic = null,Object? realTunEnable = null,Object? loading = null,Object? systemUiOverlayStyle = null,Object? profileOverrideModel = freezed,Object? queryMap = null,Object? coreStatus = null,}) {
return _then(_self.copyWith(
isInit: null == isInit ? _self.isInit : isInit // ignore: cast_nullable_to_non_nullable
as bool,backBlock: null == backBlock ? _self.backBlock : backBlock // ignore: cast_nullable_to_non_nullable
@@ -88,9 +88,7 @@ as bool,loading: null == loading ? _self.loading : loading // ignore: cast_nulla
as bool,systemUiOverlayStyle: null == systemUiOverlayStyle ? _self.systemUiOverlayStyle : systemUiOverlayStyle // ignore: cast_nullable_to_non_nullable
as SystemUiOverlayStyle,profileOverrideModel: freezed == profileOverrideModel ? _self.profileOverrideModel : profileOverrideModel // ignore: cast_nullable_to_non_nullable
as ProfileOverrideModel?,queryMap: null == queryMap ? _self.queryMap : queryMap // ignore: cast_nullable_to_non_nullable
as Map<QueryTag, String>,selectedItemMap: null == selectedItemMap ? _self.selectedItemMap : selectedItemMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>,selectedItemsMap: null == selectedItemsMap ? _self.selectedItemsMap : selectedItemsMap // ignore: cast_nullable_to_non_nullable
as Map<String, Set<String>>,coreStatus: null == coreStatus ? _self.coreStatus : coreStatus // ignore: cast_nullable_to_non_nullable
as Map<QueryTag, String>,coreStatus: null == coreStatus ? _self.coreStatus : coreStatus // ignore: cast_nullable_to_non_nullable
as CoreStatus,
));
}
@@ -197,10 +195,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, Map<String, String> selectedItemMap, Map<String, Set<String>> selectedItemsMap, CoreStatus coreStatus)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, CoreStatus coreStatus)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AppState() when $default != null:
return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_that.sortNum,_that.viewSize,_that.sideWidth,_that.delayMap,_that.groups,_that.checkIpNum,_that.brightness,_that.runTime,_that.providers,_that.localIp,_that.requests,_that.version,_that.logs,_that.traffics,_that.totalTraffic,_that.realTunEnable,_that.loading,_that.systemUiOverlayStyle,_that.profileOverrideModel,_that.queryMap,_that.selectedItemMap,_that.selectedItemsMap,_that.coreStatus);case _:
return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_that.sortNum,_that.viewSize,_that.sideWidth,_that.delayMap,_that.groups,_that.checkIpNum,_that.brightness,_that.runTime,_that.providers,_that.localIp,_that.requests,_that.version,_that.logs,_that.traffics,_that.totalTraffic,_that.realTunEnable,_that.loading,_that.systemUiOverlayStyle,_that.profileOverrideModel,_that.queryMap,_that.coreStatus);case _:
return orElse();
}
@@ -218,10 +216,10 @@ return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_tha
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, Map<String, String> selectedItemMap, Map<String, Set<String>> selectedItemsMap, CoreStatus coreStatus) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, CoreStatus coreStatus) $default,) {final _that = this;
switch (_that) {
case _AppState():
return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_that.sortNum,_that.viewSize,_that.sideWidth,_that.delayMap,_that.groups,_that.checkIpNum,_that.brightness,_that.runTime,_that.providers,_that.localIp,_that.requests,_that.version,_that.logs,_that.traffics,_that.totalTraffic,_that.realTunEnable,_that.loading,_that.systemUiOverlayStyle,_that.profileOverrideModel,_that.queryMap,_that.selectedItemMap,_that.selectedItemsMap,_that.coreStatus);case _:
return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_that.sortNum,_that.viewSize,_that.sideWidth,_that.delayMap,_that.groups,_that.checkIpNum,_that.brightness,_that.runTime,_that.providers,_that.localIp,_that.requests,_that.version,_that.logs,_that.traffics,_that.totalTraffic,_that.realTunEnable,_that.loading,_that.systemUiOverlayStyle,_that.profileOverrideModel,_that.queryMap,_that.coreStatus);case _:
throw StateError('Unexpected subclass');
}
@@ -238,10 +236,10 @@ return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_tha
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, Map<String, String> selectedItemMap, Map<String, Set<String>> selectedItemsMap, CoreStatus coreStatus)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, CoreStatus coreStatus)? $default,) {final _that = this;
switch (_that) {
case _AppState() when $default != null:
return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_that.sortNum,_that.viewSize,_that.sideWidth,_that.delayMap,_that.groups,_that.checkIpNum,_that.brightness,_that.runTime,_that.providers,_that.localIp,_that.requests,_that.version,_that.logs,_that.traffics,_that.totalTraffic,_that.realTunEnable,_that.loading,_that.systemUiOverlayStyle,_that.profileOverrideModel,_that.queryMap,_that.selectedItemMap,_that.selectedItemsMap,_that.coreStatus);case _:
return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_that.sortNum,_that.viewSize,_that.sideWidth,_that.delayMap,_that.groups,_that.checkIpNum,_that.brightness,_that.runTime,_that.providers,_that.localIp,_that.requests,_that.version,_that.logs,_that.traffics,_that.totalTraffic,_that.realTunEnable,_that.loading,_that.systemUiOverlayStyle,_that.profileOverrideModel,_that.queryMap,_that.coreStatus);case _:
return null;
}
@@ -253,7 +251,7 @@ return $default(_that.isInit,_that.backBlock,_that.pageLabel,_that.packages,_tha
class _AppState implements AppState {
const _AppState({this.isInit = false, this.backBlock = false, this.pageLabel = PageLabel.dashboard, final List<Package> packages = const [], this.sortNum = 0, required this.viewSize, this.sideWidth = 0, final DelayMap delayMap = const {}, final List<Group> groups = const [], this.checkIpNum = 0, required this.brightness, this.runTime, final List<ExternalProvider> providers = const [], this.localIp, required this.requests, required this.version, required this.logs, required this.traffics, required this.totalTraffic, this.realTunEnable = false, this.loading = false, required this.systemUiOverlayStyle, this.profileOverrideModel, final Map<QueryTag, String> queryMap = const {}, final Map<String, String> selectedItemMap = const {}, final Map<String, Set<String>> selectedItemsMap = const {}, this.coreStatus = CoreStatus.connecting}): _packages = packages,_delayMap = delayMap,_groups = groups,_providers = providers,_queryMap = queryMap,_selectedItemMap = selectedItemMap,_selectedItemsMap = selectedItemsMap;
const _AppState({this.isInit = false, this.backBlock = false, this.pageLabel = PageLabel.dashboard, final List<Package> packages = const [], this.sortNum = 0, required this.viewSize, this.sideWidth = 0, final DelayMap delayMap = const {}, final List<Group> groups = const [], this.checkIpNum = 0, required this.brightness, this.runTime, final List<ExternalProvider> providers = const [], this.localIp, required this.requests, required this.version, required this.logs, required this.traffics, required this.totalTraffic, this.realTunEnable = false, this.loading = false, required this.systemUiOverlayStyle, this.profileOverrideModel, final Map<QueryTag, String> queryMap = const {}, this.coreStatus = CoreStatus.connecting}): _packages = packages,_delayMap = delayMap,_groups = groups,_providers = providers,_queryMap = queryMap;
@override@JsonKey() final bool isInit;
@@ -310,20 +308,6 @@ class _AppState implements AppState {
return EqualUnmodifiableMapView(_queryMap);
}
final Map<String, String> _selectedItemMap;
@override@JsonKey() Map<String, String> get selectedItemMap {
if (_selectedItemMap is EqualUnmodifiableMapView) return _selectedItemMap;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_selectedItemMap);
}
final Map<String, Set<String>> _selectedItemsMap;
@override@JsonKey() Map<String, Set<String>> get selectedItemsMap {
if (_selectedItemsMap is EqualUnmodifiableMapView) return _selectedItemsMap;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_selectedItemsMap);
}
@override@JsonKey() final CoreStatus coreStatus;
/// Create a copy of AppState
@@ -336,16 +320,16 @@ _$AppStateCopyWith<_AppState> get copyWith => __$AppStateCopyWithImpl<_AppState>
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppState&&(identical(other.isInit, isInit) || other.isInit == isInit)&&(identical(other.backBlock, backBlock) || other.backBlock == backBlock)&&(identical(other.pageLabel, pageLabel) || other.pageLabel == pageLabel)&&const DeepCollectionEquality().equals(other._packages, _packages)&&(identical(other.sortNum, sortNum) || other.sortNum == sortNum)&&(identical(other.viewSize, viewSize) || other.viewSize == viewSize)&&(identical(other.sideWidth, sideWidth) || other.sideWidth == sideWidth)&&const DeepCollectionEquality().equals(other._delayMap, _delayMap)&&const DeepCollectionEquality().equals(other._groups, _groups)&&(identical(other.checkIpNum, checkIpNum) || other.checkIpNum == checkIpNum)&&(identical(other.brightness, brightness) || other.brightness == brightness)&&(identical(other.runTime, runTime) || other.runTime == runTime)&&const DeepCollectionEquality().equals(other._providers, _providers)&&(identical(other.localIp, localIp) || other.localIp == localIp)&&(identical(other.requests, requests) || other.requests == requests)&&(identical(other.version, version) || other.version == version)&&(identical(other.logs, logs) || other.logs == logs)&&(identical(other.traffics, traffics) || other.traffics == traffics)&&(identical(other.totalTraffic, totalTraffic) || other.totalTraffic == totalTraffic)&&(identical(other.realTunEnable, realTunEnable) || other.realTunEnable == realTunEnable)&&(identical(other.loading, loading) || other.loading == loading)&&(identical(other.systemUiOverlayStyle, systemUiOverlayStyle) || other.systemUiOverlayStyle == systemUiOverlayStyle)&&(identical(other.profileOverrideModel, profileOverrideModel) || other.profileOverrideModel == profileOverrideModel)&&const DeepCollectionEquality().equals(other._queryMap, _queryMap)&&const DeepCollectionEquality().equals(other._selectedItemMap, _selectedItemMap)&&const DeepCollectionEquality().equals(other._selectedItemsMap, _selectedItemsMap)&&(identical(other.coreStatus, coreStatus) || other.coreStatus == coreStatus));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppState&&(identical(other.isInit, isInit) || other.isInit == isInit)&&(identical(other.backBlock, backBlock) || other.backBlock == backBlock)&&(identical(other.pageLabel, pageLabel) || other.pageLabel == pageLabel)&&const DeepCollectionEquality().equals(other._packages, _packages)&&(identical(other.sortNum, sortNum) || other.sortNum == sortNum)&&(identical(other.viewSize, viewSize) || other.viewSize == viewSize)&&(identical(other.sideWidth, sideWidth) || other.sideWidth == sideWidth)&&const DeepCollectionEquality().equals(other._delayMap, _delayMap)&&const DeepCollectionEquality().equals(other._groups, _groups)&&(identical(other.checkIpNum, checkIpNum) || other.checkIpNum == checkIpNum)&&(identical(other.brightness, brightness) || other.brightness == brightness)&&(identical(other.runTime, runTime) || other.runTime == runTime)&&const DeepCollectionEquality().equals(other._providers, _providers)&&(identical(other.localIp, localIp) || other.localIp == localIp)&&(identical(other.requests, requests) || other.requests == requests)&&(identical(other.version, version) || other.version == version)&&(identical(other.logs, logs) || other.logs == logs)&&(identical(other.traffics, traffics) || other.traffics == traffics)&&(identical(other.totalTraffic, totalTraffic) || other.totalTraffic == totalTraffic)&&(identical(other.realTunEnable, realTunEnable) || other.realTunEnable == realTunEnable)&&(identical(other.loading, loading) || other.loading == loading)&&(identical(other.systemUiOverlayStyle, systemUiOverlayStyle) || other.systemUiOverlayStyle == systemUiOverlayStyle)&&(identical(other.profileOverrideModel, profileOverrideModel) || other.profileOverrideModel == profileOverrideModel)&&const DeepCollectionEquality().equals(other._queryMap, _queryMap)&&(identical(other.coreStatus, coreStatus) || other.coreStatus == coreStatus));
}
@override
int get hashCode => Object.hashAll([runtimeType,isInit,backBlock,pageLabel,const DeepCollectionEquality().hash(_packages),sortNum,viewSize,sideWidth,const DeepCollectionEquality().hash(_delayMap),const DeepCollectionEquality().hash(_groups),checkIpNum,brightness,runTime,const DeepCollectionEquality().hash(_providers),localIp,requests,version,logs,traffics,totalTraffic,realTunEnable,loading,systemUiOverlayStyle,profileOverrideModel,const DeepCollectionEquality().hash(_queryMap),const DeepCollectionEquality().hash(_selectedItemMap),const DeepCollectionEquality().hash(_selectedItemsMap),coreStatus]);
int get hashCode => Object.hashAll([runtimeType,isInit,backBlock,pageLabel,const DeepCollectionEquality().hash(_packages),sortNum,viewSize,sideWidth,const DeepCollectionEquality().hash(_delayMap),const DeepCollectionEquality().hash(_groups),checkIpNum,brightness,runTime,const DeepCollectionEquality().hash(_providers),localIp,requests,version,logs,traffics,totalTraffic,realTunEnable,loading,systemUiOverlayStyle,profileOverrideModel,const DeepCollectionEquality().hash(_queryMap),coreStatus]);
@override
String toString() {
return 'AppState(isInit: $isInit, backBlock: $backBlock, pageLabel: $pageLabel, packages: $packages, sortNum: $sortNum, viewSize: $viewSize, sideWidth: $sideWidth, 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, profileOverrideModel: $profileOverrideModel, queryMap: $queryMap, selectedItemMap: $selectedItemMap, selectedItemsMap: $selectedItemsMap, coreStatus: $coreStatus)';
return 'AppState(isInit: $isInit, backBlock: $backBlock, pageLabel: $pageLabel, packages: $packages, sortNum: $sortNum, viewSize: $viewSize, sideWidth: $sideWidth, 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, profileOverrideModel: $profileOverrideModel, queryMap: $queryMap, coreStatus: $coreStatus)';
}
@@ -356,7 +340,7 @@ abstract mixin class _$AppStateCopyWith<$Res> implements $AppStateCopyWith<$Res>
factory _$AppStateCopyWith(_AppState value, $Res Function(_AppState) _then) = __$AppStateCopyWithImpl;
@override @useResult
$Res call({
bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, Map<String, String> selectedItemMap, Map<String, Set<String>> selectedItemsMap, CoreStatus coreStatus
bool isInit, bool backBlock, PageLabel pageLabel, List<Package> packages, int sortNum, Size viewSize, double sideWidth, DelayMap delayMap, List<Group> groups, int checkIpNum, Brightness brightness, int? runTime, List<ExternalProvider> providers, String? localIp, FixedList<TrackerInfo> requests, int version, FixedList<Log> logs, FixedList<Traffic> traffics, Traffic totalTraffic, bool realTunEnable, bool loading, SystemUiOverlayStyle systemUiOverlayStyle, ProfileOverrideModel? profileOverrideModel, Map<QueryTag, String> queryMap, CoreStatus coreStatus
});
@@ -373,7 +357,7 @@ class __$AppStateCopyWithImpl<$Res>
/// Create a copy of AppState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isInit = null,Object? backBlock = null,Object? pageLabel = null,Object? packages = null,Object? sortNum = null,Object? viewSize = null,Object? sideWidth = null,Object? delayMap = null,Object? groups = null,Object? checkIpNum = null,Object? brightness = null,Object? runTime = freezed,Object? providers = null,Object? localIp = freezed,Object? requests = null,Object? version = null,Object? logs = null,Object? traffics = null,Object? totalTraffic = null,Object? realTunEnable = null,Object? loading = null,Object? systemUiOverlayStyle = null,Object? profileOverrideModel = freezed,Object? queryMap = null,Object? selectedItemMap = null,Object? selectedItemsMap = null,Object? coreStatus = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? isInit = null,Object? backBlock = null,Object? pageLabel = null,Object? packages = null,Object? sortNum = null,Object? viewSize = null,Object? sideWidth = null,Object? delayMap = null,Object? groups = null,Object? checkIpNum = null,Object? brightness = null,Object? runTime = freezed,Object? providers = null,Object? localIp = freezed,Object? requests = null,Object? version = null,Object? logs = null,Object? traffics = null,Object? totalTraffic = null,Object? realTunEnable = null,Object? loading = null,Object? systemUiOverlayStyle = null,Object? profileOverrideModel = freezed,Object? queryMap = null,Object? coreStatus = null,}) {
return _then(_AppState(
isInit: null == isInit ? _self.isInit : isInit // ignore: cast_nullable_to_non_nullable
as bool,backBlock: null == backBlock ? _self.backBlock : backBlock // ignore: cast_nullable_to_non_nullable
@@ -399,9 +383,7 @@ as bool,loading: null == loading ? _self.loading : loading // ignore: cast_nulla
as bool,systemUiOverlayStyle: null == systemUiOverlayStyle ? _self.systemUiOverlayStyle : systemUiOverlayStyle // ignore: cast_nullable_to_non_nullable
as SystemUiOverlayStyle,profileOverrideModel: freezed == profileOverrideModel ? _self.profileOverrideModel : profileOverrideModel // ignore: cast_nullable_to_non_nullable
as ProfileOverrideModel?,queryMap: null == queryMap ? _self._queryMap : queryMap // ignore: cast_nullable_to_non_nullable
as Map<QueryTag, String>,selectedItemMap: null == selectedItemMap ? _self._selectedItemMap : selectedItemMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>,selectedItemsMap: null == selectedItemsMap ? _self._selectedItemsMap : selectedItemsMap // ignore: cast_nullable_to_non_nullable
as Map<String, Set<String>>,coreStatus: null == coreStatus ? _self.coreStatus : coreStatus // ignore: cast_nullable_to_non_nullable
as Map<QueryTag, String>,coreStatus: null == coreStatus ? _self.coreStatus : coreStatus // ignore: cast_nullable_to_non_nullable
as CoreStatus,
));
}

View File

@@ -3523,7 +3523,7 @@ as List<SubRule>,
/// @nodoc
mixin _$ClashConfig {
@JsonKey(name: 'mixed-port') int get mixedPort;@JsonKey(name: 'socks-port') int get socksPort;@JsonKey(name: 'port') int get port;@JsonKey(name: 'redir-port') int get redirPort;@JsonKey(name: 'tproxy-port') int get tproxyPort; Mode get mode;@JsonKey(name: 'allow-lan') bool get allowLan;@JsonKey(name: 'log-level') LogLevel get logLevel; bool get ipv6;@JsonKey(name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) FindProcessMode get findProcessMode;@JsonKey(name: 'keep-alive-interval') int get keepAliveInterval;@JsonKey(name: 'unified-delay') bool get unifiedDelay;@JsonKey(name: 'tcp-concurrent') bool get tcpConcurrent;@JsonKey(fromJson: Tun.safeFormJson) Tun get tun;@JsonKey(fromJson: Dns.safeDnsFromJson) Dns get dns;@JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl get geoXUrl;@JsonKey(name: 'geodata-loader') GeodataLoader get geodataLoader;@JsonKey(name: 'proxy-groups') List<ProxyGroup> get proxyGroups; List<String> get rule;@JsonKey(name: 'global-ua') String? get globalUa;@JsonKey(name: 'external-controller') ExternalControllerStatus get externalController; Map<String, String> get hosts;
@JsonKey(name: 'mixed-port') int get mixedPort;@JsonKey(name: 'socks-port') int get socksPort;@JsonKey(name: 'port') int get port;@JsonKey(name: 'redir-port') int get redirPort;@JsonKey(name: 'tproxy-port') int get tproxyPort; Mode get mode;@JsonKey(name: 'allow-lan') bool get allowLan;@JsonKey(name: 'log-level') LogLevel get logLevel; bool get ipv6;@JsonKey(name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) FindProcessMode get findProcessMode;@JsonKey(name: 'keep-alive-interval') int get keepAliveInterval;@JsonKey(name: 'unified-delay') bool get unifiedDelay;@JsonKey(name: 'tcp-concurrent') bool get tcpConcurrent;@JsonKey(fromJson: Tun.safeFormJson) Tun get tun;@JsonKey(fromJson: Dns.safeDnsFromJson) Dns get dns;@JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl get geoXUrl;@JsonKey(name: 'geodata-loader') GeodataLoader get geodataLoader;@JsonKey(name: 'proxy-groups') List<ProxyGroup> get proxyGroups; List<String> get rule;@JsonKey(name: 'global-ua') String? get globalUa;@JsonKey(name: 'external-controller') ExternalControllerStatus get externalController; HostsMap get hosts;
/// Create a copy of ClashConfig
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -3556,7 +3556,7 @@ abstract mixin class $ClashConfigCopyWith<$Res> {
factory $ClashConfigCopyWith(ClashConfig value, $Res Function(ClashConfig) _then) = _$ClashConfigCopyWithImpl;
@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, Mode mode,@JsonKey(name: 'allow-lan') bool allowLan,@JsonKey(name: 'log-level') LogLevel logLevel, bool ipv6,@JsonKey(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(fromJson: Tun.safeFormJson) Tun tun,@JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns,@JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl,@JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader,@JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule,@JsonKey(name: 'global-ua') String? globalUa,@JsonKey(name: 'external-controller') ExternalControllerStatus externalController, Map<String, String> hosts
@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, bool ipv6,@JsonKey(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(fromJson: Tun.safeFormJson) Tun tun,@JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns,@JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl,@JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader,@JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule,@JsonKey(name: 'global-ua') String? globalUa,@JsonKey(name: 'external-controller') ExternalControllerStatus externalController, HostsMap hosts
});
@@ -3597,7 +3597,7 @@ as List<ProxyGroup>,rule: null == rule ? _self.rule : rule // ignore: cast_nulla
as List<String>,globalUa: freezed == globalUa ? _self.globalUa : globalUa // ignore: cast_nullable_to_non_nullable
as String?,externalController: null == externalController ? _self.externalController : externalController // ignore: cast_nullable_to_non_nullable
as ExternalControllerStatus,hosts: null == hosts ? _self.hosts : hosts // ignore: cast_nullable_to_non_nullable
as Map<String, String>,
as HostsMap,
));
}
/// Create a copy of ClashConfig
@@ -3709,7 +3709,7 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@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, bool ipv6, @JsonKey(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(fromJson: Tun.safeFormJson) Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, @JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule, @JsonKey(name: 'global-ua') String? globalUa, @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, Map<String, String> hosts)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function(@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, bool ipv6, @JsonKey(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(fromJson: Tun.safeFormJson) Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, @JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule, @JsonKey(name: 'global-ua') String? globalUa, @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, HostsMap hosts)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ClashConfig() when $default != null:
return $default(_that.mixedPort,_that.socksPort,_that.port,_that.redirPort,_that.tproxyPort,_that.mode,_that.allowLan,_that.logLevel,_that.ipv6,_that.findProcessMode,_that.keepAliveInterval,_that.unifiedDelay,_that.tcpConcurrent,_that.tun,_that.dns,_that.geoXUrl,_that.geodataLoader,_that.proxyGroups,_that.rule,_that.globalUa,_that.externalController,_that.hosts);case _:
@@ -3730,7 +3730,7 @@ return $default(_that.mixedPort,_that.socksPort,_that.port,_that.redirPort,_that
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@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, bool ipv6, @JsonKey(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(fromJson: Tun.safeFormJson) Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, @JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule, @JsonKey(name: 'global-ua') String? globalUa, @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, Map<String, String> hosts) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function(@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, bool ipv6, @JsonKey(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(fromJson: Tun.safeFormJson) Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, @JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule, @JsonKey(name: 'global-ua') String? globalUa, @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, HostsMap hosts) $default,) {final _that = this;
switch (_that) {
case _ClashConfig():
return $default(_that.mixedPort,_that.socksPort,_that.port,_that.redirPort,_that.tproxyPort,_that.mode,_that.allowLan,_that.logLevel,_that.ipv6,_that.findProcessMode,_that.keepAliveInterval,_that.unifiedDelay,_that.tcpConcurrent,_that.tun,_that.dns,_that.geoXUrl,_that.geodataLoader,_that.proxyGroups,_that.rule,_that.globalUa,_that.externalController,_that.hosts);case _:
@@ -3750,7 +3750,7 @@ return $default(_that.mixedPort,_that.socksPort,_that.port,_that.redirPort,_that
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@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, bool ipv6, @JsonKey(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(fromJson: Tun.safeFormJson) Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, @JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule, @JsonKey(name: 'global-ua') String? globalUa, @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, Map<String, String> hosts)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function(@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, bool ipv6, @JsonKey(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(fromJson: Tun.safeFormJson) Tun tun, @JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns, @JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl, @JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader, @JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule, @JsonKey(name: 'global-ua') String? globalUa, @JsonKey(name: 'external-controller') ExternalControllerStatus externalController, HostsMap hosts)? $default,) {final _that = this;
switch (_that) {
case _ClashConfig() when $default != null:
return $default(_that.mixedPort,_that.socksPort,_that.port,_that.redirPort,_that.tproxyPort,_that.mode,_that.allowLan,_that.logLevel,_that.ipv6,_that.findProcessMode,_that.keepAliveInterval,_that.unifiedDelay,_that.tcpConcurrent,_that.tun,_that.dns,_that.geoXUrl,_that.geodataLoader,_that.proxyGroups,_that.rule,_that.globalUa,_that.externalController,_that.hosts);case _:
@@ -3765,7 +3765,7 @@ return $default(_that.mixedPort,_that.socksPort,_that.port,_that.redirPort,_that
@JsonSerializable()
class _ClashConfig implements ClashConfig {
const _ClashConfig({@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, this.ipv6 = false, @JsonKey(name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) this.findProcessMode = FindProcessMode.always, @JsonKey(name: 'keep-alive-interval') this.keepAliveInterval = defaultKeepAliveInterval, @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) this.geoXUrl = defaultGeoXUrl, @JsonKey(name: 'geodata-loader') this.geodataLoader = GeodataLoader.memconservative, @JsonKey(name: 'proxy-groups') final List<ProxyGroup> proxyGroups = const [], final List<String> rule = const [], @JsonKey(name: 'global-ua') this.globalUa, @JsonKey(name: 'external-controller') this.externalController = ExternalControllerStatus.close, final Map<String, String> hosts = const {}}): _proxyGroups = proxyGroups,_rule = rule,_hosts = hosts;
const _ClashConfig({@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, this.ipv6 = false, @JsonKey(name: 'find-process-mode', unknownEnumValue: FindProcessMode.always) this.findProcessMode = FindProcessMode.always, @JsonKey(name: 'keep-alive-interval') this.keepAliveInterval = defaultKeepAliveInterval, @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) this.geoXUrl = defaultGeoXUrl, @JsonKey(name: 'geodata-loader') this.geodataLoader = GeodataLoader.memconservative, @JsonKey(name: 'proxy-groups') final List<ProxyGroup> proxyGroups = const [], final List<String> rule = const [], @JsonKey(name: 'global-ua') this.globalUa, @JsonKey(name: 'external-controller') this.externalController = ExternalControllerStatus.close, final HostsMap hosts = const {}}): _proxyGroups = proxyGroups,_rule = rule,_hosts = hosts;
factory _ClashConfig.fromJson(Map<String, dynamic> json) => _$ClashConfigFromJson(json);
@override@JsonKey(name: 'mixed-port') final int mixedPort;
@@ -3801,8 +3801,8 @@ class _ClashConfig implements ClashConfig {
@override@JsonKey(name: 'global-ua') final String? globalUa;
@override@JsonKey(name: 'external-controller') final ExternalControllerStatus externalController;
final Map<String, String> _hosts;
@override@JsonKey() Map<String, String> get hosts {
final HostsMap _hosts;
@override@JsonKey() HostsMap get hosts {
if (_hosts is EqualUnmodifiableMapView) return _hosts;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_hosts);
@@ -3842,7 +3842,7 @@ abstract mixin class _$ClashConfigCopyWith<$Res> implements $ClashConfigCopyWith
factory _$ClashConfigCopyWith(_ClashConfig value, $Res Function(_ClashConfig) _then) = __$ClashConfigCopyWithImpl;
@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, Mode mode,@JsonKey(name: 'allow-lan') bool allowLan,@JsonKey(name: 'log-level') LogLevel logLevel, bool ipv6,@JsonKey(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(fromJson: Tun.safeFormJson) Tun tun,@JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns,@JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl,@JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader,@JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule,@JsonKey(name: 'global-ua') String? globalUa,@JsonKey(name: 'external-controller') ExternalControllerStatus externalController, Map<String, String> hosts
@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, bool ipv6,@JsonKey(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(fromJson: Tun.safeFormJson) Tun tun,@JsonKey(fromJson: Dns.safeDnsFromJson) Dns dns,@JsonKey(name: 'geox-url', fromJson: GeoXUrl.safeFormJson) GeoXUrl geoXUrl,@JsonKey(name: 'geodata-loader') GeodataLoader geodataLoader,@JsonKey(name: 'proxy-groups') List<ProxyGroup> proxyGroups, List<String> rule,@JsonKey(name: 'global-ua') String? globalUa,@JsonKey(name: 'external-controller') ExternalControllerStatus externalController, HostsMap hosts
});
@@ -3883,7 +3883,7 @@ as List<ProxyGroup>,rule: null == rule ? _self._rule : rule // ignore: cast_null
as List<String>,globalUa: freezed == globalUa ? _self.globalUa : globalUa // ignore: cast_nullable_to_non_nullable
as String?,externalController: null == externalController ? _self.externalController : externalController // ignore: cast_nullable_to_non_nullable
as ExternalControllerStatus,hosts: null == hosts ? _self._hosts : hosts // ignore: cast_nullable_to_non_nullable
as Map<String, String>,
as HostsMap,
));
}

View File

@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AppSettingProps {
String? get locale;@JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> get dashboardWidgets; bool get onlyStatisticsProxy; bool get autoLaunch; bool get silentLaunch; bool get autoRun; bool get openLogs; bool get closeConnections; String get testUrl; bool get isAnimateToPage; bool get autoCheckUpdate; bool get showLabel; bool get disclaimerAccepted; bool get crashlyticsTip; bool get crashlytics; bool get minimizeOnExit; bool get hidden; bool get developerMode; RecoveryStrategy get recoveryStrategy; bool get showTrayTitle;
String? get locale;@JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> get dashboardWidgets; bool get onlyStatisticsProxy; bool get autoLaunch; bool get silentLaunch; bool get autoRun; bool get openLogs; bool get closeConnections; String get testUrl; bool get isAnimateToPage; bool get autoCheckUpdate; bool get showLabel; bool get disclaimerAccepted; bool get crashlyticsTip; bool get crashlytics; bool get minimizeOnExit; bool get hidden; bool get developerMode; RecoveryStrategy get recoveryStrategy;
/// Create a copy of AppSettingProps
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -28,16 +28,16 @@ $AppSettingPropsCopyWith<AppSettingProps> get copyWith => _$AppSettingPropsCopyW
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppSettingProps&&(identical(other.locale, locale) || other.locale == locale)&&const DeepCollectionEquality().equals(other.dashboardWidgets, dashboardWidgets)&&(identical(other.onlyStatisticsProxy, onlyStatisticsProxy) || other.onlyStatisticsProxy == onlyStatisticsProxy)&&(identical(other.autoLaunch, autoLaunch) || other.autoLaunch == autoLaunch)&&(identical(other.silentLaunch, silentLaunch) || other.silentLaunch == silentLaunch)&&(identical(other.autoRun, autoRun) || other.autoRun == autoRun)&&(identical(other.openLogs, openLogs) || other.openLogs == openLogs)&&(identical(other.closeConnections, closeConnections) || other.closeConnections == closeConnections)&&(identical(other.testUrl, testUrl) || other.testUrl == testUrl)&&(identical(other.isAnimateToPage, isAnimateToPage) || other.isAnimateToPage == isAnimateToPage)&&(identical(other.autoCheckUpdate, autoCheckUpdate) || other.autoCheckUpdate == autoCheckUpdate)&&(identical(other.showLabel, showLabel) || other.showLabel == showLabel)&&(identical(other.disclaimerAccepted, disclaimerAccepted) || other.disclaimerAccepted == disclaimerAccepted)&&(identical(other.crashlyticsTip, crashlyticsTip) || other.crashlyticsTip == crashlyticsTip)&&(identical(other.crashlytics, crashlytics) || other.crashlytics == crashlytics)&&(identical(other.minimizeOnExit, minimizeOnExit) || other.minimizeOnExit == minimizeOnExit)&&(identical(other.hidden, hidden) || other.hidden == hidden)&&(identical(other.developerMode, developerMode) || other.developerMode == developerMode)&&(identical(other.recoveryStrategy, recoveryStrategy) || other.recoveryStrategy == recoveryStrategy)&&(identical(other.showTrayTitle, showTrayTitle) || other.showTrayTitle == showTrayTitle));
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppSettingProps&&(identical(other.locale, locale) || other.locale == locale)&&const DeepCollectionEquality().equals(other.dashboardWidgets, dashboardWidgets)&&(identical(other.onlyStatisticsProxy, onlyStatisticsProxy) || other.onlyStatisticsProxy == onlyStatisticsProxy)&&(identical(other.autoLaunch, autoLaunch) || other.autoLaunch == autoLaunch)&&(identical(other.silentLaunch, silentLaunch) || other.silentLaunch == silentLaunch)&&(identical(other.autoRun, autoRun) || other.autoRun == autoRun)&&(identical(other.openLogs, openLogs) || other.openLogs == openLogs)&&(identical(other.closeConnections, closeConnections) || other.closeConnections == closeConnections)&&(identical(other.testUrl, testUrl) || other.testUrl == testUrl)&&(identical(other.isAnimateToPage, isAnimateToPage) || other.isAnimateToPage == isAnimateToPage)&&(identical(other.autoCheckUpdate, autoCheckUpdate) || other.autoCheckUpdate == autoCheckUpdate)&&(identical(other.showLabel, showLabel) || other.showLabel == showLabel)&&(identical(other.disclaimerAccepted, disclaimerAccepted) || other.disclaimerAccepted == disclaimerAccepted)&&(identical(other.crashlyticsTip, crashlyticsTip) || other.crashlyticsTip == crashlyticsTip)&&(identical(other.crashlytics, crashlytics) || other.crashlytics == crashlytics)&&(identical(other.minimizeOnExit, minimizeOnExit) || other.minimizeOnExit == minimizeOnExit)&&(identical(other.hidden, hidden) || other.hidden == hidden)&&(identical(other.developerMode, developerMode) || other.developerMode == developerMode)&&(identical(other.recoveryStrategy, recoveryStrategy) || other.recoveryStrategy == recoveryStrategy));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,locale,const DeepCollectionEquality().hash(dashboardWidgets),onlyStatisticsProxy,autoLaunch,silentLaunch,autoRun,openLogs,closeConnections,testUrl,isAnimateToPage,autoCheckUpdate,showLabel,disclaimerAccepted,crashlyticsTip,crashlytics,minimizeOnExit,hidden,developerMode,recoveryStrategy,showTrayTitle]);
int get hashCode => Object.hashAll([runtimeType,locale,const DeepCollectionEquality().hash(dashboardWidgets),onlyStatisticsProxy,autoLaunch,silentLaunch,autoRun,openLogs,closeConnections,testUrl,isAnimateToPage,autoCheckUpdate,showLabel,disclaimerAccepted,crashlyticsTip,crashlytics,minimizeOnExit,hidden,developerMode,recoveryStrategy]);
@override
String toString() {
return 'AppSettingProps(locale: $locale, dashboardWidgets: $dashboardWidgets, onlyStatisticsProxy: $onlyStatisticsProxy, autoLaunch: $autoLaunch, silentLaunch: $silentLaunch, autoRun: $autoRun, openLogs: $openLogs, closeConnections: $closeConnections, testUrl: $testUrl, isAnimateToPage: $isAnimateToPage, autoCheckUpdate: $autoCheckUpdate, showLabel: $showLabel, disclaimerAccepted: $disclaimerAccepted, crashlyticsTip: $crashlyticsTip, crashlytics: $crashlytics, minimizeOnExit: $minimizeOnExit, hidden: $hidden, developerMode: $developerMode, recoveryStrategy: $recoveryStrategy, showTrayTitle: $showTrayTitle)';
return 'AppSettingProps(locale: $locale, dashboardWidgets: $dashboardWidgets, onlyStatisticsProxy: $onlyStatisticsProxy, autoLaunch: $autoLaunch, silentLaunch: $silentLaunch, autoRun: $autoRun, openLogs: $openLogs, closeConnections: $closeConnections, testUrl: $testUrl, isAnimateToPage: $isAnimateToPage, autoCheckUpdate: $autoCheckUpdate, showLabel: $showLabel, disclaimerAccepted: $disclaimerAccepted, crashlyticsTip: $crashlyticsTip, crashlytics: $crashlytics, minimizeOnExit: $minimizeOnExit, hidden: $hidden, developerMode: $developerMode, recoveryStrategy: $recoveryStrategy)';
}
@@ -48,7 +48,7 @@ abstract mixin class $AppSettingPropsCopyWith<$Res> {
factory $AppSettingPropsCopyWith(AppSettingProps value, $Res Function(AppSettingProps) _then) = _$AppSettingPropsCopyWithImpl;
@useResult
$Res call({
String? locale,@JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy, bool showTrayTitle
String? locale,@JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy
});
@@ -65,7 +65,7 @@ class _$AppSettingPropsCopyWithImpl<$Res>
/// Create a copy of AppSettingProps
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? locale = freezed,Object? dashboardWidgets = null,Object? onlyStatisticsProxy = null,Object? autoLaunch = null,Object? silentLaunch = null,Object? autoRun = null,Object? openLogs = null,Object? closeConnections = null,Object? testUrl = null,Object? isAnimateToPage = null,Object? autoCheckUpdate = null,Object? showLabel = null,Object? disclaimerAccepted = null,Object? crashlyticsTip = null,Object? crashlytics = null,Object? minimizeOnExit = null,Object? hidden = null,Object? developerMode = null,Object? recoveryStrategy = null,Object? showTrayTitle = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? locale = freezed,Object? dashboardWidgets = null,Object? onlyStatisticsProxy = null,Object? autoLaunch = null,Object? silentLaunch = null,Object? autoRun = null,Object? openLogs = null,Object? closeConnections = null,Object? testUrl = null,Object? isAnimateToPage = null,Object? autoCheckUpdate = null,Object? showLabel = null,Object? disclaimerAccepted = null,Object? crashlyticsTip = null,Object? crashlytics = null,Object? minimizeOnExit = null,Object? hidden = null,Object? developerMode = null,Object? recoveryStrategy = null,}) {
return _then(_self.copyWith(
locale: freezed == locale ? _self.locale : locale // ignore: cast_nullable_to_non_nullable
as String?,dashboardWidgets: null == dashboardWidgets ? _self.dashboardWidgets : dashboardWidgets // ignore: cast_nullable_to_non_nullable
@@ -86,8 +86,7 @@ as bool,minimizeOnExit: null == minimizeOnExit ? _self.minimizeOnExit : minimize
as bool,hidden: null == hidden ? _self.hidden : hidden // ignore: cast_nullable_to_non_nullable
as bool,developerMode: null == developerMode ? _self.developerMode : developerMode // ignore: cast_nullable_to_non_nullable
as bool,recoveryStrategy: null == recoveryStrategy ? _self.recoveryStrategy : recoveryStrategy // ignore: cast_nullable_to_non_nullable
as RecoveryStrategy,showTrayTitle: null == showTrayTitle ? _self.showTrayTitle : showTrayTitle // ignore: cast_nullable_to_non_nullable
as bool,
as RecoveryStrategy,
));
}
@@ -172,10 +171,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? locale, @JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy, bool showTrayTitle)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? locale, @JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AppSettingProps() when $default != null:
return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_that.autoLaunch,_that.silentLaunch,_that.autoRun,_that.openLogs,_that.closeConnections,_that.testUrl,_that.isAnimateToPage,_that.autoCheckUpdate,_that.showLabel,_that.disclaimerAccepted,_that.crashlyticsTip,_that.crashlytics,_that.minimizeOnExit,_that.hidden,_that.developerMode,_that.recoveryStrategy,_that.showTrayTitle);case _:
return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_that.autoLaunch,_that.silentLaunch,_that.autoRun,_that.openLogs,_that.closeConnections,_that.testUrl,_that.isAnimateToPage,_that.autoCheckUpdate,_that.showLabel,_that.disclaimerAccepted,_that.crashlyticsTip,_that.crashlytics,_that.minimizeOnExit,_that.hidden,_that.developerMode,_that.recoveryStrategy);case _:
return orElse();
}
@@ -193,10 +192,10 @@ return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_t
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? locale, @JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy, bool showTrayTitle) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? locale, @JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy) $default,) {final _that = this;
switch (_that) {
case _AppSettingProps():
return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_that.autoLaunch,_that.silentLaunch,_that.autoRun,_that.openLogs,_that.closeConnections,_that.testUrl,_that.isAnimateToPage,_that.autoCheckUpdate,_that.showLabel,_that.disclaimerAccepted,_that.crashlyticsTip,_that.crashlytics,_that.minimizeOnExit,_that.hidden,_that.developerMode,_that.recoveryStrategy,_that.showTrayTitle);case _:
return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_that.autoLaunch,_that.silentLaunch,_that.autoRun,_that.openLogs,_that.closeConnections,_that.testUrl,_that.isAnimateToPage,_that.autoCheckUpdate,_that.showLabel,_that.disclaimerAccepted,_that.crashlyticsTip,_that.crashlytics,_that.minimizeOnExit,_that.hidden,_that.developerMode,_that.recoveryStrategy);case _:
throw StateError('Unexpected subclass');
}
@@ -213,10 +212,10 @@ return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_t
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? locale, @JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy, bool showTrayTitle)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? locale, @JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy)? $default,) {final _that = this;
switch (_that) {
case _AppSettingProps() when $default != null:
return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_that.autoLaunch,_that.silentLaunch,_that.autoRun,_that.openLogs,_that.closeConnections,_that.testUrl,_that.isAnimateToPage,_that.autoCheckUpdate,_that.showLabel,_that.disclaimerAccepted,_that.crashlyticsTip,_that.crashlytics,_that.minimizeOnExit,_that.hidden,_that.developerMode,_that.recoveryStrategy,_that.showTrayTitle);case _:
return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_that.autoLaunch,_that.silentLaunch,_that.autoRun,_that.openLogs,_that.closeConnections,_that.testUrl,_that.isAnimateToPage,_that.autoCheckUpdate,_that.showLabel,_that.disclaimerAccepted,_that.crashlyticsTip,_that.crashlytics,_that.minimizeOnExit,_that.hidden,_that.developerMode,_that.recoveryStrategy);case _:
return null;
}
@@ -228,7 +227,7 @@ return $default(_that.locale,_that.dashboardWidgets,_that.onlyStatisticsProxy,_t
@JsonSerializable()
class _AppSettingProps implements AppSettingProps {
const _AppSettingProps({this.locale, @JsonKey(fromJson: dashboardWidgetsSafeFormJson) final List<DashboardWidget> dashboardWidgets = defaultDashboardWidgets, this.onlyStatisticsProxy = false, this.autoLaunch = false, this.silentLaunch = false, this.autoRun = false, this.openLogs = false, this.closeConnections = true, this.testUrl = defaultTestUrl, this.isAnimateToPage = true, this.autoCheckUpdate = true, this.showLabel = false, this.disclaimerAccepted = false, this.crashlyticsTip = false, this.crashlytics = false, this.minimizeOnExit = true, this.hidden = false, this.developerMode = false, this.recoveryStrategy = RecoveryStrategy.compatible, this.showTrayTitle = true}): _dashboardWidgets = dashboardWidgets;
const _AppSettingProps({this.locale, @JsonKey(fromJson: dashboardWidgetsSafeFormJson) final List<DashboardWidget> dashboardWidgets = defaultDashboardWidgets, this.onlyStatisticsProxy = false, this.autoLaunch = false, this.silentLaunch = false, this.autoRun = false, this.openLogs = false, this.closeConnections = true, this.testUrl = defaultTestUrl, this.isAnimateToPage = true, this.autoCheckUpdate = true, this.showLabel = false, this.disclaimerAccepted = false, this.crashlyticsTip = false, this.crashlytics = false, this.minimizeOnExit = true, this.hidden = false, this.developerMode = false, this.recoveryStrategy = RecoveryStrategy.compatible}): _dashboardWidgets = dashboardWidgets;
factory _AppSettingProps.fromJson(Map<String, dynamic> json) => _$AppSettingPropsFromJson(json);
@override final String? locale;
@@ -256,7 +255,6 @@ class _AppSettingProps implements AppSettingProps {
@override@JsonKey() final bool hidden;
@override@JsonKey() final bool developerMode;
@override@JsonKey() final RecoveryStrategy recoveryStrategy;
@override@JsonKey() final bool showTrayTitle;
/// Create a copy of AppSettingProps
/// with the given fields replaced by the non-null parameter values.
@@ -271,16 +269,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettingProps&&(identical(other.locale, locale) || other.locale == locale)&&const DeepCollectionEquality().equals(other._dashboardWidgets, _dashboardWidgets)&&(identical(other.onlyStatisticsProxy, onlyStatisticsProxy) || other.onlyStatisticsProxy == onlyStatisticsProxy)&&(identical(other.autoLaunch, autoLaunch) || other.autoLaunch == autoLaunch)&&(identical(other.silentLaunch, silentLaunch) || other.silentLaunch == silentLaunch)&&(identical(other.autoRun, autoRun) || other.autoRun == autoRun)&&(identical(other.openLogs, openLogs) || other.openLogs == openLogs)&&(identical(other.closeConnections, closeConnections) || other.closeConnections == closeConnections)&&(identical(other.testUrl, testUrl) || other.testUrl == testUrl)&&(identical(other.isAnimateToPage, isAnimateToPage) || other.isAnimateToPage == isAnimateToPage)&&(identical(other.autoCheckUpdate, autoCheckUpdate) || other.autoCheckUpdate == autoCheckUpdate)&&(identical(other.showLabel, showLabel) || other.showLabel == showLabel)&&(identical(other.disclaimerAccepted, disclaimerAccepted) || other.disclaimerAccepted == disclaimerAccepted)&&(identical(other.crashlyticsTip, crashlyticsTip) || other.crashlyticsTip == crashlyticsTip)&&(identical(other.crashlytics, crashlytics) || other.crashlytics == crashlytics)&&(identical(other.minimizeOnExit, minimizeOnExit) || other.minimizeOnExit == minimizeOnExit)&&(identical(other.hidden, hidden) || other.hidden == hidden)&&(identical(other.developerMode, developerMode) || other.developerMode == developerMode)&&(identical(other.recoveryStrategy, recoveryStrategy) || other.recoveryStrategy == recoveryStrategy)&&(identical(other.showTrayTitle, showTrayTitle) || other.showTrayTitle == showTrayTitle));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppSettingProps&&(identical(other.locale, locale) || other.locale == locale)&&const DeepCollectionEquality().equals(other._dashboardWidgets, _dashboardWidgets)&&(identical(other.onlyStatisticsProxy, onlyStatisticsProxy) || other.onlyStatisticsProxy == onlyStatisticsProxy)&&(identical(other.autoLaunch, autoLaunch) || other.autoLaunch == autoLaunch)&&(identical(other.silentLaunch, silentLaunch) || other.silentLaunch == silentLaunch)&&(identical(other.autoRun, autoRun) || other.autoRun == autoRun)&&(identical(other.openLogs, openLogs) || other.openLogs == openLogs)&&(identical(other.closeConnections, closeConnections) || other.closeConnections == closeConnections)&&(identical(other.testUrl, testUrl) || other.testUrl == testUrl)&&(identical(other.isAnimateToPage, isAnimateToPage) || other.isAnimateToPage == isAnimateToPage)&&(identical(other.autoCheckUpdate, autoCheckUpdate) || other.autoCheckUpdate == autoCheckUpdate)&&(identical(other.showLabel, showLabel) || other.showLabel == showLabel)&&(identical(other.disclaimerAccepted, disclaimerAccepted) || other.disclaimerAccepted == disclaimerAccepted)&&(identical(other.crashlyticsTip, crashlyticsTip) || other.crashlyticsTip == crashlyticsTip)&&(identical(other.crashlytics, crashlytics) || other.crashlytics == crashlytics)&&(identical(other.minimizeOnExit, minimizeOnExit) || other.minimizeOnExit == minimizeOnExit)&&(identical(other.hidden, hidden) || other.hidden == hidden)&&(identical(other.developerMode, developerMode) || other.developerMode == developerMode)&&(identical(other.recoveryStrategy, recoveryStrategy) || other.recoveryStrategy == recoveryStrategy));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,locale,const DeepCollectionEquality().hash(_dashboardWidgets),onlyStatisticsProxy,autoLaunch,silentLaunch,autoRun,openLogs,closeConnections,testUrl,isAnimateToPage,autoCheckUpdate,showLabel,disclaimerAccepted,crashlyticsTip,crashlytics,minimizeOnExit,hidden,developerMode,recoveryStrategy,showTrayTitle]);
int get hashCode => Object.hashAll([runtimeType,locale,const DeepCollectionEquality().hash(_dashboardWidgets),onlyStatisticsProxy,autoLaunch,silentLaunch,autoRun,openLogs,closeConnections,testUrl,isAnimateToPage,autoCheckUpdate,showLabel,disclaimerAccepted,crashlyticsTip,crashlytics,minimizeOnExit,hidden,developerMode,recoveryStrategy]);
@override
String toString() {
return 'AppSettingProps(locale: $locale, dashboardWidgets: $dashboardWidgets, onlyStatisticsProxy: $onlyStatisticsProxy, autoLaunch: $autoLaunch, silentLaunch: $silentLaunch, autoRun: $autoRun, openLogs: $openLogs, closeConnections: $closeConnections, testUrl: $testUrl, isAnimateToPage: $isAnimateToPage, autoCheckUpdate: $autoCheckUpdate, showLabel: $showLabel, disclaimerAccepted: $disclaimerAccepted, crashlyticsTip: $crashlyticsTip, crashlytics: $crashlytics, minimizeOnExit: $minimizeOnExit, hidden: $hidden, developerMode: $developerMode, recoveryStrategy: $recoveryStrategy, showTrayTitle: $showTrayTitle)';
return 'AppSettingProps(locale: $locale, dashboardWidgets: $dashboardWidgets, onlyStatisticsProxy: $onlyStatisticsProxy, autoLaunch: $autoLaunch, silentLaunch: $silentLaunch, autoRun: $autoRun, openLogs: $openLogs, closeConnections: $closeConnections, testUrl: $testUrl, isAnimateToPage: $isAnimateToPage, autoCheckUpdate: $autoCheckUpdate, showLabel: $showLabel, disclaimerAccepted: $disclaimerAccepted, crashlyticsTip: $crashlyticsTip, crashlytics: $crashlytics, minimizeOnExit: $minimizeOnExit, hidden: $hidden, developerMode: $developerMode, recoveryStrategy: $recoveryStrategy)';
}
@@ -291,7 +289,7 @@ abstract mixin class _$AppSettingPropsCopyWith<$Res> implements $AppSettingProps
factory _$AppSettingPropsCopyWith(_AppSettingProps value, $Res Function(_AppSettingProps) _then) = __$AppSettingPropsCopyWithImpl;
@override @useResult
$Res call({
String? locale,@JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy, bool showTrayTitle
String? locale,@JsonKey(fromJson: dashboardWidgetsSafeFormJson) List<DashboardWidget> dashboardWidgets, bool onlyStatisticsProxy, bool autoLaunch, bool silentLaunch, bool autoRun, bool openLogs, bool closeConnections, String testUrl, bool isAnimateToPage, bool autoCheckUpdate, bool showLabel, bool disclaimerAccepted, bool crashlyticsTip, bool crashlytics, bool minimizeOnExit, bool hidden, bool developerMode, RecoveryStrategy recoveryStrategy
});
@@ -308,7 +306,7 @@ class __$AppSettingPropsCopyWithImpl<$Res>
/// Create a copy of AppSettingProps
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? locale = freezed,Object? dashboardWidgets = null,Object? onlyStatisticsProxy = null,Object? autoLaunch = null,Object? silentLaunch = null,Object? autoRun = null,Object? openLogs = null,Object? closeConnections = null,Object? testUrl = null,Object? isAnimateToPage = null,Object? autoCheckUpdate = null,Object? showLabel = null,Object? disclaimerAccepted = null,Object? crashlyticsTip = null,Object? crashlytics = null,Object? minimizeOnExit = null,Object? hidden = null,Object? developerMode = null,Object? recoveryStrategy = null,Object? showTrayTitle = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? locale = freezed,Object? dashboardWidgets = null,Object? onlyStatisticsProxy = null,Object? autoLaunch = null,Object? silentLaunch = null,Object? autoRun = null,Object? openLogs = null,Object? closeConnections = null,Object? testUrl = null,Object? isAnimateToPage = null,Object? autoCheckUpdate = null,Object? showLabel = null,Object? disclaimerAccepted = null,Object? crashlyticsTip = null,Object? crashlytics = null,Object? minimizeOnExit = null,Object? hidden = null,Object? developerMode = null,Object? recoveryStrategy = null,}) {
return _then(_AppSettingProps(
locale: freezed == locale ? _self.locale : locale // ignore: cast_nullable_to_non_nullable
as String?,dashboardWidgets: null == dashboardWidgets ? _self._dashboardWidgets : dashboardWidgets // ignore: cast_nullable_to_non_nullable
@@ -329,8 +327,7 @@ as bool,minimizeOnExit: null == minimizeOnExit ? _self.minimizeOnExit : minimize
as bool,hidden: null == hidden ? _self.hidden : hidden // ignore: cast_nullable_to_non_nullable
as bool,developerMode: null == developerMode ? _self.developerMode : developerMode // ignore: cast_nullable_to_non_nullable
as bool,recoveryStrategy: null == recoveryStrategy ? _self.recoveryStrategy : recoveryStrategy // ignore: cast_nullable_to_non_nullable
as RecoveryStrategy,showTrayTitle: null == showTrayTitle ? _self.showTrayTitle : showTrayTitle // ignore: cast_nullable_to_non_nullable
as bool,
as RecoveryStrategy,
));
}
@@ -831,7 +828,7 @@ return $default(_that.width,_that.height,_that.top,_that.left);case _:
@JsonSerializable()
class _WindowProps implements WindowProps {
const _WindowProps({this.width = 0, this.height = 0, this.top, this.left});
const _WindowProps({this.width = 750, this.height = 600, this.top, this.left});
factory _WindowProps.fromJson(Map<String, dynamic> json) => _$WindowPropsFromJson(json);
@override@JsonKey() final double width;
@@ -1483,7 +1480,7 @@ as bool,
/// @nodoc
mixin _$ProxiesStyle {
ProxiesType get type; ProxiesSortType get sortType; ProxiesLayout get layout; ProxiesIconStyle get iconStyle; ProxyCardType get cardType;
ProxiesType get type; ProxiesSortType get sortType; ProxiesLayout get layout; ProxiesIconStyle get iconStyle; ProxyCardType get cardType; Map<String, String> get iconMap;
/// Create a copy of ProxiesStyle
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -1496,16 +1493,16 @@ $ProxiesStyleCopyWith<ProxiesStyle> get copyWith => _$ProxiesStyleCopyWithImpl<P
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ProxiesStyle&&(identical(other.type, type) || other.type == type)&&(identical(other.sortType, sortType) || other.sortType == sortType)&&(identical(other.layout, layout) || other.layout == layout)&&(identical(other.iconStyle, iconStyle) || other.iconStyle == iconStyle)&&(identical(other.cardType, cardType) || other.cardType == cardType));
return identical(this, other) || (other.runtimeType == runtimeType&&other is ProxiesStyle&&(identical(other.type, type) || other.type == type)&&(identical(other.sortType, sortType) || other.sortType == sortType)&&(identical(other.layout, layout) || other.layout == layout)&&(identical(other.iconStyle, iconStyle) || other.iconStyle == iconStyle)&&(identical(other.cardType, cardType) || other.cardType == cardType)&&const DeepCollectionEquality().equals(other.iconMap, iconMap));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,type,sortType,layout,iconStyle,cardType);
int get hashCode => Object.hash(runtimeType,type,sortType,layout,iconStyle,cardType,const DeepCollectionEquality().hash(iconMap));
@override
String toString() {
return 'ProxiesStyle(type: $type, sortType: $sortType, layout: $layout, iconStyle: $iconStyle, cardType: $cardType)';
return 'ProxiesStyle(type: $type, sortType: $sortType, layout: $layout, iconStyle: $iconStyle, cardType: $cardType, iconMap: $iconMap)';
}
@@ -1516,7 +1513,7 @@ abstract mixin class $ProxiesStyleCopyWith<$Res> {
factory $ProxiesStyleCopyWith(ProxiesStyle value, $Res Function(ProxiesStyle) _then) = _$ProxiesStyleCopyWithImpl;
@useResult
$Res call({
ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType
ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType, Map<String, String> iconMap
});
@@ -1533,14 +1530,15 @@ class _$ProxiesStyleCopyWithImpl<$Res>
/// Create a copy of ProxiesStyle
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? sortType = null,Object? layout = null,Object? iconStyle = null,Object? cardType = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? type = null,Object? sortType = null,Object? layout = null,Object? iconStyle = null,Object? cardType = null,Object? iconMap = null,}) {
return _then(_self.copyWith(
type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as ProxiesType,sortType: null == sortType ? _self.sortType : sortType // ignore: cast_nullable_to_non_nullable
as ProxiesSortType,layout: null == layout ? _self.layout : layout // ignore: cast_nullable_to_non_nullable
as ProxiesLayout,iconStyle: null == iconStyle ? _self.iconStyle : iconStyle // ignore: cast_nullable_to_non_nullable
as ProxiesIconStyle,cardType: null == cardType ? _self.cardType : cardType // ignore: cast_nullable_to_non_nullable
as ProxyCardType,
as ProxyCardType,iconMap: null == iconMap ? _self.iconMap : iconMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>,
));
}
@@ -1625,10 +1623,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType, Map<String, String> iconMap)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ProxiesStyle() when $default != null:
return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.cardType);case _:
return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.cardType,_that.iconMap);case _:
return orElse();
}
@@ -1646,10 +1644,10 @@ return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.car
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType, Map<String, String> iconMap) $default,) {final _that = this;
switch (_that) {
case _ProxiesStyle():
return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.cardType);case _:
return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.cardType,_that.iconMap);case _:
throw StateError('Unexpected subclass');
}
@@ -1666,10 +1664,10 @@ return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.car
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType, Map<String, String> iconMap)? $default,) {final _that = this;
switch (_that) {
case _ProxiesStyle() when $default != null:
return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.cardType);case _:
return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.cardType,_that.iconMap);case _:
return null;
}
@@ -1681,7 +1679,7 @@ return $default(_that.type,_that.sortType,_that.layout,_that.iconStyle,_that.car
@JsonSerializable()
class _ProxiesStyle implements ProxiesStyle {
const _ProxiesStyle({this.type = ProxiesType.tab, this.sortType = ProxiesSortType.none, this.layout = ProxiesLayout.standard, this.iconStyle = ProxiesIconStyle.standard, this.cardType = ProxyCardType.expand});
const _ProxiesStyle({this.type = ProxiesType.tab, this.sortType = ProxiesSortType.none, this.layout = ProxiesLayout.standard, this.iconStyle = ProxiesIconStyle.standard, this.cardType = ProxyCardType.expand, final Map<String, String> iconMap = const {}}): _iconMap = iconMap;
factory _ProxiesStyle.fromJson(Map<String, dynamic> json) => _$ProxiesStyleFromJson(json);
@override@JsonKey() final ProxiesType type;
@@ -1689,6 +1687,13 @@ class _ProxiesStyle implements ProxiesStyle {
@override@JsonKey() final ProxiesLayout layout;
@override@JsonKey() final ProxiesIconStyle iconStyle;
@override@JsonKey() final ProxyCardType cardType;
final Map<String, String> _iconMap;
@override@JsonKey() Map<String, String> get iconMap {
if (_iconMap is EqualUnmodifiableMapView) return _iconMap;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_iconMap);
}
/// Create a copy of ProxiesStyle
/// with the given fields replaced by the non-null parameter values.
@@ -1703,16 +1708,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProxiesStyle&&(identical(other.type, type) || other.type == type)&&(identical(other.sortType, sortType) || other.sortType == sortType)&&(identical(other.layout, layout) || other.layout == layout)&&(identical(other.iconStyle, iconStyle) || other.iconStyle == iconStyle)&&(identical(other.cardType, cardType) || other.cardType == cardType));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ProxiesStyle&&(identical(other.type, type) || other.type == type)&&(identical(other.sortType, sortType) || other.sortType == sortType)&&(identical(other.layout, layout) || other.layout == layout)&&(identical(other.iconStyle, iconStyle) || other.iconStyle == iconStyle)&&(identical(other.cardType, cardType) || other.cardType == cardType)&&const DeepCollectionEquality().equals(other._iconMap, _iconMap));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,type,sortType,layout,iconStyle,cardType);
int get hashCode => Object.hash(runtimeType,type,sortType,layout,iconStyle,cardType,const DeepCollectionEquality().hash(_iconMap));
@override
String toString() {
return 'ProxiesStyle(type: $type, sortType: $sortType, layout: $layout, iconStyle: $iconStyle, cardType: $cardType)';
return 'ProxiesStyle(type: $type, sortType: $sortType, layout: $layout, iconStyle: $iconStyle, cardType: $cardType, iconMap: $iconMap)';
}
@@ -1723,7 +1728,7 @@ abstract mixin class _$ProxiesStyleCopyWith<$Res> implements $ProxiesStyleCopyWi
factory _$ProxiesStyleCopyWith(_ProxiesStyle value, $Res Function(_ProxiesStyle) _then) = __$ProxiesStyleCopyWithImpl;
@override @useResult
$Res call({
ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType
ProxiesType type, ProxiesSortType sortType, ProxiesLayout layout, ProxiesIconStyle iconStyle, ProxyCardType cardType, Map<String, String> iconMap
});
@@ -1740,14 +1745,15 @@ class __$ProxiesStyleCopyWithImpl<$Res>
/// Create a copy of ProxiesStyle
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? sortType = null,Object? layout = null,Object? iconStyle = null,Object? cardType = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? type = null,Object? sortType = null,Object? layout = null,Object? iconStyle = null,Object? cardType = null,Object? iconMap = null,}) {
return _then(_ProxiesStyle(
type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as ProxiesType,sortType: null == sortType ? _self.sortType : sortType // ignore: cast_nullable_to_non_nullable
as ProxiesSortType,layout: null == layout ? _self.layout : layout // ignore: cast_nullable_to_non_nullable
as ProxiesLayout,iconStyle: null == iconStyle ? _self.iconStyle : iconStyle // ignore: cast_nullable_to_non_nullable
as ProxiesIconStyle,cardType: null == cardType ? _self.cardType : cardType // ignore: cast_nullable_to_non_nullable
as ProxyCardType,
as ProxyCardType,iconMap: null == iconMap ? _self._iconMap : iconMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>,
));
}

View File

@@ -34,7 +34,6 @@ _AppSettingProps _$AppSettingPropsFromJson(Map<String, dynamic> json) =>
json['recoveryStrategy'],
) ??
RecoveryStrategy.compatible,
showTrayTitle: json['showTrayTitle'] as bool? ?? true,
);
Map<String, dynamic> _$AppSettingPropsToJson(_AppSettingProps instance) =>
@@ -60,7 +59,6 @@ Map<String, dynamic> _$AppSettingPropsToJson(_AppSettingProps instance) =>
'hidden': instance.hidden,
'developerMode': instance.developerMode,
'recoveryStrategy': _$RecoveryStrategyEnumMap[instance.recoveryStrategy]!,
'showTrayTitle': instance.showTrayTitle,
};
const _$RecoveryStrategyEnumMap = {
@@ -127,8 +125,8 @@ const _$AccessSortTypeEnumMap = {
};
_WindowProps _$WindowPropsFromJson(Map<String, dynamic> json) => _WindowProps(
width: (json['width'] as num?)?.toDouble() ?? 0,
height: (json['height'] as num?)?.toDouble() ?? 0,
width: (json['width'] as num?)?.toDouble() ?? 750,
height: (json['height'] as num?)?.toDouble() ?? 600,
top: (json['top'] as num?)?.toDouble(),
left: (json['left'] as num?)?.toDouble(),
);
@@ -207,6 +205,11 @@ _ProxiesStyle _$ProxiesStyleFromJson(Map<String, dynamic> json) =>
cardType:
$enumDecodeNullable(_$ProxyCardTypeEnumMap, json['cardType']) ??
ProxyCardType.expand,
iconMap:
(json['iconMap'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
) ??
const {},
);
Map<String, dynamic> _$ProxiesStyleToJson(_ProxiesStyle instance) =>
@@ -216,6 +219,7 @@ Map<String, dynamic> _$ProxiesStyleToJson(_ProxiesStyle instance) =>
'layout': _$ProxiesLayoutEnumMap[instance.layout]!,
'iconStyle': _$ProxiesIconStyleEnumMap[instance.iconStyle]!,
'cardType': _$ProxyCardTypeEnumMap[instance.cardType]!,
'iconMap': instance.iconMap,
};
const _$ProxiesTypeEnumMap = {ProxiesType.tab: 'tab', ProxiesType.list: 'list'};

View File

@@ -287,7 +287,7 @@ as int,
/// @nodoc
mixin _$Profile {
String get id; String? get label; String? get currentGroupName; String get url; DateTime? get lastUpdateDate; Duration get autoUpdateDuration; SubscriptionInfo? get subscriptionInfo; bool get autoUpdate; Map<String, String> get selectedMap; Set<String> get unfoldSet; OverrideData get overrideData; Overwrite get overwrite;@JsonKey(includeToJson: false, includeFromJson: false) bool get isUpdating;
String get id; String? get label; String? get currentGroupName; String get url; DateTime? get lastUpdateDate; Duration get autoUpdateDuration; SubscriptionInfo? get subscriptionInfo; bool get autoUpdate; SelectedMap get selectedMap; Set<String> get unfoldSet; OverrideData get overrideData; Overwrite get overwrite;@JsonKey(includeToJson: false, includeFromJson: false) bool get isUpdating;
/// Create a copy of Profile
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -320,7 +320,7 @@ abstract mixin class $ProfileCopyWith<$Res> {
factory $ProfileCopyWith(Profile value, $Res Function(Profile) _then) = _$ProfileCopyWithImpl;
@useResult
$Res call({
String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, Map<String, String> selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite,@JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating
String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, SelectedMap selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite,@JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating
});
@@ -348,7 +348,7 @@ as DateTime?,autoUpdateDuration: null == autoUpdateDuration ? _self.autoUpdateDu
as Duration,subscriptionInfo: freezed == subscriptionInfo ? _self.subscriptionInfo : subscriptionInfo // ignore: cast_nullable_to_non_nullable
as SubscriptionInfo?,autoUpdate: null == autoUpdate ? _self.autoUpdate : autoUpdate // ignore: cast_nullable_to_non_nullable
as bool,selectedMap: null == selectedMap ? _self.selectedMap : selectedMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>,unfoldSet: null == unfoldSet ? _self.unfoldSet : unfoldSet // ignore: cast_nullable_to_non_nullable
as SelectedMap,unfoldSet: null == unfoldSet ? _self.unfoldSet : unfoldSet // ignore: cast_nullable_to_non_nullable
as Set<String>,overrideData: null == overrideData ? _self.overrideData : overrideData // ignore: cast_nullable_to_non_nullable
as OverrideData,overwrite: null == overwrite ? _self.overwrite : overwrite // ignore: cast_nullable_to_non_nullable
as Overwrite,isUpdating: null == isUpdating ? _self.isUpdating : isUpdating // ignore: cast_nullable_to_non_nullable
@@ -467,7 +467,7 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, Map<String, String> selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite, @JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, SelectedMap selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite, @JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Profile() when $default != null:
return $default(_that.id,_that.label,_that.currentGroupName,_that.url,_that.lastUpdateDate,_that.autoUpdateDuration,_that.subscriptionInfo,_that.autoUpdate,_that.selectedMap,_that.unfoldSet,_that.overrideData,_that.overwrite,_that.isUpdating);case _:
@@ -488,7 +488,7 @@ return $default(_that.id,_that.label,_that.currentGroupName,_that.url,_that.last
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, Map<String, String> selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite, @JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, SelectedMap selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite, @JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating) $default,) {final _that = this;
switch (_that) {
case _Profile():
return $default(_that.id,_that.label,_that.currentGroupName,_that.url,_that.lastUpdateDate,_that.autoUpdateDuration,_that.subscriptionInfo,_that.autoUpdate,_that.selectedMap,_that.unfoldSet,_that.overrideData,_that.overwrite,_that.isUpdating);case _:
@@ -508,7 +508,7 @@ return $default(_that.id,_that.label,_that.currentGroupName,_that.url,_that.last
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, Map<String, String> selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite, @JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, SelectedMap selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite, @JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating)? $default,) {final _that = this;
switch (_that) {
case _Profile() when $default != null:
return $default(_that.id,_that.label,_that.currentGroupName,_that.url,_that.lastUpdateDate,_that.autoUpdateDuration,_that.subscriptionInfo,_that.autoUpdate,_that.selectedMap,_that.unfoldSet,_that.overrideData,_that.overwrite,_that.isUpdating);case _:
@@ -523,7 +523,7 @@ return $default(_that.id,_that.label,_that.currentGroupName,_that.url,_that.last
@JsonSerializable()
class _Profile implements Profile {
const _Profile({required this.id, this.label, this.currentGroupName, this.url = '', this.lastUpdateDate, required this.autoUpdateDuration, this.subscriptionInfo, this.autoUpdate = true, final Map<String, String> selectedMap = const {}, final Set<String> unfoldSet = const {}, this.overrideData = const OverrideData(), this.overwrite = const Overwrite(), @JsonKey(includeToJson: false, includeFromJson: false) this.isUpdating = false}): _selectedMap = selectedMap,_unfoldSet = unfoldSet;
const _Profile({required this.id, this.label, this.currentGroupName, this.url = '', this.lastUpdateDate, required this.autoUpdateDuration, this.subscriptionInfo, this.autoUpdate = true, final SelectedMap selectedMap = const {}, final Set<String> unfoldSet = const {}, this.overrideData = const OverrideData(), this.overwrite = const Overwrite(), @JsonKey(includeToJson: false, includeFromJson: false) this.isUpdating = false}): _selectedMap = selectedMap,_unfoldSet = unfoldSet;
factory _Profile.fromJson(Map<String, dynamic> json) => _$ProfileFromJson(json);
@override final String id;
@@ -534,8 +534,8 @@ class _Profile implements Profile {
@override final Duration autoUpdateDuration;
@override final SubscriptionInfo? subscriptionInfo;
@override@JsonKey() final bool autoUpdate;
final Map<String, String> _selectedMap;
@override@JsonKey() Map<String, String> get selectedMap {
final SelectedMap _selectedMap;
@override@JsonKey() SelectedMap get selectedMap {
if (_selectedMap is EqualUnmodifiableMapView) return _selectedMap;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_selectedMap);
@@ -585,7 +585,7 @@ abstract mixin class _$ProfileCopyWith<$Res> implements $ProfileCopyWith<$Res> {
factory _$ProfileCopyWith(_Profile value, $Res Function(_Profile) _then) = __$ProfileCopyWithImpl;
@override @useResult
$Res call({
String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, Map<String, String> selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite,@JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating
String id, String? label, String? currentGroupName, String url, DateTime? lastUpdateDate, Duration autoUpdateDuration, SubscriptionInfo? subscriptionInfo, bool autoUpdate, SelectedMap selectedMap, Set<String> unfoldSet, OverrideData overrideData, Overwrite overwrite,@JsonKey(includeToJson: false, includeFromJson: false) bool isUpdating
});
@@ -613,7 +613,7 @@ as DateTime?,autoUpdateDuration: null == autoUpdateDuration ? _self.autoUpdateDu
as Duration,subscriptionInfo: freezed == subscriptionInfo ? _self.subscriptionInfo : subscriptionInfo // ignore: cast_nullable_to_non_nullable
as SubscriptionInfo?,autoUpdate: null == autoUpdate ? _self.autoUpdate : autoUpdate // ignore: cast_nullable_to_non_nullable
as bool,selectedMap: null == selectedMap ? _self._selectedMap : selectedMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>,unfoldSet: null == unfoldSet ? _self._unfoldSet : unfoldSet // ignore: cast_nullable_to_non_nullable
as SelectedMap,unfoldSet: null == unfoldSet ? _self._unfoldSet : unfoldSet // ignore: cast_nullable_to_non_nullable
as Set<String>,overrideData: null == overrideData ? _self.overrideData : overrideData // ignore: cast_nullable_to_non_nullable
as OverrideData,overwrite: null == overwrite ? _self.overwrite : overwrite // ignore: cast_nullable_to_non_nullable
as Overwrite,isUpdating: null == isUpdating ? _self.isUpdating : isUpdating // ignore: cast_nullable_to_non_nullable

View File

@@ -1885,7 +1885,7 @@ $IpInfoCopyWith<$Res>? get ipInfo {
/// @nodoc
mixin _$TrayState {
Mode get mode; int get port; bool get autoLaunch; bool get systemProxy; bool get tunEnable; bool get isStart; String? get locale; Brightness? get brightness; List<Group> get groups; Map<String, String> get selectedMap; bool get showTrayTitle;
Mode get mode; int get port; bool get autoLaunch; bool get systemProxy; bool get tunEnable; bool get isStart; String? get locale; Brightness? get brightness; List<Group> get groups; SelectedMap get selectedMap;
/// Create a copy of TrayState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -1896,16 +1896,16 @@ $TrayStateCopyWith<TrayState> get copyWith => _$TrayStateCopyWithImpl<TrayState>
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is TrayState&&(identical(other.mode, mode) || other.mode == mode)&&(identical(other.port, port) || other.port == port)&&(identical(other.autoLaunch, autoLaunch) || other.autoLaunch == autoLaunch)&&(identical(other.systemProxy, systemProxy) || other.systemProxy == systemProxy)&&(identical(other.tunEnable, tunEnable) || other.tunEnable == tunEnable)&&(identical(other.isStart, isStart) || other.isStart == isStart)&&(identical(other.locale, locale) || other.locale == locale)&&(identical(other.brightness, brightness) || other.brightness == brightness)&&const DeepCollectionEquality().equals(other.groups, groups)&&const DeepCollectionEquality().equals(other.selectedMap, selectedMap)&&(identical(other.showTrayTitle, showTrayTitle) || other.showTrayTitle == showTrayTitle));
return identical(this, other) || (other.runtimeType == runtimeType&&other is TrayState&&(identical(other.mode, mode) || other.mode == mode)&&(identical(other.port, port) || other.port == port)&&(identical(other.autoLaunch, autoLaunch) || other.autoLaunch == autoLaunch)&&(identical(other.systemProxy, systemProxy) || other.systemProxy == systemProxy)&&(identical(other.tunEnable, tunEnable) || other.tunEnable == tunEnable)&&(identical(other.isStart, isStart) || other.isStart == isStart)&&(identical(other.locale, locale) || other.locale == locale)&&(identical(other.brightness, brightness) || other.brightness == brightness)&&const DeepCollectionEquality().equals(other.groups, groups)&&const DeepCollectionEquality().equals(other.selectedMap, selectedMap));
}
@override
int get hashCode => Object.hash(runtimeType,mode,port,autoLaunch,systemProxy,tunEnable,isStart,locale,brightness,const DeepCollectionEquality().hash(groups),const DeepCollectionEquality().hash(selectedMap),showTrayTitle);
int get hashCode => Object.hash(runtimeType,mode,port,autoLaunch,systemProxy,tunEnable,isStart,locale,brightness,const DeepCollectionEquality().hash(groups),const DeepCollectionEquality().hash(selectedMap));
@override
String toString() {
return 'TrayState(mode: $mode, port: $port, autoLaunch: $autoLaunch, systemProxy: $systemProxy, tunEnable: $tunEnable, isStart: $isStart, locale: $locale, brightness: $brightness, groups: $groups, selectedMap: $selectedMap, showTrayTitle: $showTrayTitle)';
return 'TrayState(mode: $mode, port: $port, autoLaunch: $autoLaunch, systemProxy: $systemProxy, tunEnable: $tunEnable, isStart: $isStart, locale: $locale, brightness: $brightness, groups: $groups, selectedMap: $selectedMap)';
}
@@ -1916,7 +1916,7 @@ abstract mixin class $TrayStateCopyWith<$Res> {
factory $TrayStateCopyWith(TrayState value, $Res Function(TrayState) _then) = _$TrayStateCopyWithImpl;
@useResult
$Res call({
Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, Map<String, String> selectedMap, bool showTrayTitle
Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, SelectedMap selectedMap
});
@@ -1933,7 +1933,7 @@ class _$TrayStateCopyWithImpl<$Res>
/// Create a copy of TrayState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? mode = null,Object? port = null,Object? autoLaunch = null,Object? systemProxy = null,Object? tunEnable = null,Object? isStart = null,Object? locale = freezed,Object? brightness = freezed,Object? groups = null,Object? selectedMap = null,Object? showTrayTitle = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? mode = null,Object? port = null,Object? autoLaunch = null,Object? systemProxy = null,Object? tunEnable = null,Object? isStart = null,Object? locale = freezed,Object? brightness = freezed,Object? groups = null,Object? selectedMap = null,}) {
return _then(_self.copyWith(
mode: null == mode ? _self.mode : mode // ignore: cast_nullable_to_non_nullable
as Mode,port: null == port ? _self.port : port // ignore: cast_nullable_to_non_nullable
@@ -1945,8 +1945,7 @@ as bool,locale: freezed == locale ? _self.locale : locale // ignore: cast_nullab
as String?,brightness: freezed == brightness ? _self.brightness : brightness // ignore: cast_nullable_to_non_nullable
as Brightness?,groups: null == groups ? _self.groups : groups // ignore: cast_nullable_to_non_nullable
as List<Group>,selectedMap: null == selectedMap ? _self.selectedMap : selectedMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>,showTrayTitle: null == showTrayTitle ? _self.showTrayTitle : showTrayTitle // ignore: cast_nullable_to_non_nullable
as bool,
as SelectedMap,
));
}
@@ -2031,10 +2030,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, Map<String, String> selectedMap, bool showTrayTitle)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, SelectedMap selectedMap)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _TrayState() when $default != null:
return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.tunEnable,_that.isStart,_that.locale,_that.brightness,_that.groups,_that.selectedMap,_that.showTrayTitle);case _:
return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.tunEnable,_that.isStart,_that.locale,_that.brightness,_that.groups,_that.selectedMap);case _:
return orElse();
}
@@ -2052,10 +2051,10 @@ return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.t
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, Map<String, String> selectedMap, bool showTrayTitle) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, SelectedMap selectedMap) $default,) {final _that = this;
switch (_that) {
case _TrayState():
return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.tunEnable,_that.isStart,_that.locale,_that.brightness,_that.groups,_that.selectedMap,_that.showTrayTitle);case _:
return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.tunEnable,_that.isStart,_that.locale,_that.brightness,_that.groups,_that.selectedMap);case _:
throw StateError('Unexpected subclass');
}
@@ -2072,10 +2071,10 @@ return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.t
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, Map<String, String> selectedMap, bool showTrayTitle)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, SelectedMap selectedMap)? $default,) {final _that = this;
switch (_that) {
case _TrayState() when $default != null:
return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.tunEnable,_that.isStart,_that.locale,_that.brightness,_that.groups,_that.selectedMap,_that.showTrayTitle);case _:
return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.tunEnable,_that.isStart,_that.locale,_that.brightness,_that.groups,_that.selectedMap);case _:
return null;
}
@@ -2087,7 +2086,7 @@ return $default(_that.mode,_that.port,_that.autoLaunch,_that.systemProxy,_that.t
class _TrayState implements TrayState {
const _TrayState({required this.mode, required this.port, required this.autoLaunch, required this.systemProxy, required this.tunEnable, required this.isStart, required this.locale, required this.brightness, required final List<Group> groups, required final Map<String, String> selectedMap, required this.showTrayTitle}): _groups = groups,_selectedMap = selectedMap;
const _TrayState({required this.mode, required this.port, required this.autoLaunch, required this.systemProxy, required this.tunEnable, required this.isStart, required this.locale, required this.brightness, required final List<Group> groups, required final SelectedMap selectedMap}): _groups = groups,_selectedMap = selectedMap;
@override final Mode mode;
@@ -2105,14 +2104,13 @@ class _TrayState implements TrayState {
return EqualUnmodifiableListView(_groups);
}
final Map<String, String> _selectedMap;
@override Map<String, String> get selectedMap {
final SelectedMap _selectedMap;
@override SelectedMap get selectedMap {
if (_selectedMap is EqualUnmodifiableMapView) return _selectedMap;
// ignore: implicit_dynamic_type
return EqualUnmodifiableMapView(_selectedMap);
}
@override final bool showTrayTitle;
/// Create a copy of TrayState
/// with the given fields replaced by the non-null parameter values.
@@ -2124,16 +2122,16 @@ _$TrayStateCopyWith<_TrayState> get copyWith => __$TrayStateCopyWithImpl<_TraySt
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TrayState&&(identical(other.mode, mode) || other.mode == mode)&&(identical(other.port, port) || other.port == port)&&(identical(other.autoLaunch, autoLaunch) || other.autoLaunch == autoLaunch)&&(identical(other.systemProxy, systemProxy) || other.systemProxy == systemProxy)&&(identical(other.tunEnable, tunEnable) || other.tunEnable == tunEnable)&&(identical(other.isStart, isStart) || other.isStart == isStart)&&(identical(other.locale, locale) || other.locale == locale)&&(identical(other.brightness, brightness) || other.brightness == brightness)&&const DeepCollectionEquality().equals(other._groups, _groups)&&const DeepCollectionEquality().equals(other._selectedMap, _selectedMap)&&(identical(other.showTrayTitle, showTrayTitle) || other.showTrayTitle == showTrayTitle));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TrayState&&(identical(other.mode, mode) || other.mode == mode)&&(identical(other.port, port) || other.port == port)&&(identical(other.autoLaunch, autoLaunch) || other.autoLaunch == autoLaunch)&&(identical(other.systemProxy, systemProxy) || other.systemProxy == systemProxy)&&(identical(other.tunEnable, tunEnable) || other.tunEnable == tunEnable)&&(identical(other.isStart, isStart) || other.isStart == isStart)&&(identical(other.locale, locale) || other.locale == locale)&&(identical(other.brightness, brightness) || other.brightness == brightness)&&const DeepCollectionEquality().equals(other._groups, _groups)&&const DeepCollectionEquality().equals(other._selectedMap, _selectedMap));
}
@override
int get hashCode => Object.hash(runtimeType,mode,port,autoLaunch,systemProxy,tunEnable,isStart,locale,brightness,const DeepCollectionEquality().hash(_groups),const DeepCollectionEquality().hash(_selectedMap),showTrayTitle);
int get hashCode => Object.hash(runtimeType,mode,port,autoLaunch,systemProxy,tunEnable,isStart,locale,brightness,const DeepCollectionEquality().hash(_groups),const DeepCollectionEquality().hash(_selectedMap));
@override
String toString() {
return 'TrayState(mode: $mode, port: $port, autoLaunch: $autoLaunch, systemProxy: $systemProxy, tunEnable: $tunEnable, isStart: $isStart, locale: $locale, brightness: $brightness, groups: $groups, selectedMap: $selectedMap, showTrayTitle: $showTrayTitle)';
return 'TrayState(mode: $mode, port: $port, autoLaunch: $autoLaunch, systemProxy: $systemProxy, tunEnable: $tunEnable, isStart: $isStart, locale: $locale, brightness: $brightness, groups: $groups, selectedMap: $selectedMap)';
}
@@ -2144,7 +2142,7 @@ abstract mixin class _$TrayStateCopyWith<$Res> implements $TrayStateCopyWith<$Re
factory _$TrayStateCopyWith(_TrayState value, $Res Function(_TrayState) _then) = __$TrayStateCopyWithImpl;
@override @useResult
$Res call({
Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, Map<String, String> selectedMap, bool showTrayTitle
Mode mode, int port, bool autoLaunch, bool systemProxy, bool tunEnable, bool isStart, String? locale, Brightness? brightness, List<Group> groups, SelectedMap selectedMap
});
@@ -2161,7 +2159,7 @@ class __$TrayStateCopyWithImpl<$Res>
/// Create a copy of TrayState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? mode = null,Object? port = null,Object? autoLaunch = null,Object? systemProxy = null,Object? tunEnable = null,Object? isStart = null,Object? locale = freezed,Object? brightness = freezed,Object? groups = null,Object? selectedMap = null,Object? showTrayTitle = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? mode = null,Object? port = null,Object? autoLaunch = null,Object? systemProxy = null,Object? tunEnable = null,Object? isStart = null,Object? locale = freezed,Object? brightness = freezed,Object? groups = null,Object? selectedMap = null,}) {
return _then(_TrayState(
mode: null == mode ? _self.mode : mode // ignore: cast_nullable_to_non_nullable
as Mode,port: null == port ? _self.port : port // ignore: cast_nullable_to_non_nullable
@@ -2173,292 +2171,13 @@ as bool,locale: freezed == locale ? _self.locale : locale // ignore: cast_nullab
as String?,brightness: freezed == brightness ? _self.brightness : brightness // ignore: cast_nullable_to_non_nullable
as Brightness?,groups: null == groups ? _self._groups : groups // ignore: cast_nullable_to_non_nullable
as List<Group>,selectedMap: null == selectedMap ? _self._selectedMap : selectedMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>,showTrayTitle: null == showTrayTitle ? _self.showTrayTitle : showTrayTitle // ignore: cast_nullable_to_non_nullable
as bool,
as SelectedMap,
));
}
}
/// @nodoc
mixin _$TrayTitleState {
Traffic get traffic; bool get showTrayTitle;
/// Create a copy of TrayTitleState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$TrayTitleStateCopyWith<TrayTitleState> get copyWith => _$TrayTitleStateCopyWithImpl<TrayTitleState>(this as TrayTitleState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is TrayTitleState&&(identical(other.traffic, traffic) || other.traffic == traffic)&&(identical(other.showTrayTitle, showTrayTitle) || other.showTrayTitle == showTrayTitle));
}
@override
int get hashCode => Object.hash(runtimeType,traffic,showTrayTitle);
@override
String toString() {
return 'TrayTitleState(traffic: $traffic, showTrayTitle: $showTrayTitle)';
}
}
/// @nodoc
abstract mixin class $TrayTitleStateCopyWith<$Res> {
factory $TrayTitleStateCopyWith(TrayTitleState value, $Res Function(TrayTitleState) _then) = _$TrayTitleStateCopyWithImpl;
@useResult
$Res call({
Traffic traffic, bool showTrayTitle
});
$TrafficCopyWith<$Res> get traffic;
}
/// @nodoc
class _$TrayTitleStateCopyWithImpl<$Res>
implements $TrayTitleStateCopyWith<$Res> {
_$TrayTitleStateCopyWithImpl(this._self, this._then);
final TrayTitleState _self;
final $Res Function(TrayTitleState) _then;
/// Create a copy of TrayTitleState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? traffic = null,Object? showTrayTitle = null,}) {
return _then(_self.copyWith(
traffic: null == traffic ? _self.traffic : traffic // ignore: cast_nullable_to_non_nullable
as Traffic,showTrayTitle: null == showTrayTitle ? _self.showTrayTitle : showTrayTitle // ignore: cast_nullable_to_non_nullable
as bool,
));
}
/// Create a copy of TrayTitleState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TrafficCopyWith<$Res> get traffic {
return $TrafficCopyWith<$Res>(_self.traffic, (value) {
return _then(_self.copyWith(traffic: value));
});
}
}
/// Adds pattern-matching-related methods to [TrayTitleState].
extension TrayTitleStatePatterns on TrayTitleState {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _TrayTitleState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _TrayTitleState() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _TrayTitleState value) $default,){
final _that = this;
switch (_that) {
case _TrayTitleState():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _TrayTitleState value)? $default,){
final _that = this;
switch (_that) {
case _TrayTitleState() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( Traffic traffic, bool showTrayTitle)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _TrayTitleState() when $default != null:
return $default(_that.traffic,_that.showTrayTitle);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( Traffic traffic, bool showTrayTitle) $default,) {final _that = this;
switch (_that) {
case _TrayTitleState():
return $default(_that.traffic,_that.showTrayTitle);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( Traffic traffic, bool showTrayTitle)? $default,) {final _that = this;
switch (_that) {
case _TrayTitleState() when $default != null:
return $default(_that.traffic,_that.showTrayTitle);case _:
return null;
}
}
}
/// @nodoc
class _TrayTitleState implements TrayTitleState {
const _TrayTitleState({required this.traffic, required this.showTrayTitle});
@override final Traffic traffic;
@override final bool showTrayTitle;
/// Create a copy of TrayTitleState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$TrayTitleStateCopyWith<_TrayTitleState> get copyWith => __$TrayTitleStateCopyWithImpl<_TrayTitleState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _TrayTitleState&&(identical(other.traffic, traffic) || other.traffic == traffic)&&(identical(other.showTrayTitle, showTrayTitle) || other.showTrayTitle == showTrayTitle));
}
@override
int get hashCode => Object.hash(runtimeType,traffic,showTrayTitle);
@override
String toString() {
return 'TrayTitleState(traffic: $traffic, showTrayTitle: $showTrayTitle)';
}
}
/// @nodoc
abstract mixin class _$TrayTitleStateCopyWith<$Res> implements $TrayTitleStateCopyWith<$Res> {
factory _$TrayTitleStateCopyWith(_TrayTitleState value, $Res Function(_TrayTitleState) _then) = __$TrayTitleStateCopyWithImpl;
@override @useResult
$Res call({
Traffic traffic, bool showTrayTitle
});
@override $TrafficCopyWith<$Res> get traffic;
}
/// @nodoc
class __$TrayTitleStateCopyWithImpl<$Res>
implements _$TrayTitleStateCopyWith<$Res> {
__$TrayTitleStateCopyWithImpl(this._self, this._then);
final _TrayTitleState _self;
final $Res Function(_TrayTitleState) _then;
/// Create a copy of TrayTitleState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? traffic = null,Object? showTrayTitle = null,}) {
return _then(_TrayTitleState(
traffic: null == traffic ? _self.traffic : traffic // ignore: cast_nullable_to_non_nullable
as Traffic,showTrayTitle: null == showTrayTitle ? _self.showTrayTitle : showTrayTitle // ignore: cast_nullable_to_non_nullable
as bool,
));
}
/// Create a copy of TrayTitleState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$TrafficCopyWith<$Res> get traffic {
return $TrafficCopyWith<$Res>(_self.traffic, (value) {
return _then(_self.copyWith(traffic: value));
});
}
}
/// @nodoc
mixin _$NavigationState {

View File

@@ -12,6 +12,8 @@ import 'clash_config.dart';
part 'generated/profile.freezed.dart';
part 'generated/profile.g.dart';
typedef SelectedMap = Map<String, String>;
@freezed
abstract class SubscriptionInfo with _$SubscriptionInfo {
const factory SubscriptionInfo({
@@ -52,7 +54,7 @@ abstract class Profile with _$Profile {
required Duration autoUpdateDuration,
SubscriptionInfo? subscriptionInfo,
@Default(true) bool autoUpdate,
@Default({}) Map<String, String> selectedMap,
@Default({}) SelectedMap selectedMap,
@Default({}) Set<String> unfoldSet,
@Default(OverrideData()) OverrideData overrideData,
@Default(Overwrite()) Overwrite overwrite,

View File

@@ -70,19 +70,10 @@ abstract class TrayState with _$TrayState {
required String? locale,
required Brightness? brightness,
required List<Group> groups,
required Map<String, String> selectedMap,
required bool showTrayTitle,
required SelectedMap selectedMap,
}) = _TrayState;
}
@freezed
abstract class TrayTitleState with _$TrayTitleState {
const factory TrayTitleState({
required Traffic traffic,
required bool showTrayTitle,
}) = _TrayTitleState;
}
@freezed
abstract class NavigationState with _$NavigationState {
const factory NavigationState({
@@ -282,7 +273,7 @@ extension SetupStateExt on SetupState {
return true;
}
if (overwriteType != lastSetupState.overwriteType) {
if (!ruleListEquality.equals(addedRules, lastSetupState.addedRules) ||
if (!ruleEquality.equals(addedRules, lastSetupState.addedRules) ||
scriptContent != lastSetupState.scriptContent) {
return true;
}
@@ -293,7 +284,7 @@ extension SetupStateExt on SetupState {
}
}
if (overwriteType == OverwriteType.standard) {
if (!ruleListEquality.equals(addedRules, lastSetupState.addedRules)) {
if (!ruleEquality.equals(addedRules, lastSetupState.addedRules)) {
return true;
}
}

View File

@@ -171,12 +171,10 @@ class _EditorPageState extends ConsumerState<EditorPage> {
child: CommonScaffold(
appBar: AppBar(
title: TextField(
maxLength: 20,
enabled: widget.titleEditable,
controller: _titleController,
decoration: InputDecoration(
border: _NoInputBorder(),
counter: SizedBox(),
hintText: appLocalizations.unnamed,
),
style: context.textTheme.titleLarge,
@@ -207,8 +205,7 @@ class _EditorPageState extends ConsumerState<EditorPage> {
targetBuilder: (open) {
return IconButton(
onPressed: () {
final isMobile = ref.read(isMobileViewProvider);
open(offset: Offset(0, isMobile ? 0 : 20));
open(offset: Offset(0, 0));
},
icon: const Icon(Icons.more_vert),
);

View File

@@ -407,63 +407,16 @@ class _CoreStatus extends _$CoreStatus with AutoDisposeNotifierMixin {
}
@riverpod
class Query extends _$Query with AutoDisposeNotifierMixin {
late final QueryTag _tag;
class QueryMap extends _$QueryMap with AutoDisposeNotifierMixin {
@override
String build(QueryTag tag) {
_tag = tag;
return globalState.appState.queryMap[tag] ?? '';
}
Map<QueryTag, String> build() => globalState.appState.queryMap;
@override
onUpdate(value) {
final newMap = Map<QueryTag, String>.from(globalState.appState.queryMap)
..[_tag] = value;
globalState.appState = globalState.appState.copyWith(queryMap: newMap);
}
}
@riverpod
class SelectedItems extends _$SelectedItems with AutoDisposeNotifierMixin {
late final String _key;
@override
Set<String> build(String key) {
_key = key;
return globalState.appState.selectedItemsMap[_key] ?? {};
}
@override
onUpdate(value) {
final newMap = globalState.appState.selectedItemsMap.copyWitUpdate(
key,
value.isEmpty ? null : value,
);
globalState.appState = globalState.appState.copyWith(
selectedItemsMap: newMap,
);
}
}
@riverpod
class SelectedItem extends _$SelectedItem with AutoDisposeNotifierMixin {
late final String _key;
@override
String build(String key) {
_key = key;
return globalState.appState.selectedItemMap[_key] ?? '';
}
@override
onUpdate(value) {
final newMap = globalState.appState.selectedItemMap.copyWitUpdate(
key,
value.isEmpty ? null : value,
);
globalState.appState = globalState.appState.copyWith(
selectedItemMap: newMap,
);
globalState.appState = globalState.appState.copyWith(queryMap: value);
}
void updateQuery(QueryTag tag, String value) {
this.value = Map.from(globalState.appState.queryMap)..[tag] = value;
}
}

View File

@@ -50,6 +50,10 @@ class VpnSetting extends _$VpnSetting with AutoDisposeNotifierMixin {
onUpdate(value) {
globalState.config = globalState.config.copyWith(vpnProps: value);
}
void updateState(VpnProps Function(VpnProps state) builder) {
value = builder(state);
}
}
@riverpod
@@ -245,7 +249,7 @@ class Scripts extends _$Scripts with AutoDisposeNotifierMixin {
void del(String id) {
final list = List<Script>.from(state);
final index = list.indexWhere((item) => item.id == id);
final index = list.indexWhere((item) => item.label == id);
if (index != -1) {
list.removeAt(index);
}

View File

@@ -1437,278 +1437,52 @@ abstract class _$CoreStatus extends $Notifier<CoreStatus> {
}
}
@ProviderFor(Query)
const queryProvider = QueryFamily._();
@ProviderFor(QueryMap)
const queryMapProvider = QueryMapProvider._();
final class QueryProvider extends $NotifierProvider<Query, String> {
const QueryProvider._({
required QueryFamily super.from,
required QueryTag super.argument,
}) : super(
retry: null,
name: r'queryProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
final class QueryMapProvider
extends $NotifierProvider<QueryMap, Map<QueryTag, String>> {
const QueryMapProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'queryMapProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$queryHash();
@override
String toString() {
return r'queryProvider'
''
'($argument)';
}
String debugGetCreateSourceHash() => _$queryMapHash();
@$internal
@override
Query create() => Query();
QueryMap create() => QueryMap();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(String value) {
Override overrideWithValue(Map<QueryTag, String> value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<String>(value),
providerOverride: $SyncValueProvider<Map<QueryTag, String>>(value),
);
}
@override
bool operator ==(Object other) {
return other is QueryProvider && other.argument == argument;
}
@override
int get hashCode {
return argument.hashCode;
}
}
String _$queryHash() => r'da8d34ef86df1366e8607df2ef9155cc9473c959';
String _$queryMapHash() => r'f64a1bf5fcd4f85986d8ba3c956e397abc4f2d5d';
final class QueryFamily extends $Family
with $ClassFamilyOverride<Query, String, String, String, QueryTag> {
const QueryFamily._()
: super(
retry: null,
name: r'queryProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
QueryProvider call(QueryTag tag) =>
QueryProvider._(argument: tag, from: this);
@override
String toString() => r'queryProvider';
}
abstract class _$Query extends $Notifier<String> {
late final _$args = ref.$arg as QueryTag;
QueryTag get tag => _$args;
String build(QueryTag tag);
abstract class _$QueryMap extends $Notifier<Map<QueryTag, String>> {
Map<QueryTag, String> build();
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<String, String>;
final created = build();
final ref = this.ref as $Ref<Map<QueryTag, String>, Map<QueryTag, String>>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<String, String>,
String,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}
@ProviderFor(SelectedItems)
const selectedItemsProvider = SelectedItemsFamily._();
final class SelectedItemsProvider
extends $NotifierProvider<SelectedItems, Set<String>> {
const SelectedItemsProvider._({
required SelectedItemsFamily super.from,
required String super.argument,
}) : super(
retry: null,
name: r'selectedItemsProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$selectedItemsHash();
@override
String toString() {
return r'selectedItemsProvider'
''
'($argument)';
}
@$internal
@override
SelectedItems create() => SelectedItems();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(Set<String> value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<Set<String>>(value),
);
}
@override
bool operator ==(Object other) {
return other is SelectedItemsProvider && other.argument == argument;
}
@override
int get hashCode {
return argument.hashCode;
}
}
String _$selectedItemsHash() => r'9a13ee78fdc100c8708af9de46e2861652d68e77';
final class SelectedItemsFamily extends $Family
with
$ClassFamilyOverride<
SelectedItems,
Set<String>,
Set<String>,
Set<String>,
String
> {
const SelectedItemsFamily._()
: super(
retry: null,
name: r'selectedItemsProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
SelectedItemsProvider call(String key) =>
SelectedItemsProvider._(argument: key, from: this);
@override
String toString() => r'selectedItemsProvider';
}
abstract class _$SelectedItems extends $Notifier<Set<String>> {
late final _$args = ref.$arg as String;
String get key => _$args;
Set<String> build(String key);
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<Set<String>, Set<String>>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<Set<String>, Set<String>>,
Set<String>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}
@ProviderFor(SelectedItem)
const selectedItemProvider = SelectedItemFamily._();
final class SelectedItemProvider
extends $NotifierProvider<SelectedItem, String> {
const SelectedItemProvider._({
required SelectedItemFamily super.from,
required String super.argument,
}) : super(
retry: null,
name: r'selectedItemProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$selectedItemHash();
@override
String toString() {
return r'selectedItemProvider'
''
'($argument)';
}
@$internal
@override
SelectedItem create() => SelectedItem();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(String value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<String>(value),
);
}
@override
bool operator ==(Object other) {
return other is SelectedItemProvider && other.argument == argument;
}
@override
int get hashCode {
return argument.hashCode;
}
}
String _$selectedItemHash() => r'374202f309d7a786190706fb0a2ac4945de94213';
final class SelectedItemFamily extends $Family
with $ClassFamilyOverride<SelectedItem, String, String, String, String> {
const SelectedItemFamily._()
: super(
retry: null,
name: r'selectedItemProvider',
dependencies: null,
$allTransitiveDependencies: null,
isAutoDispose: true,
);
SelectedItemProvider call(String key) =>
SelectedItemProvider._(argument: key, from: this);
@override
String toString() => r'selectedItemProvider';
}
abstract class _$SelectedItem extends $Notifier<String> {
late final _$args = ref.$arg as String;
String get key => _$args;
String build(String key);
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<String, String>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<String, String>,
String,
AnyNotifier<Map<QueryTag, String>, Map<QueryTag, String>>,
Map<QueryTag, String>,
Object?,
Object?
>;

View File

@@ -146,7 +146,7 @@ final class VpnSettingProvider extends $NotifierProvider<VpnSetting, VpnProps> {
}
}
String _$vpnSettingHash() => r'e6fab5a735fe518f9d4e5619254b0cea0006f318';
String _$vpnSettingHash() => r'1dad4881ae7bcec76678585ac7b84f820b2ca92b';
abstract class _$VpnSetting extends $Notifier<VpnProps> {
VpnProps build();
@@ -622,7 +622,7 @@ final class ScriptsProvider extends $NotifierProvider<Scripts, List<Script>> {
}
}
String _$scriptsHash() => r'67dfdff76fc16b47c2300011afb5952a8857bad5';
String _$scriptsHash() => r'2880a30711a7c46392b1ccc95f2cabbaeb2808c3';
abstract class _$Scripts extends $Notifier<List<Script>> {
List<Script> build();

View File

@@ -310,48 +310,7 @@ final class TrayStateProvider
}
}
String _$trayStateHash() => r'f5057cc600a13dfc3bc7a45de7452febd18b2293';
@ProviderFor(trayTitleState)
const trayTitleStateProvider = TrayTitleStateProvider._();
final class TrayTitleStateProvider
extends $FunctionalProvider<TrayTitleState, TrayTitleState, TrayTitleState>
with $Provider<TrayTitleState> {
const TrayTitleStateProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'trayTitleStateProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$trayTitleStateHash();
@$internal
@override
$ProviderElement<TrayTitleState> $createElement($ProviderPointer pointer) =>
$ProviderElement(pointer);
@override
TrayTitleState create(Ref ref) {
return trayTitleState(ref);
}
/// {@macro riverpod.override_with_value}
Override overrideWithValue(TrayTitleState value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<TrayTitleState>(value),
);
}
}
String _$trayTitleStateHash() => r'5f868aaf70480b00bfdc2de18684ee646a93fd12';
String _$trayStateHash() => r'2237a7dbf8fd66a0618e3d9caf99667857e6fd4d';
@ProviderFor(vpnState)
const vpnStateProvider = VpnStateProvider._();
@@ -783,7 +742,7 @@ final class ProxiesListStateProvider
}
}
String _$proxiesListStateHash() => r'b16ad96516ece78f6cb22f558a0535000b784317';
String _$proxiesListStateHash() => r'32a748d651a6372b96931aae2100afc0529a83c9';
@ProviderFor(proxiesTabState)
const proxiesTabStateProvider = ProxiesTabStateProvider._();
@@ -825,7 +784,7 @@ final class ProxiesTabStateProvider
}
}
String _$proxiesTabStateHash() => r'143b106d74da618327cbac48af15078efd8cabee';
String _$proxiesTabStateHash() => r'510372c724217a41788129bc75fa1c4ec37c73c0';
@ProviderFor(isStart)
const isStartProvider = IsStartProvider._();
@@ -1361,13 +1320,8 @@ final class GetDelayFamily extends $Family
const selectedMapProvider = SelectedMapProvider._();
final class SelectedMapProvider
extends
$FunctionalProvider<
Map<String, String>,
Map<String, String>,
Map<String, String>
>
with $Provider<Map<String, String>> {
extends $FunctionalProvider<SelectedMap, SelectedMap, SelectedMap>
with $Provider<SelectedMap> {
const SelectedMapProvider._()
: super(
from: null,
@@ -1384,25 +1338,24 @@ final class SelectedMapProvider
@$internal
@override
$ProviderElement<Map<String, String>> $createElement(
$ProviderPointer pointer,
) => $ProviderElement(pointer);
$ProviderElement<SelectedMap> $createElement($ProviderPointer pointer) =>
$ProviderElement(pointer);
@override
Map<String, String> create(Ref ref) {
SelectedMap create(Ref ref) {
return selectedMap(ref);
}
/// {@macro riverpod.override_with_value}
Override overrideWithValue(Map<String, String> value) {
Override overrideWithValue(SelectedMap value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<Map<String, String>>(value),
providerOverride: $SyncValueProvider<SelectedMap>(value),
);
}
}
String _$selectedMapHash() => r'd4438d8d87d0c7ec7d9c5d02f577cdba6ba2a785';
String _$selectedMapHash() => r'0d7a3610d9005e74e1a88595d7e22897dc8240a5';
@ProviderFor(unfoldSet)
const unfoldSetProvider = UnfoldSetProvider._();
@@ -2403,6 +2356,58 @@ final class AndroidStateProvider
String _$androidStateHash() => r'9f527fbb00c7e0c177f023e77d2f23458543d72f';
@ProviderFor(Query)
const queryProvider = QueryProvider._();
final class QueryProvider extends $NotifierProvider<Query, String> {
const QueryProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'queryProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$queryHash();
@$internal
@override
Query create() => Query();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(String value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<String>(value),
);
}
}
String _$queryHash() => r'e99b2a2439872f88f09fee8d63f0cc7fb4852186';
abstract class _$Query extends $Notifier<String> {
String build();
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<String, String>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<String, String>,
String,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}
@ProviderFor(overlayTopOffset)
const overlayTopOffsetProvider = OverlayTopOffsetProvider._();
@@ -2444,6 +2449,59 @@ final class OverlayTopOffsetProvider
String _$overlayTopOffsetHash() => r'b2462f67acbd88b7a881dfe4c6353e68ba49961d';
@ProviderFor(SelectedIds)
const selectedIdsProvider = SelectedIdsProvider._();
final class SelectedIdsProvider
extends $NotifierProvider<SelectedIds, Set<String>> {
const SelectedIdsProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'selectedIdsProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$selectedIdsHash();
@$internal
@override
SelectedIds create() => SelectedIds();
/// {@macro riverpod.override_with_value}
Override overrideWithValue(Set<String> value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<Set<String>>(value),
);
}
}
String _$selectedIdsHash() => r'c22de28608456be15d03cc7911274ea215caf952';
abstract class _$SelectedIds extends $Notifier<Set<String>> {
Set<String> build();
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<Set<String>, Set<String>>;
final element =
ref.element
as $ClassProviderElement<
AnyNotifier<Set<String>, Set<String>>,
Set<String>,
Object?,
Object?
>;
element.handleValue(ref, created);
}
}
@ProviderFor(profile)
const profileProvider = ProfileFamily._();

View File

@@ -143,50 +143,28 @@ ProxyState proxyState(Ref ref) {
@riverpod
TrayState trayState(Ref ref) {
final isStart = ref.watch(runTimeProvider.select((state) => state != null));
final systemProxy = ref.watch(
networkSettingProvider.select((state) => state.systemProxy),
);
final clashConfigVm3 = ref.watch(
patchClashConfigProvider.select(
(state) => VM3(a: state.mode, b: state.mixedPort, c: state.tun.enable),
),
);
final appSettingVm3 = ref.watch(
appSettingProvider.select(
(state) =>
VM3(a: state.autoLaunch, b: state.locale, c: state.showTrayTitle),
),
);
final networkProps = ref.watch(networkSettingProvider);
final clashConfig = ref.watch(patchClashConfigProvider);
final appSetting = ref.watch(appSettingProvider);
final groups = ref.watch(currentGroupsStateProvider).value;
final brightness = ref.watch(systemBrightnessProvider);
final selectedMap = ref.watch(selectedMapProvider);
return TrayState(
mode: clashConfigVm3.a,
port: clashConfigVm3.b,
autoLaunch: appSettingVm3.a,
systemProxy: systemProxy,
tunEnable: clashConfigVm3.c,
mode: clashConfig.mode,
port: clashConfig.mixedPort,
autoLaunch: appSetting.autoLaunch,
systemProxy: networkProps.systemProxy,
tunEnable: clashConfig.tun.enable,
isStart: isStart,
locale: appSettingVm3.b,
locale: appSetting.locale,
brightness: brightness,
groups: groups,
selectedMap: selectedMap,
showTrayTitle: appSettingVm3.c,
);
}
@riverpod
TrayTitleState trayTitleState(Ref ref) {
final showTrayTitle = ref.watch(
appSettingProvider.select((state) => state.showTrayTitle),
);
final traffic = ref.watch(
trafficsProvider.select((state) => state.list.safeLast(Traffic())),
);
return TrayTitleState(showTrayTitle: showTrayTitle, traffic: traffic);
}
@riverpod
VpnState vpnState(Ref ref) {
final vpnProps = ref.watch(vpnSettingProvider);
@@ -295,7 +273,9 @@ GroupsState filterGroupsState(Ref ref, String query) {
@riverpod
ProxiesListState proxiesListState(Ref ref) {
final query = ref.watch(queryProvider(QueryTag.proxies));
final query = ref.watch(
queryMapProvider.select((state) => state[QueryTag.proxies] ?? ''),
);
final currentGroups = ref.watch(filterGroupsStateProvider(query));
final currentUnfoldSet = ref.watch(unfoldSetProvider);
final cardType = ref.watch(
@@ -313,7 +293,9 @@ ProxiesListState proxiesListState(Ref ref) {
@riverpod
ProxiesTabState proxiesTabState(Ref ref) {
final query = ref.watch(queryProvider(QueryTag.proxies));
final query = ref.watch(
queryMapProvider.select((state) => state[QueryTag.proxies] ?? ''),
);
final currentGroups = ref.watch(filterGroupsStateProvider(query));
final currentGroupName = ref.watch(
currentProfileProvider.select((state) => state?.currentGroupName),
@@ -448,7 +430,7 @@ int? getDelay(Ref ref, {required String proxyName, String? testUrl}) {
}
@riverpod
Map<String, String> selectedMap(Ref ref) {
SelectedMap selectedMap(Ref ref) {
final selectedMap = ref.watch(
currentProfileProvider.select((state) => state?.selectedMap ?? {}),
);
@@ -666,6 +648,12 @@ AndroidState androidState(Ref ref) {
);
}
@riverpod
class Query extends _$Query with AutoDisposeNotifierMixin {
@override
String build() => '';
}
@riverpod
double overlayTopOffset(Ref ref) {
final isMobileView = ref.watch(isMobileViewProvider);
@@ -678,6 +666,12 @@ double overlayTopOffset(Ref ref) {
return kToolbarHeight + top;
}
@riverpod
class SelectedIds extends _$SelectedIds with AutoDisposeNotifierMixin {
@override
Set<String> build() => {};
}
@riverpod
Profile? profile(Ref ref, String profileId) {
return ref.watch(

View File

@@ -74,12 +74,12 @@ class AboutView extends StatelessWidget {
List<Widget> _buildContributorsSection() {
const contributors = [
Contributor(
avatar: 'assets/images/avatar/june2.jpg',
avatar: 'assets/images/avatars/june2.jpg',
name: 'June2',
link: 'https://t.me/Jibadong',
),
Contributor(
avatar: 'assets/images/avatar/arue.jpg',
avatar: 'assets/images/avatars/arue.jpg',
name: 'Arue',
link: 'https://t.me/xrcm6868',
),

View File

@@ -340,13 +340,15 @@ class _AccessViewState extends ConsumerState<AccessView> {
}
void _onSearch(String value) {
ref.read(queryProvider(QueryTag.access).notifier).value = value;
ref.read(queryProvider.notifier).value = value;
_pinedList = null;
}
@override
Widget build(BuildContext context) {
final query = ref.watch(queryProvider(QueryTag.access));
final query = ref.watch(
queryProvider.select((state) => state.toLowerCase()),
);
final packages = ref.watch(packagesProvider);
final accessControl = ref.watch(accessControlStateProvider);
if (_isInit) {

View File

@@ -15,13 +15,9 @@ class AddedRulesView extends ConsumerStatefulWidget {
}
class _AddedRulesViewState extends ConsumerState<AddedRulesView> {
final _key = utils.id;
late final List<Rule> _originRules;
@override
void initState() {
super.initState();
_originRules = List<Rule>.from(ref.read(rulesProvider));
}
@override
@@ -40,7 +36,7 @@ class _AddedRulesViewState extends ConsumerState<AddedRulesView> {
}
void _handleSelected(String ruleId) {
ref.read(selectedItemsProvider(_key).notifier).update((selectedRules) {
ref.read(selectedIdsProvider.notifier).update((selectedRules) {
final newSelectedRules = Set<String>.from(selectedRules)
..addOrRemove(ruleId);
return newSelectedRules;
@@ -49,7 +45,7 @@ class _AddedRulesViewState extends ConsumerState<AddedRulesView> {
void _handleSelectAll() {
final ids = ref.read(rulesProvider).map((item) => item.id).toSet();
ref.read(selectedItemsProvider(_key).notifier).update((selected) {
ref.read(selectedIdsProvider.notifier).update((selected) {
return selected.containsAll(ids) ? {} : ids;
});
}
@@ -64,109 +60,81 @@ class _AddedRulesViewState extends ConsumerState<AddedRulesView> {
if (res != true) {
return;
}
final selectedRules = ref.read(selectedItemsProvider(_key));
final selectedRules = ref.read(selectedIdsProvider);
ref.read(rulesProvider.notifier).update((rules) {
final newRules = List<Rule>.from(
rules.where((item) => !selectedRules.contains(item.id)),
);
return newRules;
});
ref.read(selectedItemsProvider(_key).notifier).value = {};
}
Future<void> _handleReset() async {
final res = await globalState.showMessage(
message: TextSpan(text: appLocalizations.resetPageChangesTip),
);
if (res != true) {
return;
}
ref.read(rulesProvider.notifier).value = _originRules;
ref.read(selectedIdsProvider.notifier).value = {};
}
@override
Widget build(BuildContext context) {
final rules = ref.watch(rulesProvider);
final selectedRules = ref.watch(selectedItemsProvider(_key));
return CommonPopScope(
onPop: (_) {
if (selectedRules.isNotEmpty) {
ref.read(selectedItemsProvider(_key).notifier).value = {};
return false;
}
Navigator.of(context).pop();
return false;
},
child: BaseScaffold(
title: appLocalizations.addedRules,
actions: [
if (selectedRules.isNotEmpty) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: _handleDelete,
icon: Icon(Icons.delete),
),
final selectedRules = ref.watch(selectedIdsProvider);
return BaseScaffold(
title: appLocalizations.addedRules,
actions: [
if (selectedRules.isNotEmpty) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: _handleDelete,
icon: Icon(Icons.delete),
),
SizedBox(width: 2),
] else if (!ruleListEquality.equals(rules, _originRules)) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: _handleReset,
icon: const Icon(Icons.replay),
),
),
SizedBox(width: 2),
],
CommonMinFilledButtonTheme(
child: selectedRules.isNotEmpty
? FilledButton(
onPressed: _handleSelectAll,
child: Text(appLocalizations.selectAll),
)
: FilledButton.tonal(
onPressed: () {
_handleAddOrUpdate();
},
child: Text(appLocalizations.add),
),
),
SizedBox(width: 8),
SizedBox(width: 2),
],
body: rules.isEmpty
? NullStatus(
label: appLocalizations.nullTip(appLocalizations.rule),
illustration: RuleEmptyIllustration(),
)
: ReorderableList(
padding: EdgeInsets.symmetric(vertical: 16),
itemBuilder: (context, index) {
final rule = rules[index];
return ReorderableDelayedDragStartListener(
key: ObjectKey(rule),
index: index,
child: RuleItem(
isEditing: selectedRules.isNotEmpty,
rule: rule,
isSelected: selectedRules.contains(rule.id),
onSelected: _handleSelected,
onEdit: (Rule rule) {
_handleAddOrUpdate(rule);
},
),
);
},
itemCount: rules.length,
onReorder: (int oldIndex, int newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final newRules = List<Rule>.from(rules);
final item = newRules.removeAt(oldIndex);
newRules.insert(newIndex, item);
ref.read(rulesProvider.notifier).value = newRules;
},
),
),
CommonMinFilledButtonTheme(
child: selectedRules.isNotEmpty
? FilledButton(
onPressed: _handleSelectAll,
child: Text(appLocalizations.selectAll),
)
: FilledButton.tonal(
onPressed: () {
_handleAddOrUpdate();
},
child: Text(appLocalizations.add),
),
),
SizedBox(width: 8),
],
body: rules.isEmpty
? NullStatus(
label: appLocalizations.nullTip(appLocalizations.rule),
illustration: RuleEmptyIllustration(),
)
: ReorderableList(
padding: EdgeInsets.all(16),
itemBuilder: (context, index) {
final rule = rules[index];
return ReorderableDelayedDragStartListener(
key: ObjectKey(rule),
index: index,
child: RuleItem(
isEditing: selectedRules.isNotEmpty,
rule: rule,
isSelected: selectedRules.contains(rule.id),
onSelected: _handleSelected,
onEdit: (Rule rule) {
_handleAddOrUpdate(rule);
},
),
);
},
itemCount: rules.length,
onReorder: (int oldIndex, int newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final newRules = List<Rule>.from(rules);
final item = newRules.removeAt(oldIndex);
newRules.insert(newIndex, item);
ref.read(rulesProvider.notifier).value = newRules;
},
),
);
}
}

View File

@@ -210,91 +210,110 @@ class FakeIpRangeItem extends ConsumerWidget {
}
}
class FakeIpFilterItem extends ConsumerWidget {
class FakeIpFilterItem extends StatelessWidget {
const FakeIpFilterItem({super.key});
@override
Widget build(BuildContext context, ref) {
final fakeIpFilter = ref.watch(
patchClashConfigProvider.select((state) => state.dns.fakeIpFilter),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.fakeipFilter),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: appLocalizations.fakeipFilter,
items: fakeIpFilter,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final fakeIpFilter = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.fakeIpFilter,
),
);
return ListInputPage(
title: appLocalizations.fakeipFilter,
items: fakeIpFilter,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) =>
state.copyWith.dns(fakeIpFilter: List.from(items)),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns(fakeIpFilter: List.from(items)),
);
},
),
);
}
}
class DefaultNameserverItem extends ConsumerWidget {
class DefaultNameserverItem extends StatelessWidget {
const DefaultNameserverItem({super.key});
@override
Widget build(BuildContext context, ref) {
final defaultNameserver = ref.watch(
patchClashConfigProvider.select((state) => state.dns.defaultNameserver),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.defaultNameserver),
subtitle: Text(appLocalizations.defaultNameserverDesc),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: appLocalizations.defaultNameserver,
items: defaultNameserver,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final defaultNameserver = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.defaultNameserver,
),
);
return ListInputPage(
title: appLocalizations.defaultNameserver,
items: defaultNameserver,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns(
defaultNameserver: List.from(items),
),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) =>
state.copyWith.dns(defaultNameserver: List.from(items)),
);
},
),
);
}
}
class NameserverItem extends ConsumerWidget {
class NameserverItem extends StatelessWidget {
const NameserverItem({super.key});
@override
Widget build(BuildContext context, ref) {
final nameserver = ref.watch(
patchClashConfigProvider.select((state) => state.dns.nameserver),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.nameserver),
subtitle: Text(appLocalizations.nameserverDesc),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: appLocalizations.nameserver,
items: nameserver,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final nameserver = ref.watch(
patchClashConfigProvider.select((state) => state.dns.nameserver),
);
return ListInputPage(
title: appLocalizations.nameserver,
items: nameserver,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) =>
state.copyWith.dns(nameserver: List.from(items)),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns(nameserver: List.from(items)),
);
},
),
);
}
@@ -346,95 +365,110 @@ class UseSystemHostsItem extends ConsumerWidget {
}
}
class NameserverPolicyItem extends ConsumerWidget {
class NameserverPolicyItem extends StatelessWidget {
const NameserverPolicyItem({super.key});
@override
Widget build(BuildContext context, ref) {
final nameserverPolicy = ref.watch(
patchClashConfigProvider.select((state) => state.dns.nameserverPolicy),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.nameserverPolicy),
subtitle: Text(appLocalizations.nameserverPolicyDesc),
delegate: OpenDelegate(
blur: false,
widget: MapInputPage(
title: appLocalizations.nameserverPolicy,
map: nameserverPolicy,
titleBuilder: (item) => Text(item.key),
subtitleBuilder: (item) => Text(item.value),
widget: Consumer(
builder: (_, ref, _) {
final nameserverPolicy = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.nameserverPolicy,
),
);
return MapInputPage(
title: appLocalizations.nameserverPolicy,
map: nameserverPolicy,
titleBuilder: (item) => Text(item.key),
subtitleBuilder: (item) => Text(item.value),
onChange: (value) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns(nameserverPolicy: value),
);
},
);
},
),
onChanged: (value) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns(nameserverPolicy: value),
);
},
),
);
}
}
class ProxyServerNameserverItem extends ConsumerWidget {
class ProxyServerNameserverItem extends StatelessWidget {
const ProxyServerNameserverItem({super.key});
@override
Widget build(BuildContext context, ref) {
final proxyServerNameserver = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.proxyServerNameserver,
),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.proxyNameserver),
subtitle: Text(appLocalizations.proxyNameserverDesc),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: appLocalizations.proxyNameserver,
items: proxyServerNameserver,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final proxyServerNameserver = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.proxyServerNameserver,
),
);
return ListInputPage(
title: appLocalizations.proxyNameserver,
items: proxyServerNameserver,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns(
proxyServerNameserver: List.from(items),
),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) =>
state.copyWith.dns(proxyServerNameserver: List.from(items)),
);
},
),
);
}
}
class FallbackItem extends ConsumerWidget {
class FallbackItem extends StatelessWidget {
const FallbackItem({super.key});
@override
Widget build(BuildContext context, ref) {
final fallback = ref.watch(
patchClashConfigProvider.select((state) => state.dns.fallback),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.fallback),
subtitle: Text(appLocalizations.fallbackDesc),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: appLocalizations.fallback,
items: fallback,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final fallback = ref.watch(
patchClashConfigProvider.select((state) => state.dns.fallback),
);
return ListInputPage(
title: appLocalizations.fallback,
items: fallback,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns(fallback: List.from(items)),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns(fallback: List.from(items)),
);
},
),
);
}
@@ -503,98 +537,112 @@ class GeoipCodeItem extends ConsumerWidget {
}
}
class GeositeItem extends ConsumerWidget {
class GeositeItem extends StatelessWidget {
const GeositeItem({super.key});
@override
Widget build(BuildContext context, ref) {
final geosite = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.fallbackFilter.geosite,
),
);
Widget build(BuildContext context) {
return ListItem.open(
title: const Text('Geosite'),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: 'Geosite',
items: geosite,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final geosite = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.fallbackFilter.geosite,
),
);
return ListInputPage(
title: 'Geosite',
items: geosite,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns.fallbackFilter(
geosite: List.from(items),
),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns.fallbackFilter(
geosite: List.from(items),
),
);
},
),
);
}
}
class IpcidrItem extends ConsumerWidget {
class IpcidrItem extends StatelessWidget {
const IpcidrItem({super.key});
@override
Widget build(BuildContext context, ref) {
final ipcidr = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.fallbackFilter.ipcidr,
),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.ipcidr),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: appLocalizations.ipcidr,
items: ipcidr,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final ipcidr = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.fallbackFilter.ipcidr,
),
);
return ListInputPage(
title: appLocalizations.ipcidr,
items: ipcidr,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns.fallbackFilter(
ipcidr: List.from(items),
),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) =>
state.copyWith.dns.fallbackFilter(ipcidr: List.from(items)),
);
},
),
);
}
}
class DomainItem extends ConsumerWidget {
class DomainItem extends StatelessWidget {
const DomainItem({super.key});
@override
Widget build(BuildContext context, ref) {
final domain = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.fallbackFilter.domain,
),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.domain),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: appLocalizations.domain,
items: domain,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final domain = ref.watch(
patchClashConfigProvider.select(
(state) => state.dns.fallbackFilter.domain,
),
);
return ListInputPage(
title: appLocalizations.domain,
items: domain,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.dns.fallbackFilter(
domain: List.from(items),
),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) =>
state.copyWith.dns.fallbackFilter(domain: List.from(items)),
);
},
),
);
}

View File

@@ -198,31 +198,35 @@ class PortItem extends ConsumerWidget {
}
}
class HostsItem extends ConsumerWidget {
class HostsItem extends StatelessWidget {
const HostsItem({super.key});
@override
Widget build(BuildContext context, ref) {
final hosts = ref.watch(
patchClashConfigProvider.select((state) => state.hosts),
);
Widget build(BuildContext context) {
return ListItem.open(
leading: const Icon(Icons.view_list_outlined),
title: const Text('Hosts'),
subtitle: Text(appLocalizations.hostsDesc),
delegate: OpenDelegate(
blur: false,
widget: MapInputPage(
title: 'Hosts',
map: hosts,
titleBuilder: (item) => Text(item.key),
subtitleBuilder: (item) => Text(item.value),
widget: Consumer(
builder: (_, ref, _) {
final hosts = ref.watch(
patchClashConfigProvider.select((state) => state.hosts),
);
return MapInputPage(
title: 'Hosts',
map: hosts,
titleBuilder: (item) => Text(item.key),
subtitleBuilder: (item) => Text(item.value),
onChange: (value) {
ref
.read(patchClashConfigProvider.notifier)
.updateState((state) => state.copyWith(hosts: value));
},
);
},
),
onChanged: (value) {
ref
.read(patchClashConfigProvider.notifier)
.updateState((state) => state.copyWith(hosts: value));
},
),
);
}

View File

@@ -22,7 +22,7 @@ class VPNItem extends ConsumerWidget {
onChanged: (value) async {
ref
.read(vpnSettingProvider.notifier)
.update((state) => state.copyWith(enable: value));
.updateState((state) => state.copyWith(enable: value));
},
),
);
@@ -46,7 +46,7 @@ class TUNItem extends ConsumerWidget {
onChanged: (value) async {
ref
.read(patchClashConfigProvider.notifier)
.update((state) => state.copyWith.tun(enable: value));
.updateState((state) => state.copyWith.tun(enable: value));
},
),
);
@@ -69,7 +69,7 @@ class AllowBypassItem extends ConsumerWidget {
onChanged: (bool value) async {
ref
.read(vpnSettingProvider.notifier)
.update((state) => state.copyWith(allowBypass: value));
.updateState((state) => state.copyWith(allowBypass: value));
},
),
);
@@ -92,7 +92,7 @@ class VpnSystemProxyItem extends ConsumerWidget {
onChanged: (bool value) async {
ref
.read(vpnSettingProvider.notifier)
.update((state) => state.copyWith(systemProxy: value));
.updateState((state) => state.copyWith(systemProxy: value));
},
),
);
@@ -137,7 +137,7 @@ class Ipv6Item extends ConsumerWidget {
onChanged: (bool value) async {
ref
.read(vpnSettingProvider.notifier)
.update((state) => state.copyWith(ipv6: value));
.updateState((state) => state.copyWith(ipv6: value));
},
),
);
@@ -196,31 +196,35 @@ class TunStackItem extends ConsumerWidget {
}
}
class BypassDomainItem extends ConsumerWidget {
class BypassDomainItem extends StatelessWidget {
const BypassDomainItem({super.key});
@override
Widget build(BuildContext context, ref) {
final bypassDomain = ref.watch(
networkSettingProvider.select((state) => state.bypassDomain),
);
Widget build(BuildContext context) {
return ListItem.open(
title: Text(appLocalizations.bypassDomain),
subtitle: Text(appLocalizations.bypassDomainDesc),
delegate: OpenDelegate(
blur: false,
widget: ListInputPage(
title: appLocalizations.bypassDomain,
items: bypassDomain,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final bypassDomain = ref.watch(
networkSettingProvider.select((state) => state.bypassDomain),
);
return ListInputPage(
title: appLocalizations.bypassDomain,
items: bypassDomain,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(networkSettingProvider.notifier)
.updateState(
(state) => state.copyWith(bypassDomain: List.from(items)),
);
},
);
},
),
onChanged: (items) {
ref
.read(networkSettingProvider.notifier)
.updateState(
(state) => state.copyWith(bypassDomain: List.from(items)),
);
},
),
);
}
@@ -241,7 +245,7 @@ class DNSHijackingItem extends ConsumerWidget {
onChanged: (value) async {
ref
.read(vpnSettingProvider.notifier)
.update((state) => state.copyWith(dnsHijacking: value));
.updateState((state) => state.copyWith(dnsHijacking: value));
},
),
);
@@ -290,27 +294,34 @@ class RouteAddressItem extends ConsumerWidget {
if (bypassPrivate) {
return Container();
}
final routeAddress = ref.watch(
patchClashConfigProvider.select((state) => state.tun.routeAddress),
);
return ListItem.open(
title: Text(appLocalizations.routeAddress),
subtitle: Text(appLocalizations.routeAddressDesc),
delegate: OpenDelegate(
blur: false,
maxWidth: 360,
widget: ListInputPage(
title: appLocalizations.routeAddress,
items: routeAddress,
titleBuilder: (item) => Text(item),
widget: Consumer(
builder: (_, ref, _) {
final routeAddress = ref.watch(
patchClashConfigProvider.select(
(state) => state.tun.routeAddress,
),
);
return ListInputPage(
title: appLocalizations.routeAddress,
items: routeAddress,
titleBuilder: (item) => Text(item),
onChange: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) =>
state.copyWith.tun(routeAddress: List.from(items)),
);
},
);
},
),
onChanged: (items) {
ref
.read(patchClashConfigProvider.notifier)
.updateState(
(state) => state.copyWith.tun(routeAddress: List.from(items)),
);
},
),
);
}

View File

@@ -2,13 +2,13 @@ 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/pages/editor.dart';
import 'package:fl_clash/providers/app.dart';
import 'package:fl_clash/providers/config.dart';
import 'package:fl_clash/state.dart';
import 'package:fl_clash/widgets/card.dart';
import 'package:fl_clash/widgets/input.dart';
import 'package:fl_clash/widgets/list.dart';
import 'package:fl_clash/widgets/null_status.dart';
import 'package:fl_clash/widgets/pop_scope.dart';
import 'package:fl_clash/widgets/popup.dart';
import 'package:fl_clash/widgets/scaffold.dart';
import 'package:fl_clash/widgets/theme.dart';
import 'package:flutter/material.dart';
@@ -22,9 +22,7 @@ class ScriptsView extends ConsumerStatefulWidget {
}
class _ScriptsViewState extends ConsumerState<ScriptsView> {
final _key = utils.id;
Future<void> _handleDelScript(String id) async {
Future<void> _handleDelScript(String label) async {
final res = await globalState.showMessage(
message: TextSpan(
text: appLocalizations.deleteTip(appLocalizations.script),
@@ -33,43 +31,64 @@ class _ScriptsViewState extends ConsumerState<ScriptsView> {
if (res != true) {
return;
}
ref.read(scriptsProvider.notifier).del(id);
ref.read(selectedItemProvider(_key).notifier).value = '';
ref.read(scriptsProvider.notifier).del(label);
}
void _handleSelected(String id) {
ref.read(selectedItemProvider(_key).notifier).update((value) {
if (value == id) {
return '';
}
return id;
});
}
Widget _buildContent(List<Script> scripts, String selectedScriptId) {
if (scripts.isEmpty) {
return NullStatus(
illustration: ScriptEmptyIllustration(),
label: appLocalizations.nullTip(appLocalizations.script),
);
}
return ListView.builder(
padding: EdgeInsets.symmetric(vertical: 16),
itemCount: scripts.length,
itemBuilder: (_, index) {
final script = scripts[index];
return CommonSelectedListItem(
isSelected: selectedScriptId == script.id,
title: Text(
script.label,
style: context.textTheme.bodyLarge,
maxLines: 3,
),
onSelected: () {
_handleSelected(script.id);
},
onPressed: () {
_handleSelected(script.id);
Widget _buildContent() {
return Consumer(
builder: (_, ref, _) {
final scripts = ref.watch(scriptsProvider);
if (scripts.isEmpty) {
return NullStatus(
illustration: ScriptEmptyIllustration(),
label: appLocalizations.nullTip(appLocalizations.script),
);
}
return ListView.builder(
padding: kMaterialListPadding.copyWith(bottom: 16 + 64),
itemCount: scripts.length,
itemBuilder: (_, index) {
final script = scripts[index];
return Container(
padding: kTabLabelPadding,
margin: EdgeInsets.symmetric(vertical: 6),
child: CommonCard(
type: CommonCardType.filled,
radius: 18,
child: ListItem(
padding: const EdgeInsets.only(left: 16, right: 12),
title: Text(script.label),
trailing: CommonPopupBox(
targetBuilder: (open) {
return IconButton(
onPressed: () {
open();
},
icon: Icon(Icons.more_vert),
);
},
popup: CommonPopupMenu(
items: [
PopupMenuItemData(
icon: Icons.edit,
label: appLocalizations.edit,
onPressed: () {
_handleToEditor(script: script);
},
),
PopupMenuItemData(
icon: Icons.delete,
label: appLocalizations.delete,
onPressed: () {
_handleDelScript(script.label);
},
),
],
),
),
),
),
);
},
);
},
@@ -150,8 +169,7 @@ class _ScriptsViewState extends ConsumerState<ScriptsView> {
return false;
}
void _handleToEditor([String? id]) {
final script = ref.read(scriptsProvider.select((state) => state.get(id)));
void _handleToEditor({Script? script}) {
final title = script?.label ?? '';
final raw = script?.content ?? scriptTemplate;
BaseNavigator.push(
@@ -174,50 +192,20 @@ class _ScriptsViewState extends ConsumerState<ScriptsView> {
@override
Widget build(BuildContext context) {
final scripts = ref.watch(scriptsProvider);
final selectedScriptId = ref.watch(selectedItemProvider(_key));
return CommonPopScope(
onPop: (_) {
if (selectedScriptId.isNotEmpty) {
ref.read(selectedItemProvider(_key).notifier).value = '';
return false;
}
Navigator.of(context).pop();
return false;
},
child: CommonScaffold(
actions: [
if (selectedScriptId.isNotEmpty) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: () {
_handleDelScript(selectedScriptId);
},
icon: Icon(Icons.delete),
),
),
SizedBox(width: 2),
],
CommonMinFilledButtonTheme(
child: selectedScriptId.isNotEmpty
? FilledButton(
onPressed: () {
_handleToEditor(selectedScriptId);
},
child: Text(appLocalizations.edit),
)
: FilledButton.tonal(
onPressed: () {
_handleToEditor();
},
child: Text(appLocalizations.add),
),
return CommonScaffold(
actions: [
CommonMinFilledButtonTheme(
child: FilledButton.tonal(
onPressed: () {
_handleToEditor();
},
child: Text(appLocalizations.add),
),
SizedBox(width: 8),
],
body: _buildContent(scripts, selectedScriptId),
title: appLocalizations.script,
),
),
SizedBox(width: 8),
],
body: _buildContent(),
title: appLocalizations.script,
);
}
}

View File

@@ -6,7 +6,6 @@ import 'package:fl_clash/models/models.dart';
import 'package:fl_clash/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:super_sliver_list/super_sliver_list.dart';
import 'item.dart';
@@ -127,11 +126,17 @@ class _ConnectionsViewState extends ConsumerState<ConnectionsView> {
)
.separated(const Divider(height: 0))
.toList();
return SuperListView.builder(
return ListView.builder(
controller: _scrollController,
itemBuilder: (context, index) {
return items[index];
},
itemExtentBuilder: (index, _) {
if (index.isOdd) {
return 0;
}
return TrackerInfoItem.height;
},
itemCount: connections.length,
);
},

View File

@@ -26,6 +26,16 @@ class TrackerInfoItem extends ConsumerWidget {
return globalState.measure.bodySmallHeight + 20;
}
static double get height {
final measure = globalState.measure;
return measure.bodyMediumHeight +
8 +
8 +
measure.bodyLargeHeight +
subTitleHeight +
16 * 2;
}
Future<ImageProvider?> _getPackageIcon(TrackerInfo connection) async {
return await app?.getPackageIcon(connection.metadata.process);
}
@@ -35,7 +45,7 @@ class TrackerInfoItem extends ConsumerWidget {
? '${trackerInfo.progressText} · '
: '';
final traffic = Traffic(up: trackerInfo.upload, down: trackerInfo.download);
return '${trackerInfo.start.lastUpdateTimeDesc} · $progress${traffic.desc}';
return '$progress${traffic.desc}';
}
@override
@@ -49,23 +59,27 @@ class TrackerInfoItem extends ConsumerWidget {
final title = Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(trackerInfo.desc, style: context.textTheme.bodyLarge),
// Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// spacing: 8,
// children: [
// Flexible(
// child: Text(trackerInfo.desc, style: context.textTheme.bodyLarge),
// ),
// Text(
// trackerInfo.start.lastUpdateTimeDesc,
// style: context.textTheme.bodySmall?.copyWith(
// color: context.colorScheme.onSurface.opacity60,
// ),
// ),
// ],
// ),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
spacing: 8,
children: [
Flexible(
child: Text(
trackerInfo.desc,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: context.textTheme.bodyLarge,
),
),
Text(
trackerInfo.start.lastUpdateTimeDesc,
style: context.textTheme.bodySmall?.copyWith(
color: context.colorScheme.onSurface.opacity60,
),
),
],
),
const SizedBox(height: 6),
Text(
_getSourceText(trackerInfo),

View File

@@ -6,7 +6,6 @@ import 'package:fl_clash/state.dart';
import 'package:fl_clash/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:super_sliver_list/super_sliver_list.dart';
import 'item.dart';
@@ -40,7 +39,9 @@ class _RequestsViewState extends ConsumerState<RequestsView> {
void initState() {
super.initState();
_requests = globalState.appState.requests.list;
_scrollController = ScrollController(initialScrollOffset: double.maxFinite);
_scrollController = ScrollController(
initialScrollOffset: _requests.length * TrackerInfoItem.height,
);
_requestsStateNotifier.value = _requestsStateNotifier.value.copyWith(
trackerInfos: _requests,
);
@@ -82,33 +83,38 @@ class _RequestsViewState extends ConsumerState<RequestsView> {
}, duration: commonDuration);
}
List<Widget> _buildActions() {
return [
ValueListenableBuilder(
valueListenable: _requestsStateNotifier,
builder: (_, state, _) {
return IconButton(
style: state.autoScrollToEnd
? IconButton.styleFrom(
backgroundColor: context.colorScheme.secondaryContainer,
)
: null,
onPressed: () {
_requestsStateNotifier.value = _requestsStateNotifier.value
.copyWith(
autoScrollToEnd:
!_requestsStateNotifier.value.autoScrollToEnd,
);
},
icon: const Icon(Icons.vertical_align_top_outlined),
);
},
),
];
}
@override
Widget build(BuildContext context) {
return CommonScaffold(
title: appLocalizations.requests,
actions: _buildActions(),
searchState: AppBarSearchState(onSearch: _onSearch),
onKeywordsUpdate: _onKeywordsUpdate,
floatingActionButton: ValueListenableBuilder(
valueListenable: _requestsStateNotifier,
builder: (_, state, _) {
final autoScrollToEnd = state.autoScrollToEnd;
return FadeRotationScaleBox(
child: FloatingActionButton(
key: ValueKey(autoScrollToEnd),
onPressed: () {
_requestsStateNotifier.value = _requestsStateNotifier.value
.copyWith(
autoScrollToEnd:
!_requestsStateNotifier.value.autoScrollToEnd,
);
},
child: autoScrollToEnd
? const Icon(Icons.block)
: const Icon(Icons.vertical_align_top),
),
);
},
),
body: ValueListenableBuilder<TrackerInfosState>(
valueListenable: _requestsStateNotifier,
builder: (context, state, _) {
@@ -146,7 +152,7 @@ class _RequestsViewState extends ConsumerState<RequestsView> {
_requestsStateNotifier.value = _requestsStateNotifier.value
.copyWith(autoScrollToEnd: false);
},
child: SuperListView.builder(
child: ListView.builder(
reverse: true,
shrinkWrap: true,
physics: NextClampingScrollPhysics(),
@@ -154,6 +160,12 @@ class _RequestsViewState extends ConsumerState<RequestsView> {
itemBuilder: (_, index) {
return items[index];
},
itemExtentBuilder: (index, _) {
if (index.isOdd) {
return 0;
}
return TrackerInfoItem.height;
},
itemCount: items.length,
),
),

View File

@@ -226,8 +226,8 @@ class _DashboardViewState extends ConsumerState<DashboardView> {
@override
Widget build(BuildContext context) {
final dashboardState = ref.watch(dashboardStateProvider);
final columns = max(4 * ((dashboardState.contentWidth / 280).ceil()), 8);
final spacing = 14.ap;
final columns = max(4 * ((dashboardState.contentWidth / 300).ceil()), 8);
final spacing = 16.ap;
final children = [
...dashboardState.dashboardWidgets
.where(

View File

@@ -214,7 +214,9 @@ class VpnButton extends StatelessWidget {
onChanged: (value) {
ref
.read(vpnSettingProvider.notifier)
.update((state) => state.copyWith(enable: value));
.updateState(
(state) => state.copyWith(enable: value),
);
},
);
},

View File

@@ -19,14 +19,14 @@ class DeveloperView extends ConsumerWidget {
items: [
ListItem(
title: Text(appLocalizations.messageTest),
minVerticalPadding: 12,
minVerticalPadding: 14,
onTap: () {
context.showNotifier(appLocalizations.messageTestTip);
},
),
ListItem(
title: Text(appLocalizations.logsTest),
minVerticalPadding: 12,
minVerticalPadding: 14,
onTap: () {
for (int i = 0; i < 1000; i++) {
globalState.appController.addLog(
@@ -40,7 +40,7 @@ class DeveloperView extends ConsumerWidget {
if (kDebugMode)
ListItem(
title: Text(appLocalizations.crashTest),
minVerticalPadding: 12,
minVerticalPadding: 14,
onTap: () async {
final res = await globalState.showMessage(
message: TextSpan(text: appLocalizations.confirmForceCrashCore),
@@ -53,7 +53,7 @@ class DeveloperView extends ConsumerWidget {
),
ListItem(
title: Text(appLocalizations.clearData),
minVerticalPadding: 12,
minVerticalPadding: 14,
onTap: () async {
final res = await globalState.showMessage(
message: TextSpan(text: appLocalizations.confirmClearAllData),
@@ -66,7 +66,7 @@ class DeveloperView extends ConsumerWidget {
),
ListItem(
title: Text(appLocalizations.loadTest),
minVerticalPadding: 12,
minVerticalPadding: 14,
onTap: () {
ref.read(loadingProvider.notifier).value = !ref.read(
loadingProvider,

View File

@@ -4,7 +4,6 @@ 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';
import 'package:super_sliver_list/super_sliver_list.dart';
import '../models/models.dart';
import '../widgets/widgets.dart';
@@ -26,7 +25,9 @@ class _LogsViewState extends ConsumerState<LogsView> {
void initState() {
super.initState();
_logs = globalState.appState.logs.list;
_scrollController = ScrollController(initialScrollOffset: double.maxFinite);
_scrollController = ScrollController(
initialScrollOffset: _logs.length * LogItem.height,
);
_logsStateNotifier.value = _logsStateNotifier.value.copyWith(logs: _logs);
ref.listenManual(logsProvider.select((state) => state.list), (prev, next) {
if (prev != next) {
@@ -41,6 +42,25 @@ class _LogsViewState extends ConsumerState<LogsView> {
List<Widget> _buildActions() {
return [
ValueListenableBuilder(
valueListenable: _logsStateNotifier,
builder: (_, state, _) {
return IconButton(
style: state.autoScrollToEnd
? IconButton.styleFrom(
backgroundColor: context.colorScheme.secondaryContainer,
foregroundColor: context.colorScheme.onSecondaryContainer,
)
: null,
onPressed: () {
_logsStateNotifier.value = _logsStateNotifier.value.copyWith(
autoScrollToEnd: !_logsStateNotifier.value.autoScrollToEnd,
);
},
icon: const Icon(Icons.vertical_align_top_outlined),
);
},
),
IconButton(
onPressed: () {
_handleExport();
@@ -111,25 +131,6 @@ class _LogsViewState extends ConsumerState<LogsView> {
onKeywordsUpdate: _onKeywordsUpdate,
searchState: AppBarSearchState(onSearch: _onSearch),
title: appLocalizations.logs,
floatingActionButton: ValueListenableBuilder(
valueListenable: _logsStateNotifier,
builder: (_, state, _) {
final autoScrollToEnd = state.autoScrollToEnd;
return FadeRotationScaleBox(
child: FloatingActionButton(
key: ValueKey(autoScrollToEnd),
onPressed: () {
_logsStateNotifier.value = _logsStateNotifier.value.copyWith(
autoScrollToEnd: !_logsStateNotifier.value.autoScrollToEnd,
);
},
child: autoScrollToEnd
? const Icon(Icons.block)
: const Icon(Icons.vertical_align_top),
),
);
},
),
body: ValueListenableBuilder<LogsState>(
valueListenable: _logsStateNotifier,
builder: (context, state, _) {
@@ -165,7 +166,7 @@ class _LogsViewState extends ConsumerState<LogsView> {
dataSource: logs,
child: CommonScrollBar(
controller: _scrollController,
child: SuperListView.builder(
child: ListView.builder(
physics: NextClampingScrollPhysics(),
reverse: true,
shrinkWrap: true,
@@ -173,6 +174,12 @@ class _LogsViewState extends ConsumerState<LogsView> {
itemBuilder: (_, index) {
return items[index];
},
itemExtentBuilder: (index, _) {
if (index.isOdd) {
return 0;
}
return LogItem.height;
},
itemCount: items.length,
),
),
@@ -188,16 +195,35 @@ class LogItem extends StatelessWidget {
final Log log;
final Function(String)? onClick;
static double get height {
final measure = globalState.measure;
return measure.bodyLargeHeight * 2 +
8 +
24 +
globalState.measure.labelMediumHeight +
16 +
20;
}
const LogItem({super.key, required this.log, this.onClick});
@override
Widget build(BuildContext context) {
return ListItem(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
onTap: () {},
title: Text(
log.payload,
style: context.textTheme.bodyLarge?.copyWith(color: log.logLevel.color),
onTap: () {
globalState.showCommonDialog(child: LogDetailDialog(log: log));
},
title: SizedBox(
height: globalState.measure.bodyLargeHeight * 2,
child: Text(
log.payload,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: context.textTheme.bodyLarge?.copyWith(
color: log.logLevel.color,
),
),
),
subtitle: Column(
children: [
@@ -225,3 +251,42 @@ class LogItem extends StatelessWidget {
);
}
}
class LogDetailDialog extends StatelessWidget {
final Log log;
const LogDetailDialog({super.key, required this.log});
@override
Widget build(BuildContext context) {
return CommonDialog(
title: appLocalizations.details(appLocalizations.log),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: Text(appLocalizations.confirm),
),
],
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 6,
children: [
SelectableText(
log.payload,
style: context.textTheme.bodyLarge?.copyWith(
color: log.logLevel.color,
),
),
SelectableText(
log.dateTime,
style: context.textTheme.bodySmall?.copyWith(
color: context.colorScheme.onSurfaceVariant,
),
),
],
),
);
}
}

View File

@@ -557,7 +557,7 @@ class RuleContent extends ConsumerWidget {
),
);
},
proxyDecorator: commonProxyDecorator,
proxyDecorator: proxyDecorator,
itemCount: rules.length,
onReorder: (oldIndex, newIndex) {
if (oldIndex < newIndex) {

View File

@@ -3,7 +3,7 @@
import 'package:fl_clash/common/common.dart';
import 'package:fl_clash/enum/enum.dart';
import 'package:fl_clash/features/features.dart';
import 'package:fl_clash/models/models.dart';
import 'package:fl_clash/models/clash_config.dart';
import 'package:fl_clash/providers/providers.dart';
import 'package:fl_clash/state.dart';
import 'package:fl_clash/views/config/scripts.dart';
@@ -11,57 +11,20 @@ import 'package:fl_clash/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class OverwriteView extends ConsumerStatefulWidget {
class OverwriteView extends StatefulWidget {
final String profileId;
const OverwriteView({super.key, required this.profileId});
@override
ConsumerState<OverwriteView> createState() => _OverwriteViewState();
State<OverwriteView> createState() => _OverwriteViewState();
}
class _OverwriteViewState extends ConsumerState<OverwriteView> {
late final Overwrite _originOverwriteData;
@override
void initState() {
super.initState();
_originOverwriteData =
ref.read(profileOverwriteProvider(widget.profileId)) ?? Overwrite();
}
Future<void> _handleReset() async {
final res = await globalState.showMessage(
message: TextSpan(text: appLocalizations.resetPageChangesTip),
);
if (res != true) {
return;
}
ref.read(profilesProvider.notifier).updateProfile(widget.profileId, (
state,
) {
return state.copyWith(overwrite: _originOverwriteData);
});
}
class _OverwriteViewState extends State<OverwriteView> {
@override
Widget build(BuildContext context) {
final needReset = ref.watch(
profileOverwriteProvider(
widget.profileId,
).select((state) => state != _originOverwriteData),
);
return CommonScaffold(
title: appLocalizations.override,
actions: [
if (needReset)
CommonMinFilledButtonTheme(
child: FilledButton(
onPressed: _handleReset,
child: Text(appLocalizations.reset),
),
),
],
body: CustomScrollView(
slivers: [_Title(widget.profileId), _Content(widget.profileId)],
),
@@ -184,28 +147,19 @@ class _Content extends ConsumerWidget {
}
}
class _StandardContent extends ConsumerStatefulWidget {
class _StandardContent extends ConsumerWidget {
final String profileId;
const _StandardContent(this.profileId);
@override
ConsumerState createState() => __StandardContentState();
}
class __StandardContentState extends ConsumerState<_StandardContent> {
final _key = utils.id;
Future<void> _handleAddOrUpdate([Rule? rule]) async {
Future<void> _handleAddOrUpdate(WidgetRef ref, [Rule? rule]) async {
final res = await globalState.showCommonDialog<Rule>(
child: AddOrEditRuleDialog(rule: rule),
);
if (res == null) {
return;
}
ref.read(profilesProvider.notifier).updateProfile(widget.profileId, (
state,
) {
ref.read(profilesProvider.notifier).updateProfile(profileId, (state) {
final newAddedRules = state.overwrite.standardOverwrite.addedRules
.updateWith(res);
return state.copyWith.overwrite.standardOverwrite(
@@ -214,29 +168,29 @@ class __StandardContentState extends ConsumerState<_StandardContent> {
});
}
void _handleSelected(String ruleId) {
ref.read(selectedItemsProvider(_key).notifier).update((selectedRules) {
void _handleSelected(WidgetRef ref, String ruleId) {
ref.read(selectedIdsProvider.notifier).update((selectedRules) {
final newSelectedRules = Set<String>.from(selectedRules)
..addOrRemove(ruleId);
return newSelectedRules;
});
}
void _handleSelectAll() {
void _handleSelectAll(WidgetRef ref) {
final ids = ref
.read(
profileOverwriteProvider(
widget.profileId,
profileId,
).select((state) => state?.standardOverwrite.addedRules ?? []),
)
.map((item) => item.id)
.toSet();
ref.read(selectedItemsProvider(_key).notifier).update((selected) {
ref.read(selectedIdsProvider.notifier).update((selected) {
return selected.containsAll(ids) ? {} : ids;
});
}
Future<void> _handleDelete() async {
Future<void> _handleDelete(WidgetRef ref) async {
final res = await globalState.showMessage(
title: appLocalizations.tip,
message: TextSpan(
@@ -246,10 +200,8 @@ class __StandardContentState extends ConsumerState<_StandardContent> {
if (res != true) {
return;
}
final selectedRules = ref.read(selectedItemsProvider(_key));
ref.read(profilesProvider.notifier).updateProfile(widget.profileId, (
state,
) {
final selectedRules = ref.read(selectedIdsProvider);
ref.read(profilesProvider.notifier).updateProfile(profileId, (state) {
final newAddedRules = state.overwrite.standardOverwrite.addedRules
.where((item) => !selectedRules.contains(item.id))
.toList();
@@ -257,150 +209,121 @@ class __StandardContentState extends ConsumerState<_StandardContent> {
addedRules: newAddedRules,
);
});
ref.read(selectedItemsProvider(_key).notifier).value = {};
ref.read(selectedIdsProvider.notifier).value = {};
}
@override
Widget build(BuildContext context) {
Widget build(BuildContext context, ref) {
final standardOverwrite = ref.watch(
profileOverwriteProvider(
widget.profileId,
profileId,
).select((state) => state?.standardOverwrite),
);
final selectedRules = ref.watch(selectedItemsProvider(_key));
final selectedRules = ref.watch(selectedIdsProvider);
final addedRules = standardOverwrite?.addedRules ?? [];
return CommonPopScope(
onPop: (_) {
if (selectedRules.isNotEmpty) {
ref.read(selectedItemsProvider(_key).notifier).value = {};
return false;
}
Navigator.of(context).pop();
return false;
},
child: SliverMainAxisGroup(
slivers: [
SliverToBoxAdapter(child: SizedBox(height: 24)),
SliverToBoxAdapter(
child: Column(
children: [
InfoHeader(
info: Info(label: appLocalizations.addedRules),
actions: [
if (selectedRules.isNotEmpty) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: () {
_handleDelete();
},
icon: Icon(Icons.delete),
),
return SliverMainAxisGroup(
slivers: [
SliverToBoxAdapter(child: SizedBox(height: 24)),
SliverToBoxAdapter(
child: Column(
children: [
InfoHeader(
info: Info(label: appLocalizations.addedRules),
actions: [
if (selectedRules.isNotEmpty) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: () {
_handleDelete(ref);
},
icon: Icon(Icons.delete),
),
SizedBox(width: 8),
],
CommonMinFilledButtonTheme(
child: selectedRules.isNotEmpty
? FilledButton(
onPressed: () {
_handleSelectAll();
},
child: Text(appLocalizations.selectAll),
)
: FilledButton.tonal(
onPressed: () {
_handleAddOrUpdate();
},
child: Text(appLocalizations.add),
),
),
SizedBox(width: 8),
],
),
],
),
CommonMinFilledButtonTheme(
child: selectedRules.isNotEmpty
? FilledButton(
onPressed: () {
_handleSelectAll(ref);
},
child: Text(appLocalizations.selectAll),
)
: FilledButton.tonal(
onPressed: () {
_handleAddOrUpdate(ref);
},
child: Text(appLocalizations.add),
),
),
],
),
],
),
SliverToBoxAdapter(child: SizedBox(height: 8)),
Consumer(
builder: (_, ref, _) {
return SliverReorderableList(
),
SliverToBoxAdapter(child: SizedBox(height: 8)),
Consumer(
builder: (_, ref, _) {
return SliverPadding(
padding: EdgeInsets.symmetric(horizontal: 16),
sliver: SliverList.builder(
itemCount: addedRules.length,
itemBuilder: (_, index) {
final rule = addedRules[index];
return ReorderableDelayedDragStartListener(
key: ObjectKey(rule),
index: index,
child: RuleItem(
isEditing: selectedRules.isNotEmpty,
isSelected: selectedRules.contains(rule.id),
rule: rule,
onSelected: (id) {
_handleSelected(id);
},
onEdit: (rule) {
_handleAddOrUpdate(rule);
},
),
);
},
onReorder: (int oldIndex, int newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
ref.read(profilesProvider.notifier).updateProfile(
widget.profileId,
(state) {
final newAddRules = List<Rule>.from(
state.overwrite.standardOverwrite.addedRules,
);
final item = newAddRules.removeAt(oldIndex);
newAddRules.insert(newIndex, item);
return state.copyWith.overwrite.standardOverwrite(
addedRules: newAddRules,
);
return RuleItem(
isEditing: selectedRules.isNotEmpty,
isSelected: selectedRules.contains(rule.id),
rule: rule,
onSelected: (id) {
_handleSelected(ref, id);
},
onEdit: (rule) {
_handleAddOrUpdate(ref, rule);
},
);
},
);
},
),
SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: CommonCard(
padding: EdgeInsets.zero,
radius: 18,
child: ListTile(
minTileHeight: 0,
minVerticalPadding: 0,
titleTextStyle: context.textTheme.bodyMedium?.toJetBrainsMono,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 16,
),
title: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
child: Text(
appLocalizations.controlGlobalAddedRules,
style: context.textTheme.bodyLarge,
),
),
SizedBox(width: 4),
Icon(Icons.arrow_forward, size: 18),
],
),
),
onPressed: () {
BaseNavigator.push(
context,
_EditGlobalAddedRules(profileId: widget.profileId),
);
},
),
);
},
),
SliverToBoxAdapter(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
child: CommonCard(
padding: EdgeInsets.zero,
radius: 18,
child: ListTile(
minTileHeight: 0,
minVerticalPadding: 0,
titleTextStyle: context.textTheme.bodyMedium?.toJetBrainsMono,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 16,
),
title: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
child: Text(
appLocalizations.controlGlobalAddedRules,
style: context.textTheme.bodyLarge,
),
),
SizedBox(width: 4),
Icon(Icons.arrow_forward, size: 18),
],
),
),
onPressed: () {
BaseNavigator.push(
context,
_EditGlobalAddedRules(profileId: profileId),
);
},
),
),
],
),
),
],
);
}
}
@@ -456,26 +379,23 @@ class _ScriptContent extends ConsumerWidget {
child: ListTile(
minLeadingWidth: 0,
minTileHeight: 0,
minVerticalPadding: 16,
minVerticalPadding: 0,
contentPadding: const EdgeInsets.symmetric(
horizontal: 14,
),
vertical: 10,
).copyWith(left: 12),
title: Row(
children: [
SizedBox(
width: 24,
height: 24,
child: Radio(
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity.compact,
toggleable: true,
value: script.id,
groupValue: scriptId,
onChanged: (_) {
_handleChange(ref, script.id);
},
),
Radio(
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity.compact,
toggleable: true,
value: script.id,
groupValue: scriptId,
onChanged: (_) {
_handleChange(ref, script.id);
},
),
SizedBox(width: 8),
Flexible(child: Text(script.label)),

View File

@@ -1,4 +1,5 @@
import 'dart:isolate';
import 'dart:ui';
import 'package:fl_clash/common/common.dart';
import 'package:fl_clash/enum/enum.dart';
@@ -70,32 +71,49 @@ class _ProfilesViewState extends State<ProfilesView> {
}
}
List<Widget> _buildActions(List<Profile> profiles) {
return profiles.isNotEmpty
? [
IconButton(
onPressed: () {
_updateProfiles();
},
icon: const Icon(Icons.sync),
),
IconButton(
onPressed: () {
showSheet(
context: context,
builder: (_, type) {
return ReorderableProfilesSheet(
type: type,
profiles: profiles,
);
},
);
},
icon: const Icon(Icons.sort),
iconSize: 26,
),
]
: [];
List<Widget> _buildActions() {
return [
IconButton(
onPressed: () {
_updateProfiles();
},
icon: const Icon(Icons.sync),
),
// IconButton(
// onPressed: () {
// showExtend(
// context,
// builder: (_, type) {
// return ScriptsView();
// },
// );
// },
// icon: Consumer(
// builder: (context, ref, _) {
// final isScriptMode = ref.watch(
// scriptStateProvider.select((state) => state.realId != null),
// );
// return Icon(
// Icons.functions,
// color: isScriptMode ? context.colorScheme.primary : null,
// );
// },
// ),
// ),
IconButton(
onPressed: () {
final profiles = globalState.config.profiles;
showSheet(
context: context,
builder: (_, type) {
return ReorderableProfilesSheet(type: type, profiles: profiles);
},
);
},
icon: const Icon(Icons.sort),
iconSize: 26,
),
];
}
Widget _buildFAB() {
@@ -108,59 +126,58 @@ class _ProfilesViewState extends State<ProfilesView> {
@override
Widget build(BuildContext context) {
return Consumer(
builder: (_, ref, _) {
final profilesSelectorState = ref.watch(profilesSelectorStateProvider);
final spacing = 14.ap;
return CommonScaffold(
title: appLocalizations.profiles,
floatingActionButton: _buildFAB(),
actions: _buildActions(profilesSelectorState.profiles),
body: profilesSelectorState.profiles.isEmpty
? NullStatus(
label: appLocalizations.nullProfileDesc,
illustration: ProfileEmptyIllustration(),
)
: Align(
alignment: Alignment.topCenter,
child: SingleChildScrollView(
key: profilesStoreKey,
padding: const EdgeInsets.only(
left: 16,
right: 16,
top: 16,
bottom: 88,
return CommonScaffold(
title: appLocalizations.profiles,
floatingActionButton: _buildFAB(),
actions: _buildActions(),
body: Consumer(
builder: (_, ref, _) {
final profilesSelectorState = ref.watch(
profilesSelectorStateProvider,
);
if (profilesSelectorState.profiles.isEmpty) {
return NullStatus(
label: appLocalizations.nullProfileDesc,
illustration: ProfileEmptyIllustration(),
);
}
return Align(
alignment: Alignment.topCenter,
child: SingleChildScrollView(
key: profilesStoreKey,
padding: const EdgeInsets.only(
left: 16,
right: 16,
top: 16,
bottom: 88,
),
child: Grid(
mainAxisSpacing: 16,
crossAxisSpacing: 16,
crossAxisCount: profilesSelectorState.columns,
children: [
for (
int i = 0;
i < profilesSelectorState.profiles.length;
i++
)
GridItem(
child: ProfileItem(
key: Key(profilesSelectorState.profiles[i].id),
profile: profilesSelectorState.profiles[i],
groupValue: profilesSelectorState.currentProfileId,
onChanged: (profileId) {
ref.read(currentProfileIdProvider.notifier).value =
profileId;
},
),
),
child: Grid(
mainAxisSpacing: spacing,
crossAxisSpacing: spacing,
crossAxisCount: profilesSelectorState.columns,
children: [
for (
int i = 0;
i < profilesSelectorState.profiles.length;
i++
)
GridItem(
child: ProfileItem(
key: Key(profilesSelectorState.profiles[i].id),
profile: profilesSelectorState.profiles[i],
groupValue:
profilesSelectorState.currentProfileId,
onChanged: (profileId) {
ref
.read(currentProfileIdProvider.notifier)
.value =
profileId;
},
),
),
],
),
),
),
);
},
],
),
),
);
},
),
);
}
}
@@ -453,20 +470,26 @@ class _ReorderableProfilesSheetState extends State<ReorderableProfilesSheet> {
profiles = List.from(widget.profiles);
}
Widget _buildItem(int index, [bool isDecorator = false]) {
final isLast = index == profiles.length - 1;
final isFirst = index == 0;
Widget proxyDecorator(Widget child, int index, Animation<double> animation) {
final profile = profiles[index];
return CommonInputListItem(
key: Key(profile.id),
trailing: ReorderableDelayedDragStartListener(
index: index,
child: const Icon(Icons.drag_handle),
return AnimatedBuilder(
animation: animation,
builder: (_, Widget? child) {
final double animValue = Curves.easeInOut.transform(animation.value);
final double scale = lerpDouble(1, 1.02, animValue)!;
return Transform.scale(scale: scale, child: child);
},
child: Container(
key: Key(profile.id),
padding: const EdgeInsets.symmetric(vertical: 4),
child: CommonCard(
type: CommonCardType.filled,
child: ListTile(
contentPadding: const EdgeInsets.only(right: 44, left: 16),
title: Text(profile.label ?? profile.id),
),
),
),
title: Text(profile.label ?? profile.id),
isFirst: isFirst,
isLast: isLast,
isDecorator: isDecorator,
);
}
@@ -499,17 +522,11 @@ class _ReorderableProfilesSheetState extends State<ReorderableProfilesSheet> {
),
],
body: Padding(
padding: EdgeInsets.only(bottom: 32, top: 12),
padding: EdgeInsets.only(bottom: 16, top: 0),
child: ReorderableListView.builder(
buildDefaultDragHandles: false,
padding: const EdgeInsets.symmetric(horizontal: 16),
proxyDecorator: (child, index, animation) {
return commonProxyDecorator(
_buildItem(index, true),
index,
animation,
);
},
proxyDecorator: proxyDecorator,
onReorder: (oldIndex, newIndex) {
setState(() {
if (oldIndex < newIndex) {
@@ -520,7 +537,22 @@ class _ReorderableProfilesSheetState extends State<ReorderableProfilesSheet> {
});
},
itemBuilder: (_, index) {
return _buildItem(index);
final profile = profiles[index];
return Container(
key: Key(profile.id),
padding: const EdgeInsets.symmetric(vertical: 4),
child: CommonCard(
type: CommonCardType.filled,
child: ListTile(
contentPadding: const EdgeInsets.only(right: 16, left: 16),
title: Text(profile.label ?? profile.id),
trailing: ReorderableDragStartListener(
index: index,
child: const Icon(Icons.drag_handle),
),
),
),
);
},
itemCount: profiles.length,
),

View File

@@ -425,6 +425,22 @@ class _ListHeaderState extends State<ListHeader> {
final iconStyle = ref.watch(
proxiesStyleSettingProvider.select((state) => state.iconStyle),
);
final icon = ref.watch(
proxiesStyleSettingProvider.select((state) {
final iconMapEntryList = state.iconMap.entries.toList();
final index = iconMapEntryList.indexWhere((item) {
try {
return RegExp(item.key).hasMatch(groupName);
} catch (_) {
return false;
}
});
if (index != -1) {
return iconMapEntryList[index].value;
}
return this.icon;
}),
);
return switch (iconStyle) {
ProxiesIconStyle.standard => LayoutBuilder(
builder: (_, constraints) {

View File

@@ -38,8 +38,7 @@ class _ProxiesViewState extends ConsumerState<ProxiesView> {
targetBuilder: (open) {
return IconButton(
onPressed: () {
final isMobile = ref.read(isMobileViewProvider);
open(offset: Offset(0, isMobile ? 0 : 20));
open(offset: Offset(0, 0));
},
icon: Icon(Icons.more_vert),
);
@@ -76,6 +75,23 @@ class _ProxiesViewState extends ConsumerState<ProxiesView> {
);
},
),
if (!_isTab)
PopupMenuItemData(
icon: Icons.style_outlined,
label: appLocalizations.iconConfiguration,
onPressed: () {
showExtend(
context,
builder: (_, type) {
return AdaptiveSheetScaffold(
type: type,
body: const _IconConfigView(),
title: appLocalizations.iconConfiguration,
);
},
);
},
),
],
),
),
@@ -93,7 +109,7 @@ class _ProxiesViewState extends ConsumerState<ProxiesView> {
}
void _onSearch(String value) {
ref.read(queryProvider(QueryTag.proxies).notifier).value = value;
ref.read(queryMapProvider.notifier).updateQuery(QueryTag.proxies, value);
}
@override
@@ -151,3 +167,33 @@ class _ProxiesViewState extends ConsumerState<ProxiesView> {
);
}
}
class _IconConfigView extends ConsumerWidget {
const _IconConfigView();
@override
Widget build(BuildContext context, WidgetRef ref) {
final iconMap = ref.watch(
proxiesStyleSettingProvider.select((state) => state.iconMap),
);
return MapInputPage(
title: appLocalizations.iconConfiguration,
map: iconMap,
keyLabel: appLocalizations.regExp,
valueLabel: appLocalizations.icon,
titleBuilder: (item) => Text(item.key),
leadingBuilder: (item) => Container(
decoration: BoxDecoration(borderRadius: BorderRadius.circular(16)),
clipBehavior: Clip.antiAlias,
child: CommonTargetIcon(src: item.value, size: 42),
),
subtitleBuilder: (item) =>
Text(item.value, maxLines: 2, overflow: TextOverflow.ellipsis),
onChange: (value) {
ref
.read(proxiesStyleSettingProvider.notifier)
.updateState((state) => state.copyWith(iconMap: value));
},
);
}
}

View File

@@ -88,7 +88,7 @@ class CommonCard extends StatelessWidget {
this.type = CommonCardType.plain,
this.onPressed,
this.selectWidget,
this.radius,
this.radius = 14,
required this.child,
this.padding,
this.enterAnimated = false,
@@ -105,7 +105,7 @@ class CommonCard extends StatelessWidget {
final EdgeInsets? padding;
final Info? info;
final CommonCardType type;
final double? radius;
final double radius;
// final WidgetStateProperty<Color?>? backgroundColor;
// final WidgetStateProperty<BorderSide?>? borderSide;
@@ -189,7 +189,7 @@ class CommonCard extends StatelessWidget {
padding: const WidgetStatePropertyAll(EdgeInsets.zero),
shape: WidgetStatePropertyAll(
RoundedSuperellipseBorder(
borderRadius: BorderRadius.circular(radius ?? 14),
borderRadius: BorderRadius.circular(radius),
),
),
iconColor: WidgetStatePropertyAll(context.colorScheme.primary),

View File

@@ -98,52 +98,26 @@ class DonutChartPainter extends CustomPainter {
final List<DonutChartData> newData;
final double progress;
late final Paint _arcPaint;
List<DonutChartData>? _cachedInterpolatedData;
double? _cachedProgress;
DonutChartPainter(this.oldData, this.newData, this.progress) {
_arcPaint = Paint()
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round;
}
static const _logBase = 10.0;
static const _minValue = 0.1;
static final _logBaseInv = 1.0 / log(_logBase);
DonutChartPainter(this.oldData, this.newData, this.progress);
double _logTransform(double value) {
if (value < _minValue) return 0;
return log(value) * _logBaseInv + 1;
const base = 10.0;
const minValue = 0.1;
if (value < minValue) return 0;
return log(value) / log(base) + 1;
}
double _expTransform(double value) {
const base = 10.0;
if (value <= 0) return 0;
return pow(_logBase, value - 1).toDouble();
return pow(base, value - 1).toDouble();
}
List<DonutChartData> get _interpolatedData {
if (_cachedInterpolatedData != null && _cachedProgress == progress) {
return _cachedInterpolatedData!;
}
if (newData.isEmpty) {
_cachedInterpolatedData = newData;
_cachedProgress = progress;
return newData;
}
if (oldData.length != newData.length) {
_cachedInterpolatedData = newData;
_cachedProgress = progress;
return newData;
}
final result = <DonutChartData>[];
for (var i = 0; i < newData.length; i++) {
final oldValue = oldData[i].value;
final newValue = newData[i].value;
List<DonutChartData> get interpolatedData {
if (oldData.length != newData.length) return newData;
final interpolatedData = List.generate(newData.length, (index) {
final oldValue = oldData[index].value;
final newValue = newData[index].value;
final logOldValue = _logTransform(oldValue);
final logNewValue = _logTransform(newValue);
final interpolatedLogValue =
@@ -151,54 +125,51 @@ class DonutChartPainter extends CustomPainter {
final interpolatedValue = _expTransform(interpolatedLogValue);
result.add(DonutChartData(
return DonutChartData(
value: interpolatedValue,
color: newData[i].color,
));
}
color: newData[index].color,
);
});
_cachedInterpolatedData = result;
_cachedProgress = progress;
return result;
return interpolatedData;
}
@override
void paint(Canvas canvas, Size size) {
final data = _interpolatedData;
if (data.isEmpty) return;
double total = 0;
for (final item in data) {
total += item.value;
}
if (total <= 0) return;
final center = Offset(size.width / 2, size.height / 2);
final strokeWidth = 10.0.ap;
final radius = min(size.width / 2, size.height / 2) - strokeWidth / 2;
final gapAngle = 2 * asin(strokeWidth * 1 / (2 * radius)) * 1.2;
final availableAngle = 2 * pi - (data.length * gapAngle);
final totalInv = 1.0 / total;
final data = interpolatedData;
final total = data.fold<double>(
0,
(sum, item) => sum + item.value,
);
if (total <= 0) return;
final availableAngle = 2 * pi - (data.length * gapAngle);
double startAngle = -pi / 2 + gapAngle / 2;
_arcPaint.strokeWidth = strokeWidth;
for (final item in data) {
final sweepAngle = availableAngle * (item.value * totalInv);
final sweepAngle = availableAngle * (item.value / total);
if (sweepAngle <= 0) continue;
_arcPaint.color = item.color;
final paint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = strokeWidth
..strokeCap = StrokeCap.round
..color = item.color;
canvas.drawArc(
Rect.fromCircle(center: center, radius: radius),
startAngle,
sweepAngle,
false,
_arcPaint,
paint,
);
startAngle += sweepAngle + gapAngle;

View File

@@ -64,7 +64,10 @@ class _EffectGestureDetectorState extends State<EffectGestureDetector>
class CommonExpandIcon extends StatefulWidget {
final bool expand;
const CommonExpandIcon({super.key, this.expand = false});
const CommonExpandIcon({
super.key,
this.expand = false,
});
@override
State<CommonExpandIcon> createState() => _CommonExpandIconState();
@@ -116,14 +119,19 @@ class _CommonExpandIconState extends State<CommonExpandIcon>
return AnimatedBuilder(
animation: _animationController.view,
builder: (_, child) {
return RotationTransition(turns: _iconTurns, child: child!);
return RotationTransition(
turns: _iconTurns,
child: child!,
);
},
child: const Icon(Icons.expand_more),
child: const Icon(
Icons.expand_more,
),
);
}
}
Widget commonProxyDecorator(
Widget proxyDecorator(
Widget child,
int index,
Animation<double> animation,
@@ -133,7 +141,10 @@ Widget commonProxyDecorator(
builder: (_, Widget? child) {
final double animValue = Curves.easeInOut.transform(animation.value);
final double scale = lerpDouble(1, 1.02, animValue)!;
return Transform.scale(scale: scale, child: child);
return Transform.scale(
scale: scale,
child: child,
);
},
child: child,
);

View File

@@ -1,14 +1,12 @@
import 'package:fl_clash/common/common.dart';
import 'package:fl_clash/models/common.dart';
import 'package:fl_clash/providers/providers.dart';
import 'package:fl_clash/state.dart';
import 'package:fl_clash/widgets/dialog.dart';
import 'package:fl_clash/widgets/null_status.dart';
import 'package:fl_clash/widgets/pop_scope.dart';
import 'package:fl_clash/widgets/scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'card.dart';
import 'effect.dart';
import 'list.dart';
import 'theme.dart';
@@ -193,68 +191,29 @@ class _InputDialogState extends State<InputDialog> {
}
}
class ListInputPage extends ConsumerStatefulWidget {
class ListInputPage extends StatelessWidget {
final String title;
final List<String> items;
final Widget Function(String item) titleBuilder;
final Widget Function(String item)? subtitleBuilder;
final Widget Function(String item)? leadingBuilder;
final String? valueLabel;
final Function(List<String> items) onChange;
const ListInputPage({
super.key,
required this.title,
required this.items,
required this.titleBuilder,
required this.onChange,
this.leadingBuilder,
this.valueLabel,
this.subtitleBuilder,
});
@override
ConsumerState createState() => _ListInputPageState();
}
class _ListInputPageState extends ConsumerState<ListInputPage> {
List<String> _items = [];
late List<String> _originItems;
final _key = utils.id;
@override
void initState() {
super.initState();
_items = widget.items;
_originItems = List<String>.from(_items);
}
void _handleReorder(int oldIndex, newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final nextItems = List<String>.from(_items);
final item = nextItems.removeAt(oldIndex);
nextItems.insert(newIndex, item);
_items = nextItems;
setState(() {});
}
void _handleSelected(String value) {
ref.read(selectedItemsProvider(_key).notifier).update((state) {
final newState = Set<String>.from(state)..addOrRemove(value);
return newState;
});
}
void _handleSelectAll() {
final ids = _items.toSet();
ref.read(selectedItemsProvider(_key).notifier).update((selected) {
return selected.containsAll(ids) ? {} : ids;
});
}
Future<void> _handleAddOrEdit([String? item]) async {
uniqueValidator(String? value) {
final index = _items.indexWhere((entry) {
final index = items.indexWhere((entry) {
return entry == value;
});
final current = item == value;
@@ -264,179 +223,103 @@ class _ListInputPageState extends ConsumerState<ListInputPage> {
return null;
}
final value = await globalState.showCommonDialog<String>(
child: AddDialog(
valueField: Field(
label: widget.valueLabel ?? appLocalizations.value,
value: item ?? '',
validator: uniqueValidator,
),
title: item != null ? appLocalizations.edit : appLocalizations.add,
),
final valueField = Field(
label: valueLabel ?? appLocalizations.value,
value: item ?? '',
validator: uniqueValidator,
);
final value = await globalState.showCommonDialog<String>(
child: AddDialog(valueField: valueField, title: title),
);
if (value == null) return;
final index = _items.indexWhere((entry) {
final index = items.indexWhere((entry) {
return entry == item;
});
final nextItems = List<String>.from(_items);
final nextItems = List<String>.from(items);
if (item != null) {
nextItems[index] = value;
} else {
nextItems.add(value);
}
_items = nextItems;
setState(() {});
onChange(nextItems);
}
void _handleDelete() {
final selectedItems = ref.read(selectedItemsProvider(_key));
final newItems = _items
.where((item) => !selectedItems.contains(item))
.toList();
_items = newItems;
ref.read(selectedItemsProvider(_key).notifier).value = {};
setState(() {});
}
Future<void> _handleReset() async {
final res = await globalState.showMessage(
message: TextSpan(text: appLocalizations.resetPageChangesTip),
);
if (res != true) {
return;
void _handleDelete(String? item) {
final entries = List<String>.from(items);
final index = entries.indexWhere((entry) {
return entry == item;
});
if (index != -1) {
entries.removeAt(index);
}
_items = _originItems;
setState(() {});
}
Widget _buildItem({
required String value,
required int index,
required int totalLength,
required bool isSelected,
required bool isEditing,
isDecorator = false,
}) {
final isFirst = index == 0;
final isLast = index == totalLength - 1;
return ReorderableDelayedDragStartListener(
key: ValueKey(value),
index: index,
child: CommonSelectedInputListItem(
isDecorator: isDecorator,
isLast: isLast,
isFirst: isFirst,
title: widget.titleBuilder(value),
isSelected: isSelected,
isEditing: isEditing,
onSelected: () {
_handleSelected(value);
},
onPressed: () {
_handleAddOrEdit(value);
},
leading: widget.leadingBuilder != null
? widget.leadingBuilder!(value)
: null,
subtitle: widget.subtitleBuilder != null
? widget.subtitleBuilder!(value)
: null,
),
);
onChange(entries);
}
@override
Widget build(BuildContext context) {
final selectedItems = ref.watch(selectedItemsProvider(_key));
return CommonPopScope(
onPop: (_) {
if (selectedItems.isNotEmpty) {
ref.read(selectedItemsProvider(_key).notifier).value = {};
return false;
}
Navigator.of(context).pop(_items);
return false;
},
child: CommonScaffold(
title: widget.title,
actions: [
if (selectedItems.isNotEmpty) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: _handleDelete,
icon: Icon(Icons.delete),
),
),
SizedBox(width: 2),
] else if (!stringListEquality.equals(_items, _originItems)) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: _handleReset,
icon: const Icon(Icons.replay),
),
),
SizedBox(width: 2),
],
CommonMinFilledButtonTheme(
child: selectedItems.isNotEmpty
? FilledButton(
onPressed: _handleSelectAll,
child: Text(appLocalizations.selectAll),
)
: FilledButton.tonal(
onPressed: () {
_handleAddOrEdit();
},
child: Text(appLocalizations.add),
),
return CommonScaffold(
title: title,
actions: [
CommonMinFilledButtonTheme(
child: FilledButton.tonal(
onPressed: () {
_handleAddOrEdit();
},
child: Text(appLocalizations.add),
),
SizedBox(width: 8),
],
body: _items.isEmpty
? NullStatus(label: appLocalizations.noData)
: ReorderableListView.builder(
padding: const EdgeInsets.only(
bottom: 16 + 64,
top: 16,
left: 16,
right: 16,
),
buildDefaultDragHandles: false,
itemCount: _items.length,
itemBuilder: (context, index) {
final value = _items[index];
return _buildItem(
value: value,
),
SizedBox(width: 8),
],
body: items.isEmpty
? NullStatus(label: appLocalizations.noData)
: ReorderableListView.builder(
padding: const EdgeInsets.only(bottom: 16 + 64),
buildDefaultDragHandles: false,
itemCount: items.length,
itemBuilder: (context, index) {
final e = items[index];
return _InputItem(
key: ValueKey(e),
ReorderableDelayedDragStartListener(
index: index,
totalLength: _items.length,
isSelected: selectedItems.contains(value),
isEditing: selectedItems.isNotEmpty,
);
},
proxyDecorator: (child, index, animation) {
final value = _items[index];
return commonProxyDecorator(
_buildItem(
value: value,
index: index,
totalLength: _items.length,
isDecorator: true,
isSelected: selectedItems.contains(value),
isEditing: selectedItems.isNotEmpty,
child: CommonCard(
child: ListItem(
leading: leadingBuilder != null
? leadingBuilder!(e)
: null,
title: titleBuilder(e),
subtitle: subtitleBuilder != null
? subtitleBuilder!(e)
: null,
trailing: IconButton(
icon: const Icon(Icons.delete_outline),
onPressed: () {
_handleDelete(e);
},
),
),
onPressed: () {
_handleAddOrEdit(e);
},
),
index,
animation,
);
},
onReorder: _handleReorder,
),
),
),
);
},
onReorder: (oldIndex, newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final nextItems = List<String>.from(items);
final item = nextItems.removeAt(oldIndex);
nextItems.insert(newIndex, item);
onChange(nextItems);
},
),
);
}
}
class MapInputPage extends ConsumerStatefulWidget {
class MapInputPage extends StatelessWidget {
final String title;
final Map<String, String> map;
final Widget Function(MapEntry<String, String> item) titleBuilder;
@@ -444,62 +327,26 @@ class MapInputPage extends ConsumerStatefulWidget {
final Widget Function(MapEntry<String, String> item)? leadingBuilder;
final String? keyLabel;
final String? valueLabel;
final Function(Map<String, String> items) onChange;
const MapInputPage({
super.key,
required this.title,
required this.map,
required this.titleBuilder,
required this.onChange,
this.leadingBuilder,
this.keyLabel,
this.valueLabel,
this.subtitleBuilder,
});
@override
ConsumerState<MapInputPage> createState() => _MapInputPageState();
}
class _MapInputPageState extends ConsumerState<MapInputPage> {
List<MapEntry<String, String>> _items = [];
late final List<MapEntry<String, String>> _originItems;
final _key = utils.id;
@override
void initState() {
super.initState();
_items = List<MapEntry<String, String>>.from(widget.map.entries);
_originItems = List<MapEntry<String, String>>.from(_items);
}
void _handleReorder(int oldIndex, newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final nextItems = List<MapEntry<String, String>>.from(_items);
final item = nextItems.removeAt(oldIndex);
nextItems.insert(newIndex, item);
_items = nextItems;
setState(() {});
}
void _handleSelected(MapEntry<String, String> value) {
ref.read(selectedItemsProvider(_key).notifier).update((state) {
final newState = Set<String>.from(state)..addOrRemove(value.key);
return newState;
});
}
void _handleSelectAll() {
final ids = _items.map((item) => item.key).toSet();
ref.read(selectedItemsProvider(_key).notifier).update((selected) {
return selected.containsAll(ids) ? {} : ids;
});
}
List<MapEntry<String, String>> get items =>
List<MapEntry<String, String>>.from(map.entries);
Future<void> _handleAddOrEdit([MapEntry<String, String>? item]) async {
uniqueValidator(String? value) {
final index = _items.indexWhere((entry) {
final index = items.indexWhere((entry) {
return entry.key == value;
});
final current = item?.key == value;
@@ -510,13 +357,13 @@ class _MapInputPageState extends ConsumerState<MapInputPage> {
}
final keyField = Field(
label: widget.keyLabel ?? appLocalizations.key,
label: keyLabel ?? appLocalizations.key,
value: item == null ? '' : item.key,
validator: uniqueValidator,
);
final valueField = Field(
label: widget.valueLabel ?? appLocalizations.value,
label: valueLabel ?? appLocalizations.value,
value: item == null ? '' : item.value,
);
@@ -524,170 +371,95 @@ class _MapInputPageState extends ConsumerState<MapInputPage> {
child: AddDialog(
keyField: keyField,
valueField: valueField,
title: item != null ? appLocalizations.edit : appLocalizations.add,
title: title,
),
);
if (value == null) return;
final index = _items.indexWhere((entry) {
final index = items.indexWhere((entry) {
return entry.key == item?.key;
});
final nextItems = List<MapEntry<String, String>>.from(_items);
final nextItems = List<MapEntry<String, String>>.from(items);
if (item != null) {
nextItems[index] = value;
} else {
nextItems.add(value);
}
_items = nextItems;
setState(() {});
onChange(Map.fromEntries(nextItems));
}
void _handleDelete() {
final selectedItems = ref.read(selectedItemsProvider(_key));
final newItems = _items
.where((item) => !selectedItems.contains(item.key))
.toList();
_items = newItems;
ref.read(selectedItemsProvider(_key).notifier).value = {};
setState(() {});
}
Future<void> _handleReset() async {
final res = await globalState.showMessage(
message: TextSpan(text: appLocalizations.resetPageChangesTip),
);
if (res != true) {
return;
void _handleDelete(MapEntry<String, String> item) {
final entries = List<MapEntry<String, String>>.from(items);
final index = entries.indexWhere((entry) {
return entry.key == item.key && item.value == entry.value;
});
if (index != -1) {
entries.removeAt(index);
}
_items = _originItems;
setState(() {});
}
Widget _buildItem({
required MapEntry<String, String> value,
required int index,
required int totalLength,
required bool isSelected,
required bool isEditing,
isDecorator = false,
}) {
final isFirst = index == 0;
final isLast = index == totalLength - 1;
return ReorderableDelayedDragStartListener(
key: ValueKey(value),
index: index,
child: CommonSelectedInputListItem(
isDecorator: isDecorator,
isLast: isLast,
isFirst: isFirst,
title: widget.titleBuilder(value),
leading: widget.leadingBuilder != null
? widget.leadingBuilder!(value)
: null,
subtitle: widget.subtitleBuilder != null
? widget.subtitleBuilder!(value)
: null,
isSelected: isSelected,
isEditing: isEditing,
onSelected: () {
_handleSelected(value);
},
onPressed: () {
_handleAddOrEdit(value);
},
),
);
onChange(Map.fromEntries(entries));
}
@override
Widget build(BuildContext context) {
final selectedItems = ref.watch(selectedItemsProvider(_key));
return CommonPopScope(
onPop: (_) {
if (selectedItems.isNotEmpty) {
ref.read(selectedItemsProvider(_key).notifier).value = {};
return false;
}
Navigator.of(context).pop(Map<String, String>.fromEntries(_items));
return false;
},
child: CommonScaffold(
title: widget.title,
actions: [
if (selectedItems.isNotEmpty) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: _handleDelete,
icon: Icon(Icons.delete),
),
),
SizedBox(width: 2),
] else if (!stringAndStringMapEntryListEquality.equals(
_items,
_originItems,
)) ...[
CommonMinIconButtonTheme(
child: IconButton.filledTonal(
onPressed: _handleReset,
icon: const Icon(Icons.replay),
),
),
SizedBox(width: 2),
],
CommonMinFilledButtonTheme(
child: selectedItems.isNotEmpty
? FilledButton(
onPressed: _handleSelectAll,
child: Text(appLocalizations.selectAll),
)
: FilledButton.tonal(
onPressed: () {
_handleAddOrEdit();
},
child: Text(appLocalizations.add),
),
return CommonScaffold(
title: title,
actions: [
CommonMinFilledButtonTheme(
child: FilledButton.tonal(
onPressed: () {
_handleAddOrEdit();
},
child: Text(appLocalizations.add),
),
SizedBox(width: 8),
],
body: _items.isEmpty
? NullStatus(label: appLocalizations.noData)
: ReorderableListView.builder(
padding: const EdgeInsets.only(
bottom: 16 + 64,
top: 16,
left: 16,
right: 16,
),
buildDefaultDragHandles: false,
itemCount: _items.length,
itemBuilder: (context, index) {
final value = _items[index];
return _buildItem(
value: value,
),
SizedBox(width: 8),
],
body: items.isEmpty
? NullStatus(label: appLocalizations.noData)
: ReorderableListView.builder(
padding: const EdgeInsets.only(bottom: 16 + 64),
proxyDecorator: proxyDecorator,
buildDefaultDragHandles: false,
itemCount: items.length,
itemBuilder: (_, index) {
final e = items[index];
return _InputItem(
key: ValueKey(e.key),
ReorderableDelayedDragStartListener(
index: index,
totalLength: _items.length,
isSelected: selectedItems.contains(value.key),
isEditing: selectedItems.isNotEmpty,
);
},
proxyDecorator: (child, index, animation) {
final value = _items[index];
return commonProxyDecorator(
_buildItem(
value: value,
index: index,
totalLength: _items.length,
isDecorator: true,
isSelected: selectedItems.contains(value.key),
isEditing: selectedItems.isNotEmpty,
child: CommonCard(
child: ListItem(
leading: leadingBuilder != null
? leadingBuilder!(e)
: null,
title: titleBuilder(e),
subtitle: subtitleBuilder != null
? subtitleBuilder!(e)
: null,
trailing: IconButton(
icon: const Icon(Icons.delete_outline),
onPressed: () {
_handleDelete(e);
},
),
),
onPressed: () {
_handleAddOrEdit(e);
},
),
index,
animation,
);
},
onReorder: _handleReorder,
),
),
),
);
},
onReorder: (oldIndex, newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
final nextItems = List<MapEntry<String, String>>.from(items);
final item = nextItems.removeAt(oldIndex);
nextItems.insert(newIndex, item);
onChange(Map.fromEntries(nextItems));
},
),
);
}
}
@@ -752,7 +524,7 @@ class _AddDialogState extends State<AddDialog> {
children: [
if (keyField != null)
TextFormField(
maxLines: 3,
maxLines: 2,
minLines: 1,
controller: keyController,
decoration: InputDecoration(
@@ -776,15 +548,11 @@ class _AddDialogState extends State<AddDialog> {
TextFormField(
maxLines: 3,
minLines: 1,
keyboardType: TextInputType.text,
controller: valueController,
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: valueField.label,
),
onFieldSubmitted: (_) {
_submit();
},
validator: (String? value) {
String? res;
if (valueField.validator != null) {
@@ -805,3 +573,23 @@ class _AddDialogState extends State<AddDialog> {
);
}
}
class _InputItem extends StatelessWidget {
final Widget child;
const _InputItem(this.child, {super.key});
@override
Widget build(BuildContext context) {
return Material(
elevation: 0,
key: key,
color: Colors.transparent,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 16),
margin: EdgeInsets.symmetric(vertical: 8),
child: child,
),
);
}
}

View File

@@ -31,27 +31,23 @@ class LineChart extends StatefulWidget {
class _LineChartState extends State<LineChart>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
List<Point> _points = [];
List<Point> _prevRenderPoints = [];
List<Point> _currentRenderPoints = [];
List<Point> prevPoints = [];
List<Point> points = [];
@override
void initState() {
super.initState();
_controller = AnimationController(vsync: this, duration: widget.duration);
_points = widget.points;
_currentRenderPoints = _getRenderPoints(_points);
_prevRenderPoints = _currentRenderPoints;
points = widget.points;
prevPoints = points;
}
@override
void didUpdateWidget(LineChart oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.points != _points) {
_points = widget.points;
_prevRenderPoints = _currentRenderPoints;
_currentRenderPoints = _getRenderPoints(_points);
if (widget.points != points) {
prevPoints = points;
points = widget.points;
_controller.forward(from: 0);
}
}
@@ -62,7 +58,49 @@ class _LineChartState extends State<LineChart>
super.dispose();
}
List<Point> _getRenderPoints(List<Point> points) {
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (_, container) {
return AnimatedBuilder(
animation: _controller.view,
builder: (_, _) {
return CustomPaint(
painter: LineChartPainter(
prevPoints: prevPoints,
points: points,
progress: _controller.value,
gradient: widget.gradient,
color: widget.color,
),
child: SizedBox(
height: container.maxHeight,
width: container.maxWidth,
),
);
},
);
},
);
}
}
class LineChartPainter extends CustomPainter {
final List<Point> prevPoints;
final List<Point> points;
final double progress;
final Color color;
final bool gradient;
LineChartPainter({
required this.prevPoints,
required this.points,
required this.progress,
required this.color,
required this.gradient,
});
List<Point> getRenderPoints(List<Point> points) {
if (points.isEmpty) return [];
double maxX = points[0].x;
double minX = points[0].x;
@@ -85,92 +123,25 @@ class _LineChartState extends State<LineChart>
}).toList();
}
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (_, container) {
return AnimatedBuilder(
animation: _controller.view,
builder: (_, _) {
return CustomPaint(
painter: LineChartPainter(
prevRenderPoints: _prevRenderPoints,
currentRenderPoints: _currentRenderPoints,
progress: _controller.value,
gradient: widget.gradient,
color: widget.color,
),
child: SizedBox(
height: container.maxHeight,
width: container.maxWidth,
),
);
},
);
},
);
}
}
List<Point> getInterpolatePoints(
List<Point> prevPoints,
List<Point> points,
double t,
) {
final renderPrevPoints = getRenderPoints(prevPoints);
final renderPoints = getRenderPoints(points);
class LineChartPainter extends CustomPainter {
final List<Point> prevRenderPoints;
final List<Point> currentRenderPoints;
final double progress;
final Color color;
final bool gradient;
late final Paint _strokePaint;
late final Paint _fillPaint;
Shader? _cachedShader;
Size? _cachedShaderSize;
Color? _cachedShaderColor;
LineChartPainter({
required this.prevRenderPoints,
required this.currentRenderPoints,
required this.progress,
required this.color,
required this.gradient,
}) {
_strokePaint = Paint()
..color = color
..strokeWidth = 2.0
..style = PaintingStyle.stroke;
_fillPaint = Paint()..style = PaintingStyle.fill;
}
List<Point> _getInterpolatePoints(double t) {
if (currentRenderPoints.isEmpty) return [];
final length = currentRenderPoints.length;
final result = <Point>[];
for (var i = 0; i < length; i++) {
if (i > prevRenderPoints.length - 1) {
result.add(currentRenderPoints[i]);
} else {
final x = lerpDouble(
prevRenderPoints[i].x,
currentRenderPoints[i].x,
t,
)!;
final y = lerpDouble(
prevRenderPoints[i].y,
currentRenderPoints[i].y,
t,
)!;
result.add(Point(x, y));
return List.generate(renderPoints.length, (i) {
if (i > renderPrevPoints.length - 1) {
return renderPoints[i];
}
}
return result;
final x = lerpDouble(renderPrevPoints[i].x, renderPoints[i].x, t)!;
final y = lerpDouble(renderPrevPoints[i].y, renderPoints[i].y, t)!;
return Point(x, y);
});
}
Path _getPath(List<Point> points, Size size) {
if (points.isEmpty) return Path();
Path getPath(List<Point> points, Size size) {
final path = Path()
..moveTo(points[0].x * size.width, (1 - points[0].y) * size.height);
@@ -192,38 +163,24 @@ class LineChartPainter extends CustomPainter {
return path;
}
Path _getAnimatedPath(Size size) {
final interpolatedPoints = _getInterpolatePoints(progress);
return _getPath(interpolatedPoints, size);
}
Path getAnimatedPath(Size size) {
final interpolatedPoints = getInterpolatePoints(
prevPoints,
points,
progress,
);
final path = getPath(interpolatedPoints, size);
Shader _getShader(Size size) {
if (_cachedShader == null ||
_cachedShaderSize != size ||
_cachedShaderColor != color) {
final gradient = LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [color.opacity38, color.opacity10],
);
final strokeWidth = 2.0;
_cachedShader = gradient.createShader(
Rect.fromLTWH(0, 0, size.width, size.height + strokeWidth * 2),
);
_cachedShaderSize = size;
_cachedShaderColor = color;
}
return _cachedShader!;
final metric = path.computeMetrics().first;
final length = metric.length;
return metric.extractPath(0, length);
}
@override
void paint(Canvas canvas, Size size) {
if (currentRenderPoints.isEmpty) return;
final strokeWidth = 2.0;
final chartSize = Size(size.width, size.height * 0.7);
final path = _getAnimatedPath(chartSize);
final path = getAnimatedPath(chartSize);
if (gradient) {
final fillPath = Path.from(path);
@@ -231,18 +188,38 @@ class LineChartPainter extends CustomPainter {
fillPath.lineTo(0, size.height + strokeWidth * 2);
fillPath.close();
_fillPaint.shader = _getShader(size);
canvas.drawPath(fillPath, _fillPaint);
final gradient = LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [color.opacity38, color.opacity10],
);
final shader = gradient.createShader(
Rect.fromLTWH(0, 0, size.width, size.height + strokeWidth * 2),
);
canvas.drawPath(
fillPath,
Paint()
..shader = shader
..style = PaintingStyle.fill,
);
}
canvas.drawPath(path, _strokePaint);
canvas.drawPath(
path,
Paint()
..color = color
..strokeWidth = strokeWidth
..style = PaintingStyle.stroke,
);
}
@override
bool shouldRepaint(covariant LineChartPainter oldDelegate) {
return oldDelegate.progress != progress ||
oldDelegate.prevRenderPoints != prevRenderPoints ||
oldDelegate.currentRenderPoints != currentRenderPoints ||
oldDelegate.prevPoints != prevPoints ||
oldDelegate.points != points ||
oldDelegate.color != color ||
oldDelegate.gradient != gradient;
}

View File

@@ -35,19 +35,17 @@ class CheckboxDelegate<T> extends Delegate {
const CheckboxDelegate({this.value = false, this.onChanged});
}
class OpenDelegate<T> extends Delegate {
class OpenDelegate extends Delegate {
final Widget widget;
final double? maxWidth;
final bool blur;
final bool forceFull;
final ValueChanged<T?>? onChanged;
const OpenDelegate({
required this.widget,
this.maxWidth,
this.blur = true,
this.forceFull = true,
this.onChanged,
});
}
@@ -264,17 +262,16 @@ class ListItem<T> extends StatelessWidget {
if (delegate is OpenDelegate) {
final openDelegate = delegate as OpenDelegate;
final child = openDelegate.widget;
final onChanged = openDelegate.onChanged;
return OpenContainer<T>(
return OpenContainer(
// closedColor: context.colorScheme.surface,
// openColor: context.colorScheme.surface,
// closedElevation: 0,
// openElevation: 0,
closedBuilder: (_, action) {
openAction() async {
openAction() {
final isMobile = globalState.appState.viewMode == ViewMode.mobile;
if (!isMobile) {
final res = await showExtend(
showExtend(
context,
props: ExtendProps(
blur: openDelegate.blur,
@@ -285,19 +282,22 @@ class ListItem<T> extends StatelessWidget {
return child;
},
);
if (onChanged != null) {
onChanged(res);
}
return;
}
// if (kDebugMode) {
// BaseNavigator.push(context, child);
// return;
// }
action();
}
return _buildListTile(onTap: openAction);
},
onClosed: onChanged,
openBuilder: (_, action) {
return child;
return CommonScaffoldBackActionProvider(
backAction: action,
child: child,
);
},
);
}
@@ -486,7 +486,7 @@ Widget generateSectionV2({
}) {
final genItems = items
.map<Widget>((item) {
return ClipRRect(
return ClipRSuperellipse(
borderRadius: BorderRadius.circular(4),
child: CommonCard(
type: CommonCardType.filled,
@@ -500,8 +500,8 @@ Widget generateSectionV2({
children: [
if (items.isNotEmpty && title != null)
ListHeader(title: title, actions: actions),
ClipRRect(
borderRadius: BorderRadius.circular(18),
ClipRSuperellipse(
borderRadius: BorderRadius.circular(14),
child: Column(children: [...genItems]),
),
],
@@ -530,186 +530,3 @@ Widget generateListView(List<Widget> items) {
padding: const EdgeInsets.only(bottom: 16),
);
}
class CommonSelectedListItem extends StatelessWidget {
final bool isSelected;
final bool isEditing;
final Widget title;
final VoidCallback onSelected;
final VoidCallback onPressed;
const CommonSelectedListItem({
super.key,
required this.isSelected,
required this.onSelected,
this.isEditing = false,
required this.title,
required this.onPressed,
});
@override
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
child: Container(
margin: EdgeInsets.symmetric(vertical: 4, horizontal: 16),
color: Colors.transparent,
child: CommonCard(
padding: EdgeInsets.zero,
radius: 18,
type: CommonCardType.filled,
isSelected: isSelected,
onPressed: () {
if (isEditing) {
onSelected();
return;
}
onPressed();
},
child: ListTile(
minTileHeight: 32 + globalState.measure.bodyMediumHeight,
minVerticalPadding: 12,
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
trailing: SizedBox(
width: 24,
height: 24,
child: CommonCheckBox(
value: isSelected,
isCircle: true,
onChanged: (_) {
onSelected();
},
),
),
title: title,
),
),
),
);
}
}
class CommonInputListItem extends StatelessWidget {
final bool isDecorator;
final bool isFirst;
final bool isLast;
final Widget? title;
final Widget? subtitle;
final Widget? leading;
final Widget? trailing;
final bool? isSelected;
final VoidCallback? onPressed;
const CommonInputListItem({
super.key,
this.isDecorator = false,
this.isFirst = false,
this.isLast = false,
this.title,
this.leading,
this.trailing,
this.subtitle,
this.isSelected,
this.onPressed,
});
@override
Widget build(BuildContext context) {
return Container(
clipBehavior: Clip.hardEdge,
decoration: ShapeDecoration(
shape: isDecorator == true
? LinearBorder.none
: RoundedSuperellipseBorder(
borderRadius: BorderRadius.vertical(
top: isFirst ? Radius.circular(24) : Radius.zero,
bottom: isLast ? Radius.circular(24) : Radius.zero,
),
),
),
child: CommonCard(
radius: 0,
isSelected: isSelected,
type: CommonCardType.filled,
onPressed: onPressed,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
child: ListTile(
leading: leading,
contentPadding: const EdgeInsets.only(right: 16, left: 16),
title: title,
subtitle: subtitle,
minVerticalPadding: 14,
trailing: trailing,
),
),
if (isDecorator != true && !isLast)
Divider(height: 0, indent: 14, endIndent: 14),
],
),
),
);
}
}
class CommonSelectedInputListItem extends StatelessWidget {
final bool isSelected;
final bool isEditing;
final Widget title;
final Widget? subtitle;
final VoidCallback onSelected;
final VoidCallback onPressed;
final bool isFirst;
final bool isLast;
final bool isDecorator;
final Widget? leading;
const CommonSelectedInputListItem({
super.key,
required this.isSelected,
required this.onSelected,
this.isEditing = false,
required this.title,
required this.onPressed,
this.isFirst = false,
this.isLast = false,
this.isDecorator = false,
this.subtitle,
this.leading,
});
@override
Widget build(BuildContext context) {
return CommonInputListItem(
title: title,
isDecorator: isDecorator,
isSelected: isSelected,
isFirst: isFirst,
isLast: isLast,
leading: leading,
onPressed: isDecorator
? null
: () {
if (isEditing) {
onSelected();
return;
}
onPressed();
},
subtitle: subtitle,
trailing: SizedBox(
width: 24,
height: 24,
child: CommonCheckBox(
value: isSelected,
isCircle: true,
onChanged: (_) {
onSelected();
},
),
),
);
}
}

View File

@@ -136,27 +136,39 @@ class _AdaptiveSheetScaffoldState extends State<AdaptiveSheetScaffold> {
);
if (bottomSheet) {
final handleSize = Size(32, 4);
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(top: 16),
child: Container(
alignment: Alignment.center,
height: handleSize.height,
width: handleSize.width,
decoration: ShapeDecoration(
color: context.colorScheme.onSurfaceVariant,
shape: RoundedSuperellipseBorder(
borderRadius: BorderRadius.circular(handleSize.height / 2),
return Container(
clipBehavior: Clip.hardEdge,
decoration: ShapeDecoration(
color: backgroundColor,
shape: RoundedSuperellipseBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(28.0)),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(top: 16),
child: Container(
alignment: Alignment.center,
height: handleSize.height,
width: handleSize.width,
decoration: ShapeDecoration(
color: context.colorScheme.onSurfaceVariant,
shape: RoundedSuperellipseBorder(
borderRadius: BorderRadius.circular(handleSize.height / 2),
),
),
),
),
),
Padding(padding: EdgeInsets.symmetric(horizontal: 8), child: appBar),
Flexible(flex: 1, child: widget.body),
SizedBox(height: MediaQuery.of(context).viewPadding.bottom),
],
Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: appBar,
),
Flexible(flex: 1, child: widget.body),
SizedBox(height: MediaQuery.of(context).viewPadding.bottom),
],
),
);
}
return CommonScaffold(

View File

@@ -122,7 +122,10 @@ class SuperGridState extends State<SuperGrid> with TickerProviderStateMixin {
_childrenNotifier.value = widget.children;
_fakeDragWidgetController = AnimationController.unbounded(vsync: this);
_fakeDragWidgetController = AnimationController.unbounded(
vsync: this,
duration: commonDuration,
);
_shakeController = AnimationController(
vsync: this,
@@ -137,6 +140,7 @@ class SuperGridState extends State<SuperGrid> with TickerProviderStateMixin {
vsync: this,
duration: commonDuration,
);
_initState();
}
@@ -225,14 +229,10 @@ class SuperGridState extends State<SuperGrid> with TickerProviderStateMixin {
final preAnimationValue = _transformAnimationMap[key]?.value;
return MapEntry(
key,
Tween(begin: preAnimationValue ?? Offset.zero, end: value.end).animate(
_transformController.drive(
Tween<double>(
begin: 0.0,
end: 1,
).chain(CurveTween(curve: Easing.emphasizedAccelerate)),
),
),
Tween(
begin: preAnimationValue ?? Offset.zero,
end: value.end,
).animate(_transformController),
);
});
@@ -265,9 +265,8 @@ class SuperGridState extends State<SuperGrid> with TickerProviderStateMixin {
if (_targetIndex == -1) {
return;
}
const tolerance = Tolerance(distance: 0.5, velocity: 0.01);
const spring = SpringDescription(mass: 1, stiffness: 100, damping: 10);
final simulation = SpringSimulation(spring, 0, 1, 0, tolerance: tolerance);
final simulation = SpringSimulation(spring, 0, 1, 0);
_fakeDragWidgetAnimation = Tween(
begin: details.offset - _parentOffset,
end: _targetOffset,
@@ -432,12 +431,7 @@ class SuperGridState extends State<SuperGrid> with TickerProviderStateMixin {
return AbsorbPointer(child: item);
},
onWillAcceptWithDetails: (_) {
debouncer.call(
FunctionTag.handleWill,
_handleWill,
args: [index],
duration: commonDuration,
);
debouncer.call(FunctionTag.handleWill, _handleWill, args: [index]);
return false;
},
);
@@ -504,7 +498,7 @@ class SuperGridState extends State<SuperGrid> with TickerProviderStateMixin {
Widget _builderItem(int index) {
final girdItem = _childrenNotifier.value[index];
final child = RepaintBoundary(child: girdItem.child);
final child = girdItem.child;
return GridItem(
mainAxisCellCount: girdItem.mainAxisCellCount,
crossAxisCellCount: girdItem.crossAxisCellCount,

View File

@@ -12,7 +12,6 @@ class CommonMinFilledButtonTheme extends StatelessWidget {
data: FilledButtonThemeData(
style: FilledButton.styleFrom(
padding: EdgeInsets.symmetric(horizontal: 8),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity: VisualDensity.compact,
),
),
@@ -33,7 +32,6 @@ class CommonMinIconButtonTheme extends StatelessWidget {
style: IconButton.styleFrom(
padding: EdgeInsets.symmetric(horizontal: 4),
visualDensity: VisualDensity.compact,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
iconSize: 20.ap,
),
),

View File

@@ -71,42 +71,48 @@ class WavePainter extends CustomPainter {
final double waveFrequency;
final Color waveColor;
late final Paint _paint;
late final Path _path;
static const int _samplePoints = 40;
static const double _twoPi = 2 * pi;
late Paint _paint;
final Path _path = Path();
Color _lastColor;
WavePainter({
required this.animationValue,
required this.waveAmplitude,
required this.waveFrequency,
required this.waveColor,
}) {
}) : _lastColor = waveColor {
_paint = Paint()
..color = waveColor
..style = PaintingStyle.fill;
_path = Path();
}
@override
void paint(Canvas canvas, Size size) {
_paint.color = waveColor;
if (waveColor != _lastColor) {
_paint = Paint()
..color = waveColor
..style = PaintingStyle.fill;
_lastColor = waveColor;
}
_path.reset();
final baseHeight = size.height / 3;
final phase = animationValue * _twoPi;
final widthFactor = _twoPi * waveFrequency / size.width;
final step = size.width / _samplePoints;
final phase = animationValue * 2 * pi;
final widthFactor = 2 * pi * waveFrequency / size.width;
_path.moveTo(0, baseHeight);
for (var i = 0; i <= _samplePoints; i++) {
final x = i * step;
for (double x = 0; x <= size.width; x += size.width / 20) {
final y = waveAmplitude * sin(x * widthFactor + phase);
_path.lineTo(x, baseHeight + y);
}
_path.lineTo(
size.width,
baseHeight + waveAmplitude * sin(size.width * widthFactor + phase),
);
_path.lineTo(size.width, size.height);
_path.lineTo(0, size.height);
_path.close();

View File

@@ -1370,14 +1370,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.4.1"
super_sliver_list:
dependency: "direct main"
description:
name: super_sliver_list
sha256: b1e1e64d08ce40e459b9bb5d9f8e361617c26b8c9f3bb967760b0f436b6e3f56
url: "https://pub.dev"
source: hosted
version: "0.4.1"
sync_http:
dependency: transitive
description:
@@ -1437,9 +1429,10 @@ packages:
tray_manager:
dependency: "direct main"
description:
path: "plugins/tray_manager/packages/tray_manager"
relative: true
source: path
name: tray_manager
sha256: c5fd83b0ae4d80be6eaedfad87aaefab8787b333b8ebd064b0e442a81006035b
url: "https://pub.dev"
source: hosted
version: "0.5.2"
typed_data:
dependency: transitive

View File

@@ -26,8 +26,7 @@ dependencies:
mobile_scanner: ^7.0.1
app_links: ^6.4.0
win32_registry: ^2.0.0
tray_manager:
path: plugins/tray_manager/packages/tray_manager
tray_manager: ^0.5.0
collection: ^1.19.1
animations: ^2.1.1
package_info_plus: ^9.0.0
@@ -61,7 +60,6 @@ dependencies:
crypto: ^3.0.3
yaml: ^3.1.3
yaml_writer: ^2.1.0
super_sliver_list: ^0.4.1
dev_dependencies:
flutter_test:
sdk: flutter
@@ -79,9 +77,8 @@ flutter:
- assets/data/
- assets/fonts/
- assets/images/
- assets/images/avatar/
- assets/images/avatars/
- assets/images/empty/
- assets/images/icon/
fonts:
- family: JetBrainsMono
fonts: