Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5fdb90da5 | ||
|
|
f9722cc761 | ||
|
|
f01fb2ed1d | ||
|
|
74f4481071 | ||
|
|
9018f512ae | ||
|
|
265fc4a701 | ||
|
|
755974fc9e | ||
|
|
ba8eab4fc9 | ||
|
|
f5cb46710f | ||
|
|
6483e80416 | ||
|
|
535e6dc3a5 | ||
|
|
ad86c20cfb | ||
|
|
665330e17a | ||
|
|
0eb001e717 | ||
|
|
a563991d74 | ||
|
|
3e2a30008c | ||
|
|
ff68d573d6 | ||
|
|
3223fca7ba | ||
|
|
006f9127fc | ||
|
|
a2709e155c | ||
|
|
684fa7b58e | ||
|
|
03b4da54b5 | ||
|
|
a904b55d11 | ||
|
|
d711935e2e | ||
|
|
98b1496eff | ||
|
|
442c32b6eb | ||
|
|
949a2aaac3 | ||
|
|
c77463f337 | ||
|
|
00377d6070 | ||
|
|
f393b4b3e9 | ||
|
|
75e6cfde15 | ||
|
|
7bfe5617d9 | ||
|
|
97cc96c243 | ||
|
|
1821ee2f61 |
Submodule core/Clash.Meta updated: 1c46eb82bf...9b94b9c339
@@ -51,7 +51,6 @@ class Application extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ApplicationState extends State<Application> {
|
class ApplicationState extends State<Application> {
|
||||||
late AppController appController;
|
|
||||||
late SystemColorSchemes systemColorSchemes;
|
late SystemColorSchemes systemColorSchemes;
|
||||||
|
|
||||||
ColorScheme _getAppColorScheme({
|
ColorScheme _getAppColorScheme({
|
||||||
@@ -72,10 +71,10 @@ class ApplicationState extends State<Application> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
appController = AppController(context);
|
globalState.appController = AppController(context);
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
appController.afterInit();
|
globalState.appController.afterInit();
|
||||||
appController.initLink();
|
globalState.appController.initLink();
|
||||||
_updateGroups();
|
_updateGroups();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -105,7 +104,7 @@ class ApplicationState extends State<Application> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
appController.updateSystemColorSchemes(systemColorSchemes);
|
globalState.appController.updateSystemColorSchemes(systemColorSchemes);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,11 +113,13 @@ class ApplicationState extends State<Application> {
|
|||||||
globalState.groupsUpdateTimer?.cancel();
|
globalState.groupsUpdateTimer?.cancel();
|
||||||
globalState.groupsUpdateTimer = null;
|
globalState.groupsUpdateTimer = null;
|
||||||
}
|
}
|
||||||
globalState.groupsUpdateTimer ??=
|
globalState.groupsUpdateTimer ??= Timer.periodic(
|
||||||
Timer.periodic(appConstant.httpTimeoutDuration, (timer) async {
|
appConstant.httpTimeoutDuration,
|
||||||
await appController.updateGroups();
|
(timer) async {
|
||||||
appController.appState.sortNum++;
|
await globalState.appController.updateGroups();
|
||||||
});
|
globalState.appController.appState.sortNum++;
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -145,9 +146,9 @@ class ApplicationState extends State<Application> {
|
|||||||
GlobalWidgetsLocalizations.delegate
|
GlobalWidgetsLocalizations.delegate
|
||||||
],
|
],
|
||||||
title: appConstant.name,
|
title: appConstant.name,
|
||||||
locale: Other.getLocaleForString(state.locale),
|
locale: other.getLocaleForString(state.locale),
|
||||||
supportedLocales:
|
supportedLocales:
|
||||||
AppLocalizations.delegate.supportedLocales,
|
AppLocalizations.delegate.supportedLocales,
|
||||||
themeMode: state.themeMode,
|
themeMode: state.themeMode,
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
@@ -180,7 +181,7 @@ class ApplicationState extends State<Application> {
|
|||||||
@override
|
@override
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
linkManager.destroy();
|
linkManager.destroy();
|
||||||
await appController.savePreferences();
|
await globalState.appController.savePreferences();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export 'num.dart';
|
|||||||
export 'navigation.dart';
|
export 'navigation.dart';
|
||||||
export 'window.dart';
|
export 'window.dart';
|
||||||
export 'system.dart';
|
export 'system.dart';
|
||||||
export 'file.dart';
|
export 'picker.dart';
|
||||||
export 'android.dart';
|
export 'android.dart';
|
||||||
export 'launch.dart';
|
export 'launch.dart';
|
||||||
export 'protocol.dart';
|
export 'protocol.dart';
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import 'dart:ui';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
const appName = "FlClash";
|
||||||
|
|
||||||
class AppConstant {
|
class AppConstant {
|
||||||
final packageName = "com.follow.clash";
|
final packageName = "com.follow.clash";
|
||||||
final name = "FlClash";
|
final name = "FlClash";
|
||||||
|
|||||||
@@ -1,15 +1,7 @@
|
|||||||
import 'package:fl_clash/application.dart';
|
|
||||||
import 'package:fl_clash/controller.dart';
|
|
||||||
import 'package:fl_clash/widgets/scaffold.dart';
|
import 'package:fl_clash/widgets/scaffold.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
extension BuildContextExtension on BuildContext {
|
extension BuildContextExtension on BuildContext {
|
||||||
AppController get appController {
|
|
||||||
final appController =
|
|
||||||
findAncestorStateOfType<ApplicationState>()?.appController;
|
|
||||||
assert(appController != null, "only use application environment");
|
|
||||||
return appController!;
|
|
||||||
}
|
|
||||||
|
|
||||||
CommonScaffoldState? get commonScaffoldState {
|
CommonScaffoldState? get commonScaffoldState {
|
||||||
return findAncestorStateOfType<CommonScaffoldState>();
|
return findAncestorStateOfType<CommonScaffoldState>();
|
||||||
|
|||||||
@@ -1,23 +1,27 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:isolate';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:zxing2/qrcode.dart';
|
||||||
|
import 'package:image/image.dart' as img;
|
||||||
|
|
||||||
class Other {
|
class Other {
|
||||||
static Color? getDelayColor(int? delay) {
|
Color? getDelayColor(int? delay) {
|
||||||
if (delay == null) return null;
|
if (delay == null) return null;
|
||||||
if (delay < 0) return Colors.red;
|
if (delay < 0) return Colors.red;
|
||||||
if (delay < 600) return Colors.green;
|
if (delay < 600) return Colors.green;
|
||||||
return const Color(0xFFC57F0A);
|
return const Color(0xFFC57F0A);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getDateStringLast2(int value) {
|
String getDateStringLast2(int value) {
|
||||||
var valueRaw = "0$value";
|
var valueRaw = "0$value";
|
||||||
return valueRaw.substring(
|
return valueRaw.substring(
|
||||||
valueRaw.length - 2,
|
valueRaw.length - 2,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getTimeDifference(DateTime dateTime) {
|
String getTimeDifference(DateTime dateTime) {
|
||||||
var currentDateTime = DateTime.now();
|
var currentDateTime = DateTime.now();
|
||||||
var difference = currentDateTime.difference(dateTime);
|
var difference = currentDateTime.difference(dateTime);
|
||||||
var inHours = difference.inHours;
|
var inHours = difference.inHours;
|
||||||
@@ -27,7 +31,7 @@ class Other {
|
|||||||
return "${getDateStringLast2(inHours)}:${getDateStringLast2(inMinutes)}:${getDateStringLast2(inSeconds)}";
|
return "${getDateStringLast2(inHours)}:${getDateStringLast2(inMinutes)}:${getDateStringLast2(inSeconds)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getTimeText(int? timeStamp) {
|
String getTimeText(int? timeStamp) {
|
||||||
if (timeStamp == null) {
|
if (timeStamp == null) {
|
||||||
return '00:00:00';
|
return '00:00:00';
|
||||||
}
|
}
|
||||||
@@ -39,7 +43,7 @@ class Other {
|
|||||||
return "${getDateStringLast2(inHours)}:${getDateStringLast2(inMinutes)}:${getDateStringLast2(inSeconds)}";
|
return "${getDateStringLast2(inHours)}:${getDateStringLast2(inMinutes)}:${getDateStringLast2(inSeconds)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
static Locale? getLocaleForString(String? localString) {
|
Locale? getLocaleForString(String? localString) {
|
||||||
if (localString == null) return null;
|
if (localString == null) return null;
|
||||||
var localSplit = localString.split("_");
|
var localSplit = localString.split("_");
|
||||||
if (localSplit.length == 1) {
|
if (localSplit.length == 1) {
|
||||||
@@ -57,7 +61,7 @@ class Other {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sortByChar(String a, String b) {
|
int sortByChar(String a, String b) {
|
||||||
if (a.isEmpty && b.isEmpty) {
|
if (a.isEmpty && b.isEmpty) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -77,7 +81,7 @@ class Other {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getOverwriteLabel(String label) {
|
String getOverwriteLabel(String label) {
|
||||||
final reg = RegExp(r'\((\d+)\)$');
|
final reg = RegExp(r'\((\d+)\)$');
|
||||||
final matches = reg.allMatches(label);
|
final matches = reg.allMatches(label);
|
||||||
if (matches.isNotEmpty) {
|
if (matches.isNotEmpty) {
|
||||||
@@ -89,21 +93,7 @@ class Other {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static FutureOr<void> Function(T p) debounce<T>(void Function(T? p) func,
|
String getTrayIconPath() {
|
||||||
// {Duration? duration}) {
|
|
||||||
// Timer? timer;
|
|
||||||
// return ([T? p]) {
|
|
||||||
// if (timer != null) {
|
|
||||||
// timer?.cancel();
|
|
||||||
// }
|
|
||||||
// timer = Timer(duration ?? const Duration(milliseconds: 300), () {
|
|
||||||
// func(p);
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
static String getTrayIconPath() {
|
|
||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
return "assets/images/app_icon.ico";
|
return "assets/images/app_icon.ico";
|
||||||
} else {
|
} else {
|
||||||
@@ -111,7 +101,7 @@ class Other {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compareVersions(String version1, String version2) {
|
int compareVersions(String version1, String version2) {
|
||||||
List<String> v1 = version1.split('+')[0].split('.');
|
List<String> v1 = version1.split('+')[0].split('.');
|
||||||
List<String> v2 = version2.split('+')[0].split('.');
|
List<String> v2 = version2.split('+')[0].split('.');
|
||||||
int major1 = int.parse(v1[0]);
|
int major1 = int.parse(v1[0]);
|
||||||
@@ -133,4 +123,30 @@ class Other {
|
|||||||
int build2 = version2.contains('+') ? int.parse(version2.split('+')[1]) : 0;
|
int build2 = version2.contains('+') ? int.parse(version2.split('+')[1]) : 0;
|
||||||
return build1.compareTo(build2);
|
return build1.compareTo(build2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String?> parseQRCode(Uint8List? bytes) {
|
||||||
|
return Isolate.run<String?>(() {
|
||||||
|
if (bytes == null) return null;
|
||||||
|
img.Image? image = img.decodeImage(bytes);
|
||||||
|
LuminanceSource source = RGBLuminanceSource(
|
||||||
|
image!.width,
|
||||||
|
image.height,
|
||||||
|
image
|
||||||
|
.convert(numChannels: 4)
|
||||||
|
.getBytes(order: img.ChannelOrder.abgr)
|
||||||
|
.buffer
|
||||||
|
.asInt32List(),
|
||||||
|
);
|
||||||
|
final bitmap = BinaryBitmap(GlobalHistogramBinarizer(source));
|
||||||
|
final reader = QRCodeReader();
|
||||||
|
try {
|
||||||
|
final result = reader.decode(bitmap);
|
||||||
|
return result.text;
|
||||||
|
} catch (_) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final other = Other();
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:fl_clash/common/app_localizations.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
|
||||||
class FileUtil {
|
class Picker {
|
||||||
static Future<Result<PlatformFile>> pickerConfig() async {
|
Future<Result<PlatformFile>> pickerConfigFile() async {
|
||||||
FilePickerResult? filePickerResult;
|
FilePickerResult? filePickerResult;
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
filePickerResult = await FilePicker.platform.pickFiles(
|
filePickerResult = await FilePicker.platform.pickFiles(
|
||||||
@@ -26,4 +27,17 @@ class FileUtil {
|
|||||||
}
|
}
|
||||||
return Result.success(data: file);
|
return Result.success(data: file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<Result<String>> pickerConfigQRCode() async {
|
||||||
|
final xFile = await ImagePicker().pickImage(source: ImageSource.gallery);
|
||||||
|
final bytes = await xFile?.readAsBytes();
|
||||||
|
if (bytes == null) return Result.error();
|
||||||
|
final result = await other.parseQRCode(bytes);
|
||||||
|
if (result == null || !result.isUrl) {
|
||||||
|
return Result.error(message: appLocalizations.pleaseUploadValidQrcode);
|
||||||
|
}
|
||||||
|
return Result.success(data: result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final picker = Picker();
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../models/models.dart';
|
import '../models/models.dart';
|
||||||
@@ -29,8 +28,7 @@ class Preferences {
|
|||||||
try {
|
try {
|
||||||
return ClashConfig.fromJson(clashConfigMap);
|
return ClashConfig.fromJson(clashConfigMap);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint(e.toString());
|
throw e.toString();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,8 +48,7 @@ class Preferences {
|
|||||||
try {
|
try {
|
||||||
return Config.fromJson(configMap);
|
return Config.fromJson(configMap);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint(e.toString());
|
throw e.toString();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class Request {
|
|||||||
final packageInfo = await appPackage.packageInfoCompleter.future;
|
final packageInfo = await appPackage.packageInfoCompleter.future;
|
||||||
final version = packageInfo.version;
|
final version = packageInfo.version;
|
||||||
final hasUpdate =
|
final hasUpdate =
|
||||||
Other.compareVersions(remoteVersion.replaceAll('v', ''), version) > 0;
|
other.compareVersions(remoteVersion.replaceAll('v', ''), version) > 0;
|
||||||
if (!hasUpdate) return Result.error();
|
if (!hasUpdate) return Result.error();
|
||||||
return Result.success(data: body['body']);
|
return Result.success(data: body['body']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ class AppController {
|
|||||||
updateRunTime,
|
updateRunTime,
|
||||||
updateTraffic,
|
updateTraffic,
|
||||||
];
|
];
|
||||||
|
clearShowProxyDelay();
|
||||||
|
testShowProxyDelay();
|
||||||
} else {
|
} else {
|
||||||
await globalState.stopSystemProxy();
|
await globalState.stopSystemProxy();
|
||||||
appState.traffics = [];
|
appState.traffics = [];
|
||||||
@@ -221,6 +223,7 @@ class AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
healthcheck() {
|
healthcheck() {
|
||||||
|
if(globalState.healthcheckLock) return;
|
||||||
for (final delay in appState.delayMap.entries) {
|
for (final delay in appState.delayMap.entries) {
|
||||||
setDelay(
|
setDelay(
|
||||||
Delay(
|
Delay(
|
||||||
@@ -267,31 +270,6 @@ class AppController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addProfileFormURL(String url) async {
|
|
||||||
globalState.navigatorKey.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
toProfiles();
|
|
||||||
final commonScaffoldState = globalState.homeScaffoldKey.currentState;
|
|
||||||
if (commonScaffoldState?.mounted != true) return;
|
|
||||||
commonScaffoldState?.loadingRun(
|
|
||||||
() async {
|
|
||||||
await Future.delayed(const Duration(milliseconds: 300));
|
|
||||||
final profile = Profile(
|
|
||||||
url: url,
|
|
||||||
);
|
|
||||||
final res = await profile.update();
|
|
||||||
if (res.type == ResultType.success) {
|
|
||||||
addProfile(profile);
|
|
||||||
} else {
|
|
||||||
debugPrint(res.message);
|
|
||||||
globalState.showMessage(
|
|
||||||
title: "${appLocalizations.add}${appLocalizations.profile}",
|
|
||||||
message: TextSpan(text: res.message!),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
initLink() {
|
initLink() {
|
||||||
linkManager.initAppLinksListen(
|
linkManager.initAppLinksListen(
|
||||||
(url) {
|
(url) {
|
||||||
@@ -321,8 +299,33 @@ class AppController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addProfileFormURL(String url) async {
|
||||||
|
globalState.navigatorKey.currentState?.popUntil((route) => route.isFirst);
|
||||||
|
toProfiles();
|
||||||
|
final commonScaffoldState = globalState.homeScaffoldKey.currentState;
|
||||||
|
if (commonScaffoldState?.mounted != true) return;
|
||||||
|
commonScaffoldState?.loadingRun(
|
||||||
|
() async {
|
||||||
|
await Future.delayed(const Duration(milliseconds: 300));
|
||||||
|
final profile = Profile(
|
||||||
|
url: url,
|
||||||
|
);
|
||||||
|
final res = await profile.update();
|
||||||
|
if (res.type == ResultType.success) {
|
||||||
|
addProfile(profile);
|
||||||
|
} else {
|
||||||
|
debugPrint(res.message);
|
||||||
|
globalState.showMessage(
|
||||||
|
title: "${appLocalizations.add}${appLocalizations.profile}",
|
||||||
|
message: TextSpan(text: res.message!),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
addProfileFormFile() async {
|
addProfileFormFile() async {
|
||||||
final result = await FileUtil.pickerConfig();
|
final result = await picker.pickerConfigFile();
|
||||||
if (result.type == ResultType.error) return;
|
if (result.type == ResultType.error) return;
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
globalState.navigatorKey.currentState?.popUntil((route) => route.isFirst);
|
globalState.navigatorKey.currentState?.popUntil((route) => route.isFirst);
|
||||||
@@ -351,6 +354,22 @@ class AppController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addProfileFormQrCode() async {
|
||||||
|
final result = await picker.pickerConfigQRCode();
|
||||||
|
if (result.type == ResultType.error) {
|
||||||
|
if(result.message != null){
|
||||||
|
globalState.showMessage(
|
||||||
|
title: appLocalizations.tip,
|
||||||
|
message: TextSpan(
|
||||||
|
text: result.message,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
addProfileFormURL(result.data!);
|
||||||
|
}
|
||||||
|
|
||||||
clearShowProxyDelay() {
|
clearShowProxyDelay() {
|
||||||
final showProxyDelay = appState.getRealProxyName(appState.showProxyName);
|
final showProxyDelay = appState.getRealProxyName(appState.showProxyName);
|
||||||
if (showProxyDelay != null) {
|
if (showProxyDelay != null) {
|
||||||
@@ -359,4 +378,11 @@ class AppController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testShowProxyDelay() {
|
||||||
|
final showProxyDelay = appState.getRealProxyName(appState.showProxyName);
|
||||||
|
if (showProxyDelay != null) {
|
||||||
|
globalState.updateCurrentDelay(showProxyDelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:fl_clash/enum/enum.dart';
|
|||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
import 'package:fl_clash/plugins/app.dart';
|
import 'package:fl_clash/plugins/app.dart';
|
||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:fl_clash/widgets/widgets.dart';
|
import 'package:fl_clash/widgets/widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -292,9 +293,9 @@ class AccessFragment extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (context.appController.appState.packages.isEmpty) {
|
if (globalState.appController.appState.packages.isEmpty) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
context.appController.updatePackages();
|
globalState.appController.updatePackages();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Selector<Config, bool>(
|
return Selector<Config, bool>(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:fl_clash/widgets/widgets.dart';
|
import 'package:fl_clash/widgets/widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@@ -39,13 +40,13 @@ class ApplicationSettingFragment extends StatelessWidget {
|
|||||||
selector: (_, config) => config.isCompatible,
|
selector: (_, config) => config.isCompatible,
|
||||||
builder: (_, isCompatible, __) {
|
builder: (_, isCompatible, __) {
|
||||||
return ListItem.switchItem(
|
return ListItem.switchItem(
|
||||||
leading: const Icon(Icons.device_hub),
|
leading: const Icon(Icons.expand),
|
||||||
title: const Text("兼容模式"),
|
title: Text(appLocalizations.compatible),
|
||||||
subtitle: const Text("开启将失去部分应用能力,获得全量的Clash的支持"),
|
subtitle: Text(appLocalizations.compatibleDesc),
|
||||||
delegate: SwitchDelegate(
|
delegate: SwitchDelegate(
|
||||||
value: isCompatible,
|
value: isCompatible,
|
||||||
onChanged: (bool value) async {
|
onChanged: (bool value) async {
|
||||||
final appController = context.appController;
|
final appController = globalState.appController;
|
||||||
appController.config.isCompatible = value;
|
appController.config.isCompatible = value;
|
||||||
await appController.updateClashConfig(isPatch: false);
|
await appController.updateClashConfig(isPatch: false);
|
||||||
await appController.updateGroups();
|
await appController.updateGroups();
|
||||||
@@ -120,7 +121,7 @@ class ApplicationSettingFragment extends StatelessWidget {
|
|||||||
onChanged: (bool value) {
|
onChanged: (bool value) {
|
||||||
final config = context.read<Config>();
|
final config = context.read<Config>();
|
||||||
config.openLogs = value;
|
config.openLogs = value;
|
||||||
context.appController.updateLogStatus();
|
globalState.appController.updateLogStatus();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ class _ConfigFragmentState extends State<ConfigFragment> {
|
|||||||
try {
|
try {
|
||||||
final mixedPort = int.parse(port);
|
final mixedPort = int.parse(port);
|
||||||
if (mixedPort < 1024 || mixedPort > 49151) throw "Invalid port";
|
if (mixedPort < 1024 || mixedPort > 49151) throw "Invalid port";
|
||||||
context.appController.clashConfig.mixedPort = mixedPort;
|
globalState.appController.clashConfig.mixedPort = mixedPort;
|
||||||
context.appController.updateClashConfigDebounce();
|
globalState.appController.updateClashConfigDebounce();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
globalState.showMessage(
|
globalState.showMessage(
|
||||||
title: appLocalizations.proxyPort,
|
title: appLocalizations.proxyPort,
|
||||||
@@ -39,9 +39,9 @@ class _ConfigFragmentState extends State<ConfigFragment> {
|
|||||||
|
|
||||||
_updateLoglevel(LogLevel? logLevel) {
|
_updateLoglevel(LogLevel? logLevel) {
|
||||||
if (logLevel == null ||
|
if (logLevel == null ||
|
||||||
logLevel == context.appController.clashConfig.logLevel) return;
|
logLevel == globalState.appController.clashConfig.logLevel) return;
|
||||||
context.appController.clashConfig.logLevel = logLevel;
|
globalState.appController.clashConfig.logLevel = logLevel;
|
||||||
context.appController.updateClashConfigDebounce();
|
globalState.appController.updateClashConfigDebounce();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -59,12 +59,31 @@ class _ConfigFragmentState extends State<ConfigFragment> {
|
|||||||
onChanged: (bool value) async {
|
onChanged: (bool value) async {
|
||||||
final clashConfig = context.read<ClashConfig>();
|
final clashConfig = context.read<ClashConfig>();
|
||||||
clashConfig.allowLan = value;
|
clashConfig.allowLan = value;
|
||||||
context.appController.updateClashConfigDebounce();
|
globalState.appController.updateClashConfigDebounce();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
if (system.isDesktop)
|
||||||
|
Selector<ClashConfig, bool>(
|
||||||
|
selector: (_, clashConfig) => clashConfig.tun.enable,
|
||||||
|
builder: (_, tunEnable, __) {
|
||||||
|
return ListItem.switchItem(
|
||||||
|
leading: const Icon(Icons.support),
|
||||||
|
title: Text(appLocalizations.tun),
|
||||||
|
subtitle: Text(appLocalizations.tunDesc),
|
||||||
|
delegate: SwitchDelegate(
|
||||||
|
value: tunEnable,
|
||||||
|
onChanged: (bool value) async {
|
||||||
|
final clashConfig = context.read<ClashConfig>();
|
||||||
|
clashConfig.tun = Tun(enable: value);
|
||||||
|
globalState.appController.updateClashConfigDebounce();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
Selector<ClashConfig, int>(
|
Selector<ClashConfig, int>(
|
||||||
selector: (_, clashConfig) => clashConfig.mixedPort,
|
selector: (_, clashConfig) => clashConfig.mixedPort,
|
||||||
builder: (_, mixedPort, __) {
|
builder: (_, mixedPort, __) {
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
|||||||
if (!isCurrent || currentProxyName == null || !isInit) return;
|
if (!isCurrent || currentProxyName == null || !isInit) return;
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
if (delay == null) {
|
if (delay == null) {
|
||||||
context.appController.setDelay(
|
globalState.appController.setDelay(
|
||||||
Delay(
|
Delay(
|
||||||
name: currentProxyName,
|
name: currentProxyName,
|
||||||
value: 0,
|
value: 0,
|
||||||
@@ -95,30 +95,6 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateCurrentDelayContainer(Widget child) {
|
|
||||||
return Selector2<AppState, Config, UpdateCurrentDelaySelectorState>(
|
|
||||||
selector: (_, appState, config) {
|
|
||||||
return UpdateCurrentDelaySelectorState(
|
|
||||||
isInit: appState.isInit,
|
|
||||||
currentProxyName: appState.getRealProxyName(appState.showProxyName),
|
|
||||||
delay: appState
|
|
||||||
.delayMap[appState.getRealProxyName(appState.showProxyName)],
|
|
||||||
isCurrent: appState.currentLabel == 'dashboard',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
builder: (_, state, __) {
|
|
||||||
_updateCurrentDelay(
|
|
||||||
state.currentProxyName,
|
|
||||||
state.delay,
|
|
||||||
state.isCurrent,
|
|
||||||
state.isInit,
|
|
||||||
);
|
|
||||||
return child;
|
|
||||||
},
|
|
||||||
child: child,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CommonCard(
|
return CommonCard(
|
||||||
@@ -126,57 +102,55 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
|||||||
iconData: Icons.network_check,
|
iconData: Icons.network_check,
|
||||||
label: appLocalizations.networkDetection,
|
label: appLocalizations.networkDetection,
|
||||||
),
|
),
|
||||||
child: _updateCurrentDelayContainer(
|
child: Selector<AppState, NetworkDetectionSelectorState>(
|
||||||
Selector<AppState, NetworkDetectionSelectorState>(
|
selector: (_, appState) {
|
||||||
selector: (_, appState) {
|
return NetworkDetectionSelectorState(
|
||||||
return NetworkDetectionSelectorState(
|
currentProxyName: appState.showProxyName,
|
||||||
currentProxyName: appState.showProxyName,
|
delay: appState.getDelay(
|
||||||
delay: appState.getDelay(
|
appState.showProxyName,
|
||||||
appState.showProxyName,
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
builder: (_, state, __) {
|
||||||
builder: (_, state, __) {
|
return Container(
|
||||||
return Container(
|
padding: const EdgeInsets.all(16).copyWith(top: 0),
|
||||||
padding: const EdgeInsets.all(16).copyWith(top: 0),
|
child: Column(
|
||||||
child: Column(
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisSize: MainAxisSize.min,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: [
|
||||||
children: [
|
Flexible(
|
||||||
Flexible(
|
flex: 0,
|
||||||
flex: 0,
|
child: TooltipText(
|
||||||
child: TooltipText(
|
text: Text(
|
||||||
text: Text(
|
state.currentProxyName ?? appLocalizations.noProxy,
|
||||||
state.currentProxyName ?? appLocalizations.noProxy,
|
overflow: TextOverflow.ellipsis,
|
||||||
overflow: TextOverflow.ellipsis,
|
maxLines: 1,
|
||||||
maxLines: 1,
|
style: Theme.of(context)
|
||||||
style: Theme.of(context)
|
.textTheme
|
||||||
.textTheme
|
.titleMedium
|
||||||
.titleMedium
|
?.toSoftBold(),
|
||||||
?.toSoftBold(),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 8,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Container(
|
||||||
|
height: globalState.appController.measure.titleLargeHeight,
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: FadeBox(
|
||||||
|
child: _buildDescription(
|
||||||
|
state.currentProxyName,
|
||||||
|
state.delay,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 8,
|
],
|
||||||
),
|
),
|
||||||
Flexible(
|
);
|
||||||
child: Container(
|
},
|
||||||
height: context.appController.measure.titleLargeHeight,
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: FadeBox(
|
|
||||||
child: _buildDescription(
|
|
||||||
state.currentProxyName,
|
|
||||||
state.delay,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:fl_clash/widgets/widgets.dart';
|
import 'package:fl_clash/widgets/widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -68,7 +69,7 @@ class _NetworkSpeedState extends State<NetworkSpeed> {
|
|||||||
style: bodyMedium,
|
style: bodyMedium,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
);
|
);
|
||||||
final size = context.appController.measure.computeTextSize(valueText);
|
final size = globalState.appController.measure.computeTextSize(valueText);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/enum/enum.dart';
|
import 'package:fl_clash/enum/enum.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:fl_clash/widgets/widgets.dart';
|
import 'package:fl_clash/widgets/widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@@ -10,7 +11,7 @@ class OutboundMode extends StatelessWidget {
|
|||||||
const OutboundMode({super.key});
|
const OutboundMode({super.key});
|
||||||
|
|
||||||
_changeMode(BuildContext context, Mode? value) async {
|
_changeMode(BuildContext context, Mode? value) async {
|
||||||
final appController = context.appController;
|
final appController = globalState.appController;
|
||||||
final clashConfig = appController.clashConfig;
|
final clashConfig = appController.clashConfig;
|
||||||
final config = appController.config;
|
final config = appController.config;
|
||||||
if (value == null || clashConfig.mode == value) return;
|
if (value == null || clashConfig.mode == value) return;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -48,11 +49,8 @@ class _StartButtonState extends State<StartButton>
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateSystemProxy() async {
|
updateSystemProxy() async {
|
||||||
final appController = context.appController;
|
final appController = globalState.appController;
|
||||||
await appController.updateSystemProxy(isStart);
|
await appController.updateSystemProxy(isStart);
|
||||||
if (isStart && mounted) {
|
|
||||||
appController.clearShowProxyDelay();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -66,10 +64,10 @@ class _StartButtonState extends State<StartButton>
|
|||||||
if (!state.isInit || !state.hasProfile) {
|
if (!state.isInit || !state.hasProfile) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
final textWidth = context.appController.measure
|
final textWidth = globalState.appController.measure
|
||||||
.computeTextSize(
|
.computeTextSize(
|
||||||
Text(
|
Text(
|
||||||
Other.getTimeDifference(
|
other.getTimeDifference(
|
||||||
DateTime.now(),
|
DateTime.now(),
|
||||||
),
|
),
|
||||||
style:
|
style:
|
||||||
@@ -133,7 +131,7 @@ class _StartButtonState extends State<StartButton>
|
|||||||
child: Selector<AppState, int?>(
|
child: Selector<AppState, int?>(
|
||||||
selector: (_, appState) => appState.runTime,
|
selector: (_, appState) => appState.runTime,
|
||||||
builder: (_, int? value, __) {
|
builder: (_, int? value, __) {
|
||||||
final text = Other.getTimeText(value);
|
final text = other.getTimeText(value);
|
||||||
return Text(
|
return Text(
|
||||||
text,
|
text,
|
||||||
style: Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
style: Theme.of(context).textTheme.titleMedium?.toSoftBold(),
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'dart:io';
|
|
||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/pages/scan.dart';
|
import 'package:fl_clash/pages/scan.dart';
|
||||||
import 'package:fl_clash/state.dart';
|
import 'package:fl_clash/state.dart';
|
||||||
@@ -8,17 +7,21 @@ import 'package:flutter/material.dart';
|
|||||||
class AddProfile extends StatelessWidget {
|
class AddProfile extends StatelessWidget {
|
||||||
final BuildContext context;
|
final BuildContext context;
|
||||||
|
|
||||||
const AddProfile({super.key, required this.context});
|
const AddProfile({super.key, required this.context,});
|
||||||
|
|
||||||
_handleAddProfileFormFile() async {
|
_handleAddProfileFormFile() async {
|
||||||
context.appController.addProfileFormFile();
|
globalState.appController.addProfileFormFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleAddProfileFormURL(String url) async {
|
_handleAddProfileFormURL(String url) async {
|
||||||
context.appController.addProfileFormURL(url);
|
globalState.appController.addProfileFormURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
_toScan() async {
|
_toScan() async {
|
||||||
|
if(system.isDesktop){
|
||||||
|
globalState.appController.addProfileFormQrCode();
|
||||||
|
return;
|
||||||
|
}
|
||||||
final url = await Navigator.of(context)
|
final url = await Navigator.of(context)
|
||||||
.push<String>(MaterialPageRoute(builder: (_) => const ScanPage()));
|
.push<String>(MaterialPageRoute(builder: (_) => const ScanPage()));
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
@@ -39,7 +42,6 @@ class AddProfile extends StatelessWidget {
|
|||||||
Widget build(context) {
|
Widget build(context) {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: [
|
children: [
|
||||||
if (Platform.isAndroid)
|
|
||||||
ListItem(
|
ListItem(
|
||||||
leading: const Icon(Icons.qr_code),
|
leading: const Icon(Icons.qr_code),
|
||||||
title: Text(appLocalizations.qrcode),
|
title: Text(appLocalizations.qrcode),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:fl_clash/widgets/widgets.dart';
|
import 'package:fl_clash/widgets/widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -38,7 +39,7 @@ class _EditProfileState extends State<EditProfile> {
|
|||||||
|
|
||||||
_handleConfirm() {
|
_handleConfirm() {
|
||||||
if (!_formKey.currentState!.validate()) return;
|
if (!_formKey.currentState!.validate()) return;
|
||||||
final config = context.read<Config>();
|
final config = widget.context.read<Config>();
|
||||||
final hasUpdate = widget.profile.url != urlController.text;
|
final hasUpdate = widget.profile.url != urlController.text;
|
||||||
widget.profile.url = urlController.text;
|
widget.profile.url = urlController.text;
|
||||||
widget.profile.label = labelController.text;
|
widget.profile.label = labelController.text;
|
||||||
@@ -48,7 +49,7 @@ class _EditProfileState extends State<EditProfile> {
|
|||||||
config.setProfile(widget.profile);
|
config.setProfile(widget.profile);
|
||||||
if (hasUpdate) {
|
if (hasUpdate) {
|
||||||
widget.context.findAncestorStateOfType<CommonScaffoldState>()?.loadingRun(
|
widget.context.findAncestorStateOfType<CommonScaffoldState>()?.loadingRun(
|
||||||
() => context.appController.updateProfile(
|
() => globalState.appController.updateProfile(
|
||||||
widget.profile.id,
|
widget.profile.id,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:fl_clash/fragments/profiles/edit_profile.dart';
|
import 'package:fl_clash/fragments/profiles/edit_profile.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:fl_clash/widgets/widgets.dart';
|
import 'package:fl_clash/widgets/widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
|
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
|
||||||
@@ -24,7 +25,6 @@ class ProfilesFragment extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ProfilesFragmentState extends State<ProfilesFragment> {
|
class _ProfilesFragmentState extends State<ProfilesFragment> {
|
||||||
|
|
||||||
String _getLastUpdateTimeDifference(DateTime lastDateTime) {
|
String _getLastUpdateTimeDifference(DateTime lastDateTime) {
|
||||||
final currentDateTime = DateTime.now();
|
final currentDateTime = DateTime.now();
|
||||||
final difference = currentDateTime.difference(lastDateTime);
|
final difference = currentDateTime.difference(lastDateTime);
|
||||||
@@ -50,12 +50,12 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_handleDeleteProfile(String id) async {
|
_handleDeleteProfile(String id) async {
|
||||||
context.appController.deleteProfile(id);
|
globalState.appController.deleteProfile(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleUpdateProfile(String id) async {
|
_handleUpdateProfile(String id) async {
|
||||||
context.findAncestorStateOfType<CommonScaffoldState>()?.loadingRun(
|
context.findAncestorStateOfType<CommonScaffoldState>()?.loadingRun(
|
||||||
() => context.appController.updateProfile(id),
|
() => globalState.appController.updateProfile(id),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,9 +175,9 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
|
|||||||
|
|
||||||
_handleShowAddExtendPage() {
|
_handleShowAddExtendPage() {
|
||||||
showExtendPage(
|
showExtendPage(
|
||||||
context,
|
globalState.navigatorKey.currentState!.context,
|
||||||
body: AddProfile(
|
body: AddProfile(
|
||||||
context: context,
|
context: globalState.navigatorKey.currentState!.context,
|
||||||
),
|
),
|
||||||
title: "${appLocalizations.add}${appLocalizations.profile}",
|
title: "${appLocalizations.add}${appLocalizations.profile}",
|
||||||
);
|
);
|
||||||
@@ -210,7 +210,7 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
|
|||||||
child: _profileItem(
|
child: _profileItem(
|
||||||
profile: profile,
|
profile: profile,
|
||||||
groupValue: state.currentProfileId,
|
groupValue: state.currentProfileId,
|
||||||
onChanged: context.appController.changeProfileDebounce,
|
onChanged: globalState.appController.changeProfileDebounce,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ class ProxiesTabView extends StatelessWidget {
|
|||||||
List<Proxy> _sortOfName(List<Proxy> proxies) {
|
List<Proxy> _sortOfName(List<Proxy> proxies) {
|
||||||
return List.of(proxies)
|
return List.of(proxies)
|
||||||
..sort(
|
..sort(
|
||||||
(a, b) => Other.sortByChar(a.name, b.name),
|
(a, b) => other.sortByChar(a.name, b.name),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,8 +149,8 @@ class ProxiesTabView extends StatelessWidget {
|
|||||||
return proxies = List.of(proxies)
|
return proxies = List.of(proxies)
|
||||||
..sort(
|
..sort(
|
||||||
(a, b) {
|
(a, b) {
|
||||||
final aDelay = appState.delayMap[a.name];
|
final aDelay = appState.getDelay(a.name);
|
||||||
final bDelay = appState.delayMap[b.name];
|
final bDelay = appState.getDelay(b.name);
|
||||||
if (aDelay == null && bDelay == null) {
|
if (aDelay == null && bDelay == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ class ProxiesTabView extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double _getItemHeight(BuildContext context) {
|
double _getItemHeight(BuildContext context) {
|
||||||
final measure = context.appController.measure;
|
final measure = globalState.appController.measure;
|
||||||
return 12 * 2 +
|
return 12 * 2 +
|
||||||
measure.bodyMediumHeight * 2 +
|
measure.bodyMediumHeight * 2 +
|
||||||
measure.bodySmallHeight +
|
measure.bodySmallHeight +
|
||||||
@@ -192,7 +192,7 @@ class ProxiesTabView extends StatelessWidget {
|
|||||||
required bool isSelected,
|
required bool isSelected,
|
||||||
required Proxy proxy,
|
required Proxy proxy,
|
||||||
}) {
|
}) {
|
||||||
final measure = context.appController.measure;
|
final measure = globalState.appController.measure;
|
||||||
return CommonCard(
|
return CommonCard(
|
||||||
isSelected: isSelected,
|
isSelected: isSelected,
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
@@ -276,7 +276,7 @@ class ProxiesTabView extends StatelessWidget {
|
|||||||
delay > 0 ? '$delay ms' : "Timeout",
|
delay > 0 ? '$delay ms' : "Timeout",
|
||||||
style: context.textTheme.labelSmall?.copyWith(
|
style: context.textTheme.labelSmall?.copyWith(
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
color: Other.getDelayColor(
|
color: other.getDelayColor(
|
||||||
delay,
|
delay,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -313,9 +313,10 @@ class ProxiesTabView extends StatelessWidget {
|
|||||||
ProxiesCardSelectorState>(
|
ProxiesCardSelectorState>(
|
||||||
selector: (_, appState, config, clashConfig) {
|
selector: (_, appState, config, clashConfig) {
|
||||||
final group = appState.getGroupWithName(groupName)!;
|
final group = appState.getGroupWithName(groupName)!;
|
||||||
bool isSelected = config.currentSelectedMap[group.name] == proxy.name ||
|
bool isSelected =
|
||||||
(config.currentSelectedMap[group.name] == null &&
|
config.currentSelectedMap[group.name] == proxy.name ||
|
||||||
group.now == proxy.name);
|
(config.currentSelectedMap[group.name] == null &&
|
||||||
|
group.now == proxy.name);
|
||||||
return ProxiesCardSelectorState(
|
return ProxiesCardSelectorState(
|
||||||
isSelected: isSelected,
|
isSelected: isSelected,
|
||||||
);
|
);
|
||||||
@@ -325,21 +326,21 @@ class ProxiesTabView extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
isSelected: state.isSelected,
|
isSelected: state.isSelected,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final appController = context.appController;
|
final appController = globalState.appController;
|
||||||
final group =
|
final group =
|
||||||
appController.appState.getGroupWithName(groupName)!;
|
appController.appState.getGroupWithName(groupName)!;
|
||||||
if (group.type != GroupType.Selector) {
|
if (group.type != GroupType.Selector) {
|
||||||
globalState.showSnackBar(
|
globalState.showSnackBar(
|
||||||
context,
|
context,
|
||||||
message: "当前代理组无法选择",
|
message: appLocalizations.notSelectedTip,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
context.appController.config.updateCurrentSelectedMap(
|
globalState.appController.config.updateCurrentSelectedMap(
|
||||||
groupName,
|
groupName,
|
||||||
proxy.name,
|
proxy.name,
|
||||||
);
|
);
|
||||||
context.appController.changeProxy();
|
globalState.appController.changeProxy();
|
||||||
},
|
},
|
||||||
proxy: proxy,
|
proxy: proxy,
|
||||||
);
|
);
|
||||||
@@ -420,13 +421,15 @@ class _DelayTestButtonContainerState extends State<DelayTestButtonContainer>
|
|||||||
late Animation<double> _scale;
|
late Animation<double> _scale;
|
||||||
late Animation<double> _opacity;
|
late Animation<double> _opacity;
|
||||||
|
|
||||||
_healthcheck() async {
|
_healthcheck() async
|
||||||
|
{
|
||||||
|
if(globalState.healthcheckLock) return;
|
||||||
_controller.forward();
|
_controller.forward();
|
||||||
context.appController.healthcheck();
|
globalState.appController.healthcheck();
|
||||||
await Future.delayed(
|
Future.delayed(appConstant.httpTimeoutDuration + appConstant.moreDuration,
|
||||||
appConstant.httpTimeoutDuration + appConstant.moreDuration,
|
() {
|
||||||
);
|
_controller.reverse();
|
||||||
_controller.reverse();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -447,7 +450,7 @@ class _DelayTestButtonContainerState extends State<DelayTestButtonContainer>
|
|||||||
curve: const Interval(
|
curve: const Interval(
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
curve: Curves.easeIn,
|
curve: Curves.elasticInOut,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ class ThemeFragment extends StatelessWidget {
|
|||||||
return CommonCard(
|
return CommonCard(
|
||||||
isSelected: isSelected,
|
isSelected: isSelected,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.appController.config.themeMode = themeModeItem.themeMode;
|
globalState.appController.config.themeMode = themeModeItem.themeMode;
|
||||||
},
|
},
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal:16),
|
padding: const EdgeInsets.symmetric(horizontal:16),
|
||||||
@@ -62,7 +63,7 @@ class ThemeFragment extends StatelessWidget {
|
|||||||
isSelected: isSelected,
|
isSelected: isSelected,
|
||||||
primaryColor: color,
|
primaryColor: color,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.appController.config.primaryColor = color?.value;
|
globalState.appController.config.primaryColor = color?.value;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class _ToolboxFragmentState extends State<ToolsFragment> {
|
|||||||
selector: (_, config) => config.locale,
|
selector: (_, config) => config.locale,
|
||||||
builder: (_, localeString, __) {
|
builder: (_, localeString, __) {
|
||||||
final subTitle = localeString ?? appLocalizations.defaultText;
|
final subTitle = localeString ?? appLocalizations.defaultText;
|
||||||
final currentLocale = Other.getLocaleForString(localeString);
|
final currentLocale = other.getLocaleForString(localeString);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: const Icon(Icons.language_outlined),
|
leading: const Icon(Icons.language_outlined),
|
||||||
title: Text(appLocalizations.language),
|
title: Text(appLocalizations.language),
|
||||||
@@ -211,31 +211,23 @@ class _ToolboxFragmentState extends State<ToolsFragment> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final items = [
|
final items = [
|
||||||
LayoutBuilder(builder: (context, container) {
|
Selector<AppState, List<NavigationItem>>(
|
||||||
final isMobile = context.isMobile;
|
selector: (_, appState) => appState.navigationItems,
|
||||||
if (!isMobile) {
|
builder: (_, navigationItems, __) {
|
||||||
return Container(
|
final moreNavigationItems = navigationItems
|
||||||
margin: const EdgeInsets.only(top: 18),
|
.where(
|
||||||
|
(element) => element.modes.contains(NavigationItemMode.more),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
if (moreNavigationItems.isEmpty) {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
return _buildSection(
|
||||||
|
title: appLocalizations.more,
|
||||||
|
content: _buildNavigationMenu(moreNavigationItems),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
return Selector<AppState, List<NavigationItem>>(
|
),
|
||||||
selector: (_, appState) => appState.navigationItems,
|
|
||||||
builder: (_, navigationItems, __) {
|
|
||||||
final moreNavigationItems = navigationItems
|
|
||||||
.where(
|
|
||||||
(element) => element.modes.contains(NavigationItemMode.more),
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
if (moreNavigationItems.isEmpty) {
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
return _buildSection(
|
|
||||||
title: appLocalizations.more,
|
|
||||||
content: _buildNavigationMenu(moreNavigationItems),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
_buildSection(
|
_buildSection(
|
||||||
title: appLocalizations.settings,
|
title: appLocalizations.settings,
|
||||||
content: _getSettingList(),
|
content: _getSettingList(),
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
"overrideDesc": "Override Proxy related config",
|
"overrideDesc": "Override Proxy related config",
|
||||||
"allowLan": "AllowLan",
|
"allowLan": "AllowLan",
|
||||||
"allowLanDesc": "Allow access proxy through the LAN",
|
"allowLanDesc": "Allow access proxy through the LAN",
|
||||||
"tun": "Tun",
|
"tun": "Tun mode",
|
||||||
"tunDesc": "only effective in administrator mode",
|
"tunDesc": "only effective in administrator mode",
|
||||||
"minimizeOnExit": "Minimize on exit",
|
"minimizeOnExit": "Minimize on exit",
|
||||||
"minimizeOnExitDesc": "Modify the default system exit event",
|
"minimizeOnExitDesc": "Modify the default system exit event",
|
||||||
@@ -92,6 +92,7 @@
|
|||||||
"delaySort": "Sort by delay",
|
"delaySort": "Sort by delay",
|
||||||
"nameSort": "Sort by name",
|
"nameSort": "Sort by name",
|
||||||
"pleaseUploadFile": "Please upload file",
|
"pleaseUploadFile": "Please upload file",
|
||||||
|
"pleaseUploadValidQrcode": "Please upload a valid QR code",
|
||||||
"blacklistMode": "Blacklist mode",
|
"blacklistMode": "Blacklist mode",
|
||||||
"whitelistMode": "Whitelist mode",
|
"whitelistMode": "Whitelist mode",
|
||||||
"filterSystemApp": "Filter system app",
|
"filterSystemApp": "Filter system app",
|
||||||
@@ -119,5 +120,9 @@
|
|||||||
"desc": "A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.",
|
"desc": "A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.",
|
||||||
"startVpn": "Staring VPN...",
|
"startVpn": "Staring VPN...",
|
||||||
"stopVpn": "Stopping VPN...",
|
"stopVpn": "Stopping VPN...",
|
||||||
"discovery": "Discovery a new version"
|
"discovery": "Discovery a new version",
|
||||||
|
"compatible": "Compatibility mode",
|
||||||
|
"compatibleDesc": "Opening it will lose part of its application ability and gain the support of full amount of Clash.",
|
||||||
|
"notSelectedTip": "The current proxy group cannot be selected.",
|
||||||
|
"tip": "tip"
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
"overrideDesc": "覆写代理相关配置",
|
"overrideDesc": "覆写代理相关配置",
|
||||||
"allowLan": "局域网代理",
|
"allowLan": "局域网代理",
|
||||||
"allowLanDesc": "允许通过局域网访问代理",
|
"allowLanDesc": "允许通过局域网访问代理",
|
||||||
"tun": "虚拟网络设备",
|
"tun": "Tun模式",
|
||||||
"tunDesc": "仅在管理员模式生效",
|
"tunDesc": "仅在管理员模式生效",
|
||||||
"minimizeOnExit": "退出时最小化",
|
"minimizeOnExit": "退出时最小化",
|
||||||
"minimizeOnExitDesc": "修改系统默认退出事件",
|
"minimizeOnExitDesc": "修改系统默认退出事件",
|
||||||
@@ -92,6 +92,7 @@
|
|||||||
"delaySort": "按延迟排序",
|
"delaySort": "按延迟排序",
|
||||||
"nameSort": "按名称排序",
|
"nameSort": "按名称排序",
|
||||||
"pleaseUploadFile": "请上传文件",
|
"pleaseUploadFile": "请上传文件",
|
||||||
|
"pleaseUploadValidQrcode": "请上传有效的二维码",
|
||||||
"blacklistMode": "黑名单模式",
|
"blacklistMode": "黑名单模式",
|
||||||
"whitelistMode": "白名单模式",
|
"whitelistMode": "白名单模式",
|
||||||
"filterSystemApp": "过滤系统应用",
|
"filterSystemApp": "过滤系统应用",
|
||||||
@@ -119,5 +120,9 @@
|
|||||||
"desc": "基于ClashMeta的多平台代理客户端,简单易用,开源无广告。",
|
"desc": "基于ClashMeta的多平台代理客户端,简单易用,开源无广告。",
|
||||||
"startVpn": "正在启动VPN...",
|
"startVpn": "正在启动VPN...",
|
||||||
"stopVpn": "正在停止VPN...",
|
"stopVpn": "正在停止VPN...",
|
||||||
"discovery": "发现新版本"
|
"discovery": "发现新版本",
|
||||||
|
"compatible": "兼容模式",
|
||||||
|
"compatibleDesc": "开启将失去部分应用能力,获得全量的Clash的支持",
|
||||||
|
"notSelectedTip": "当前代理组无法选中",
|
||||||
|
"tip": "提示"
|
||||||
}
|
}
|
||||||
@@ -56,6 +56,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"cancelSelectAll":
|
"cancelSelectAll":
|
||||||
MessageLookupByLibrary.simpleMessage("Cancel select all"),
|
MessageLookupByLibrary.simpleMessage("Cancel select all"),
|
||||||
"checkUpdate": MessageLookupByLibrary.simpleMessage("Check update"),
|
"checkUpdate": MessageLookupByLibrary.simpleMessage("Check update"),
|
||||||
|
"compatible":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Compatibility mode"),
|
||||||
|
"compatibleDesc": MessageLookupByLibrary.simpleMessage(
|
||||||
|
"Opening it will lose part of its application ability and gain the support of full amount of Clash."),
|
||||||
"confirm": MessageLookupByLibrary.simpleMessage("Confirm"),
|
"confirm": MessageLookupByLibrary.simpleMessage("Confirm"),
|
||||||
"core": MessageLookupByLibrary.simpleMessage("Core"),
|
"core": MessageLookupByLibrary.simpleMessage("Core"),
|
||||||
"coreInfo": MessageLookupByLibrary.simpleMessage("Core info"),
|
"coreInfo": MessageLookupByLibrary.simpleMessage("Core info"),
|
||||||
@@ -112,6 +116,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"noProxy": MessageLookupByLibrary.simpleMessage("No proxy"),
|
"noProxy": MessageLookupByLibrary.simpleMessage("No proxy"),
|
||||||
"noProxyDesc": MessageLookupByLibrary.simpleMessage(
|
"noProxyDesc": MessageLookupByLibrary.simpleMessage(
|
||||||
"Please create a profile or add a valid profile"),
|
"Please create a profile or add a valid profile"),
|
||||||
|
"notSelectedTip": MessageLookupByLibrary.simpleMessage(
|
||||||
|
"The current proxy group cannot be selected."),
|
||||||
"nullCoreInfoDesc":
|
"nullCoreInfoDesc":
|
||||||
MessageLookupByLibrary.simpleMessage("Unable to obtain core info"),
|
MessageLookupByLibrary.simpleMessage("Unable to obtain core info"),
|
||||||
"nullLogsDesc": MessageLookupByLibrary.simpleMessage("No logs"),
|
"nullLogsDesc": MessageLookupByLibrary.simpleMessage("No logs"),
|
||||||
@@ -124,6 +130,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"Override Proxy related config"),
|
"Override Proxy related config"),
|
||||||
"pleaseUploadFile":
|
"pleaseUploadFile":
|
||||||
MessageLookupByLibrary.simpleMessage("Please upload file"),
|
MessageLookupByLibrary.simpleMessage("Please upload file"),
|
||||||
|
"pleaseUploadValidQrcode": MessageLookupByLibrary.simpleMessage(
|
||||||
|
"Please upload a valid QR code"),
|
||||||
"port": MessageLookupByLibrary.simpleMessage("Port"),
|
"port": MessageLookupByLibrary.simpleMessage("Port"),
|
||||||
"preview": MessageLookupByLibrary.simpleMessage("Preview"),
|
"preview": MessageLookupByLibrary.simpleMessage("Preview"),
|
||||||
"profile": MessageLookupByLibrary.simpleMessage("Profile"),
|
"profile": MessageLookupByLibrary.simpleMessage("Profile"),
|
||||||
@@ -169,9 +177,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"themeDesc": MessageLookupByLibrary.simpleMessage(
|
"themeDesc": MessageLookupByLibrary.simpleMessage(
|
||||||
"Set dark mode,adjust the color"),
|
"Set dark mode,adjust the color"),
|
||||||
"themeMode": MessageLookupByLibrary.simpleMessage("Theme mode"),
|
"themeMode": MessageLookupByLibrary.simpleMessage("Theme mode"),
|
||||||
|
"tip": MessageLookupByLibrary.simpleMessage("tip"),
|
||||||
"tools": MessageLookupByLibrary.simpleMessage("Tools"),
|
"tools": MessageLookupByLibrary.simpleMessage("Tools"),
|
||||||
"trafficUsage": MessageLookupByLibrary.simpleMessage("Traffic usage"),
|
"trafficUsage": MessageLookupByLibrary.simpleMessage("Traffic usage"),
|
||||||
"tun": MessageLookupByLibrary.simpleMessage("Tun"),
|
"tun": MessageLookupByLibrary.simpleMessage("Tun mode"),
|
||||||
"tunDesc": MessageLookupByLibrary.simpleMessage(
|
"tunDesc": MessageLookupByLibrary.simpleMessage(
|
||||||
"only effective in administrator mode"),
|
"only effective in administrator mode"),
|
||||||
"unableToUpdateCurrentProfileDesc":
|
"unableToUpdateCurrentProfileDesc":
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
MessageLookupByLibrary.simpleMessage("取消过滤系统应用"),
|
MessageLookupByLibrary.simpleMessage("取消过滤系统应用"),
|
||||||
"cancelSelectAll": MessageLookupByLibrary.simpleMessage("取消全选"),
|
"cancelSelectAll": MessageLookupByLibrary.simpleMessage("取消全选"),
|
||||||
"checkUpdate": MessageLookupByLibrary.simpleMessage("检查更新"),
|
"checkUpdate": MessageLookupByLibrary.simpleMessage("检查更新"),
|
||||||
|
"compatible": MessageLookupByLibrary.simpleMessage("兼容模式"),
|
||||||
|
"compatibleDesc":
|
||||||
|
MessageLookupByLibrary.simpleMessage("开启将失去部分应用能力,获得全量的Clash的支持"),
|
||||||
"confirm": MessageLookupByLibrary.simpleMessage("确定"),
|
"confirm": MessageLookupByLibrary.simpleMessage("确定"),
|
||||||
"core": MessageLookupByLibrary.simpleMessage("内核"),
|
"core": MessageLookupByLibrary.simpleMessage("内核"),
|
||||||
"coreInfo": MessageLookupByLibrary.simpleMessage("内核信息"),
|
"coreInfo": MessageLookupByLibrary.simpleMessage("内核信息"),
|
||||||
@@ -97,6 +100,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"noProxy": MessageLookupByLibrary.simpleMessage("暂无代理"),
|
"noProxy": MessageLookupByLibrary.simpleMessage("暂无代理"),
|
||||||
"noProxyDesc":
|
"noProxyDesc":
|
||||||
MessageLookupByLibrary.simpleMessage("请创建配置文件或者添加有效配置文件"),
|
MessageLookupByLibrary.simpleMessage("请创建配置文件或者添加有效配置文件"),
|
||||||
|
"notSelectedTip": MessageLookupByLibrary.simpleMessage("当前代理组无法选中"),
|
||||||
"nullCoreInfoDesc": MessageLookupByLibrary.simpleMessage("无法获取内核信息"),
|
"nullCoreInfoDesc": MessageLookupByLibrary.simpleMessage("无法获取内核信息"),
|
||||||
"nullLogsDesc": MessageLookupByLibrary.simpleMessage("暂无日志"),
|
"nullLogsDesc": MessageLookupByLibrary.simpleMessage("暂无日志"),
|
||||||
"nullProfileDesc":
|
"nullProfileDesc":
|
||||||
@@ -106,6 +110,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"override": MessageLookupByLibrary.simpleMessage("覆写"),
|
"override": MessageLookupByLibrary.simpleMessage("覆写"),
|
||||||
"overrideDesc": MessageLookupByLibrary.simpleMessage("覆写代理相关配置"),
|
"overrideDesc": MessageLookupByLibrary.simpleMessage("覆写代理相关配置"),
|
||||||
"pleaseUploadFile": MessageLookupByLibrary.simpleMessage("请上传文件"),
|
"pleaseUploadFile": MessageLookupByLibrary.simpleMessage("请上传文件"),
|
||||||
|
"pleaseUploadValidQrcode":
|
||||||
|
MessageLookupByLibrary.simpleMessage("请上传有效的二维码"),
|
||||||
"port": MessageLookupByLibrary.simpleMessage("端口"),
|
"port": MessageLookupByLibrary.simpleMessage("端口"),
|
||||||
"preview": MessageLookupByLibrary.simpleMessage("预览"),
|
"preview": MessageLookupByLibrary.simpleMessage("预览"),
|
||||||
"profile": MessageLookupByLibrary.simpleMessage("配置"),
|
"profile": MessageLookupByLibrary.simpleMessage("配置"),
|
||||||
@@ -146,9 +152,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"themeColor": MessageLookupByLibrary.simpleMessage("主题色彩"),
|
"themeColor": MessageLookupByLibrary.simpleMessage("主题色彩"),
|
||||||
"themeDesc": MessageLookupByLibrary.simpleMessage("设置深色模式,调整色彩"),
|
"themeDesc": MessageLookupByLibrary.simpleMessage("设置深色模式,调整色彩"),
|
||||||
"themeMode": MessageLookupByLibrary.simpleMessage("主题模式"),
|
"themeMode": MessageLookupByLibrary.simpleMessage("主题模式"),
|
||||||
|
"tip": MessageLookupByLibrary.simpleMessage("提示"),
|
||||||
"tools": MessageLookupByLibrary.simpleMessage("工具"),
|
"tools": MessageLookupByLibrary.simpleMessage("工具"),
|
||||||
"trafficUsage": MessageLookupByLibrary.simpleMessage("流量统计"),
|
"trafficUsage": MessageLookupByLibrary.simpleMessage("流量统计"),
|
||||||
"tun": MessageLookupByLibrary.simpleMessage("虚拟网络设备"),
|
"tun": MessageLookupByLibrary.simpleMessage("Tun模式"),
|
||||||
"tunDesc": MessageLookupByLibrary.simpleMessage("仅在管理员模式生效"),
|
"tunDesc": MessageLookupByLibrary.simpleMessage("仅在管理员模式生效"),
|
||||||
"unableToUpdateCurrentProfileDesc":
|
"unableToUpdateCurrentProfileDesc":
|
||||||
MessageLookupByLibrary.simpleMessage("无法更新当前配置文件"),
|
MessageLookupByLibrary.simpleMessage("无法更新当前配置文件"),
|
||||||
|
|||||||
@@ -410,10 +410,10 @@ class AppLocalizations {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `Tun`
|
/// `Tun mode`
|
||||||
String get tun {
|
String get tun {
|
||||||
return Intl.message(
|
return Intl.message(
|
||||||
'Tun',
|
'Tun mode',
|
||||||
name: 'tun',
|
name: 'tun',
|
||||||
desc: '',
|
desc: '',
|
||||||
args: [],
|
args: [],
|
||||||
@@ -980,6 +980,16 @@ class AppLocalizations {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Please upload a valid QR code`
|
||||||
|
String get pleaseUploadValidQrcode {
|
||||||
|
return Intl.message(
|
||||||
|
'Please upload a valid QR code',
|
||||||
|
name: 'pleaseUploadValidQrcode',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// `Blacklist mode`
|
/// `Blacklist mode`
|
||||||
String get blacklistMode {
|
String get blacklistMode {
|
||||||
return Intl.message(
|
return Intl.message(
|
||||||
@@ -1259,6 +1269,46 @@ class AppLocalizations {
|
|||||||
args: [],
|
args: [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Compatibility mode`
|
||||||
|
String get compatible {
|
||||||
|
return Intl.message(
|
||||||
|
'Compatibility mode',
|
||||||
|
name: 'compatible',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Opening it will lose part of its application ability and gain the support of full amount of Clash.`
|
||||||
|
String get compatibleDesc {
|
||||||
|
return Intl.message(
|
||||||
|
'Opening it will lose part of its application ability and gain the support of full amount of Clash.',
|
||||||
|
name: 'compatibleDesc',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `The current proxy group cannot be selected.`
|
||||||
|
String get notSelectedTip {
|
||||||
|
return Intl.message(
|
||||||
|
'The current proxy group cannot be selected.',
|
||||||
|
name: 'notSelectedTip',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `tip`
|
||||||
|
String get tip {
|
||||||
|
return Intl.message(
|
||||||
|
'tip',
|
||||||
|
name: 'tip',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppLocalizationDelegate extends LocalizationsDelegate<AppLocalizations> {
|
class AppLocalizationDelegate extends LocalizationsDelegate<AppLocalizations> {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ Future<void> vpnService() async {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final appLocalizations = await AppLocalizations.load(
|
final appLocalizations = await AppLocalizations.load(
|
||||||
Other.getLocaleForString(config.locale) ??
|
other.getLocaleForString(config.locale) ??
|
||||||
WidgetsBinding.instance.platformDispatcher.locale,
|
WidgetsBinding.instance.platformDispatcher.locale,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,28 @@
|
|||||||
|
// ignore_for_file: invalid_annotation_target
|
||||||
|
|
||||||
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/common/constant.dart';
|
import 'package:fl_clash/common/constant.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
import '../enum/enum.dart';
|
import '../enum/enum.dart';
|
||||||
|
|
||||||
part 'generated/clash_config.g.dart';
|
part 'generated/clash_config.g.dart';
|
||||||
|
|
||||||
@JsonSerializable()
|
part 'generated/clash_config.freezed.dart';
|
||||||
class Tun {
|
|
||||||
bool enable;
|
|
||||||
String device;
|
|
||||||
TunStack stack;
|
|
||||||
@JsonKey(name: "dns-hijack")
|
|
||||||
List<String> dnsHijack;
|
|
||||||
|
|
||||||
Tun() : enable = false,
|
|
||||||
stack = TunStack.gvisor,
|
|
||||||
dnsHijack = ["any:53"],
|
|
||||||
device = appConstant.name;
|
|
||||||
|
|
||||||
factory Tun.fromJson(Map<String, dynamic> json) {
|
@freezed
|
||||||
return _$TunFromJson(json);
|
class Tun with _$Tun {
|
||||||
}
|
const factory Tun({
|
||||||
|
@Default(false) bool enable,
|
||||||
|
@Default(appName) String device,
|
||||||
|
@Default(TunStack.gvisor) TunStack stack,
|
||||||
|
@JsonKey(name: "dns-hijack") @Default(["any:53"])
|
||||||
|
List<String> dnsHijack,
|
||||||
|
}) = _Tun;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
factory Tun.fromJson(Map<String, Object?> json) => _$TunFromJson(json);
|
||||||
return _$TunToJson(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tun copyWith({bool? enable, int? fileDescriptor}) {
|
|
||||||
// return Tun(
|
|
||||||
// enable: enable ?? this.enable,
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
@@ -137,7 +128,7 @@ class ClashConfig extends ChangeNotifier {
|
|||||||
_mode = mode ?? Mode.rule,
|
_mode = mode ?? Mode.rule,
|
||||||
_allowLan = allowLan ?? false,
|
_allowLan = allowLan ?? false,
|
||||||
_logLevel = logLevel ?? LogLevel.info,
|
_logLevel = logLevel ?? LogLevel.info,
|
||||||
_tun = tun ?? Tun(),
|
_tun = tun ?? const Tun(),
|
||||||
_dns = dns ?? Dns(),
|
_dns = dns ?? Dns(),
|
||||||
_rules = rules ?? [];
|
_rules = rules ?? [];
|
||||||
|
|
||||||
@@ -225,4 +216,4 @@ class ClashConfig extends ChangeNotifier {
|
|||||||
allowLan: allowLan,
|
allowLan: allowLan,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ class Config extends ChangeNotifier {
|
|||||||
(element) => element.label == label && element.id != id) !=
|
(element) => element.label == label && element.id != id) !=
|
||||||
-1;
|
-1;
|
||||||
if (hasDup) {
|
if (hasDup) {
|
||||||
return _getLabel(Other.getOverwriteLabel(label!), id);
|
return _getLabel(other.getOverwriteLabel(label!), id);
|
||||||
} else {
|
} else {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|||||||
222
lib/models/generated/clash_config.freezed.dart
Normal file
222
lib/models/generated/clash_config.freezed.dart
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of '../clash_config.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||||
|
|
||||||
|
Tun _$TunFromJson(Map<String, dynamic> json) {
|
||||||
|
return _Tun.fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$Tun {
|
||||||
|
bool get enable => throw _privateConstructorUsedError;
|
||||||
|
String get device => throw _privateConstructorUsedError;
|
||||||
|
TunStack get stack => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(name: "dns-hijack")
|
||||||
|
List<String> get dnsHijack => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$TunCopyWith<Tun> get copyWith => throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $TunCopyWith<$Res> {
|
||||||
|
factory $TunCopyWith(Tun value, $Res Function(Tun) then) =
|
||||||
|
_$TunCopyWithImpl<$Res, Tun>;
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{bool enable,
|
||||||
|
String device,
|
||||||
|
TunStack stack,
|
||||||
|
@JsonKey(name: "dns-hijack") List<String> dnsHijack});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$TunCopyWithImpl<$Res, $Val extends Tun> implements $TunCopyWith<$Res> {
|
||||||
|
_$TunCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? enable = null,
|
||||||
|
Object? device = null,
|
||||||
|
Object? stack = null,
|
||||||
|
Object? dnsHijack = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
enable: null == enable
|
||||||
|
? _value.enable
|
||||||
|
: enable // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
device: null == device
|
||||||
|
? _value.device
|
||||||
|
: device // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
stack: null == stack
|
||||||
|
? _value.stack
|
||||||
|
: stack // ignore: cast_nullable_to_non_nullable
|
||||||
|
as TunStack,
|
||||||
|
dnsHijack: null == dnsHijack
|
||||||
|
? _value.dnsHijack
|
||||||
|
: dnsHijack // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$TunImplCopyWith<$Res> implements $TunCopyWith<$Res> {
|
||||||
|
factory _$$TunImplCopyWith(_$TunImpl value, $Res Function(_$TunImpl) then) =
|
||||||
|
__$$TunImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{bool enable,
|
||||||
|
String device,
|
||||||
|
TunStack stack,
|
||||||
|
@JsonKey(name: "dns-hijack") List<String> dnsHijack});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$TunImplCopyWithImpl<$Res> extends _$TunCopyWithImpl<$Res, _$TunImpl>
|
||||||
|
implements _$$TunImplCopyWith<$Res> {
|
||||||
|
__$$TunImplCopyWithImpl(_$TunImpl _value, $Res Function(_$TunImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? enable = null,
|
||||||
|
Object? device = null,
|
||||||
|
Object? stack = null,
|
||||||
|
Object? dnsHijack = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$TunImpl(
|
||||||
|
enable: null == enable
|
||||||
|
? _value.enable
|
||||||
|
: enable // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
device: null == device
|
||||||
|
? _value.device
|
||||||
|
: device // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
stack: null == stack
|
||||||
|
? _value.stack
|
||||||
|
: stack // ignore: cast_nullable_to_non_nullable
|
||||||
|
as TunStack,
|
||||||
|
dnsHijack: null == dnsHijack
|
||||||
|
? _value._dnsHijack
|
||||||
|
: dnsHijack // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<String>,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
class _$TunImpl implements _Tun {
|
||||||
|
const _$TunImpl(
|
||||||
|
{this.enable = false,
|
||||||
|
this.device = appName,
|
||||||
|
this.stack = TunStack.gvisor,
|
||||||
|
@JsonKey(name: "dns-hijack")
|
||||||
|
final List<String> dnsHijack = const ["any:53"]})
|
||||||
|
: _dnsHijack = dnsHijack;
|
||||||
|
|
||||||
|
factory _$TunImpl.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$$TunImplFromJson(json);
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool enable;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final String device;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final TunStack stack;
|
||||||
|
final List<String> _dnsHijack;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: "dns-hijack")
|
||||||
|
List<String> get dnsHijack {
|
||||||
|
if (_dnsHijack is EqualUnmodifiableListView) return _dnsHijack;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_dnsHijack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'Tun(enable: $enable, device: $device, stack: $stack, dnsHijack: $dnsHijack)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$TunImpl &&
|
||||||
|
(identical(other.enable, enable) || other.enable == enable) &&
|
||||||
|
(identical(other.device, device) || other.device == device) &&
|
||||||
|
(identical(other.stack, stack) || other.stack == stack) &&
|
||||||
|
const DeepCollectionEquality()
|
||||||
|
.equals(other._dnsHijack, _dnsHijack));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType, enable, device, stack,
|
||||||
|
const DeepCollectionEquality().hash(_dnsHijack));
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$TunImplCopyWith<_$TunImpl> get copyWith =>
|
||||||
|
__$$TunImplCopyWithImpl<_$TunImpl>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$$TunImplToJson(
|
||||||
|
this,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _Tun implements Tun {
|
||||||
|
const factory _Tun(
|
||||||
|
{final bool enable,
|
||||||
|
final String device,
|
||||||
|
final TunStack stack,
|
||||||
|
@JsonKey(name: "dns-hijack") final List<String> dnsHijack}) = _$TunImpl;
|
||||||
|
|
||||||
|
factory _Tun.fromJson(Map<String, dynamic> json) = _$TunImpl.fromJson;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get enable;
|
||||||
|
@override
|
||||||
|
String get device;
|
||||||
|
@override
|
||||||
|
TunStack get stack;
|
||||||
|
@override
|
||||||
|
@JsonKey(name: "dns-hijack")
|
||||||
|
List<String> get dnsHijack;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$TunImplCopyWith<_$TunImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
@@ -6,26 +6,6 @@ part of '../clash_config.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
Tun _$TunFromJson(Map<String, dynamic> json) => Tun()
|
|
||||||
..enable = json['enable'] as bool
|
|
||||||
..device = json['device'] as String
|
|
||||||
..stack = $enumDecode(_$TunStackEnumMap, json['stack'])
|
|
||||||
..dnsHijack =
|
|
||||||
(json['dns-hijack'] as List<dynamic>).map((e) => e as String).toList();
|
|
||||||
|
|
||||||
Map<String, dynamic> _$TunToJson(Tun instance) => <String, dynamic>{
|
|
||||||
'enable': instance.enable,
|
|
||||||
'device': instance.device,
|
|
||||||
'stack': _$TunStackEnumMap[instance.stack]!,
|
|
||||||
'dns-hijack': instance.dnsHijack,
|
|
||||||
};
|
|
||||||
|
|
||||||
const _$TunStackEnumMap = {
|
|
||||||
TunStack.gvisor: 'gvisor',
|
|
||||||
TunStack.system: 'system',
|
|
||||||
TunStack.mixed: 'mixed',
|
|
||||||
};
|
|
||||||
|
|
||||||
Dns _$DnsFromJson(Map<String, dynamic> json) => Dns()
|
Dns _$DnsFromJson(Map<String, dynamic> json) => Dns()
|
||||||
..enable = json['enable'] as bool
|
..enable = json['enable'] as bool
|
||||||
..ipv6 = json['ipv6'] as bool
|
..ipv6 = json['ipv6'] as bool
|
||||||
@@ -94,3 +74,27 @@ const _$LogLevelEnumMap = {
|
|||||||
LogLevel.error: 'error',
|
LogLevel.error: 'error',
|
||||||
LogLevel.silent: 'silent',
|
LogLevel.silent: 'silent',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_$TunImpl _$$TunImplFromJson(Map<String, dynamic> json) => _$TunImpl(
|
||||||
|
enable: json['enable'] as bool? ?? false,
|
||||||
|
device: json['device'] as String? ?? appName,
|
||||||
|
stack: $enumDecodeNullable(_$TunStackEnumMap, json['stack']) ??
|
||||||
|
TunStack.gvisor,
|
||||||
|
dnsHijack: (json['dns-hijack'] as List<dynamic>?)
|
||||||
|
?.map((e) => e as String)
|
||||||
|
.toList() ??
|
||||||
|
const ["any:53"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$$TunImplToJson(_$TunImpl instance) => <String, dynamic>{
|
||||||
|
'enable': instance.enable,
|
||||||
|
'device': instance.device,
|
||||||
|
'stack': _$TunStackEnumMap[instance.stack]!,
|
||||||
|
'dns-hijack': instance.dnsHijack,
|
||||||
|
};
|
||||||
|
|
||||||
|
const _$TunStackEnumMap = {
|
||||||
|
TunStack.gvisor: 'gvisor',
|
||||||
|
TunStack.system: 'system',
|
||||||
|
TunStack.mixed: 'mixed',
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
import 'package:fl_clash/state.dart';
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -28,7 +27,7 @@ class HomePage extends StatelessWidget {
|
|||||||
builder: (context, currentIndex, __) {
|
builder: (context, currentIndex, __) {
|
||||||
if (globalState.pageController != null) {
|
if (globalState.pageController != null) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
context.appController.toPage(currentIndex, hasAnimate: true);
|
globalState.appController.toPage(currentIndex, hasAnimate: true);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
globalState.pageController = PageController(
|
globalState.pageController = PageController(
|
||||||
@@ -67,7 +66,7 @@ class HomePage extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
builder: (context, state, __) {
|
builder: (context, state, __) {
|
||||||
return AdaptiveScaffold.standardNavigationRail(
|
return AdaptiveScaffold.standardNavigationRail(
|
||||||
onDestinationSelected: context.appController.toPage,
|
onDestinationSelected: globalState.appController.toPage,
|
||||||
destinations: navigationItems
|
destinations: navigationItems
|
||||||
.map(
|
.map(
|
||||||
(e) => NavigationRailDestination(
|
(e) => NavigationRailDestination(
|
||||||
@@ -113,7 +112,7 @@ class HomePage extends StatelessWidget {
|
|||||||
.toList();
|
.toList();
|
||||||
return AdaptiveScaffold.standardBottomNavigationBar(
|
return AdaptiveScaffold.standardBottomNavigationBar(
|
||||||
destinations: mobileDestinations,
|
destinations: mobileDestinations,
|
||||||
onDestinationSelected: context.appController.toPage,
|
onDestinationSelected: globalState.appController.toPage,
|
||||||
currentIndex: state.currentIndex,
|
currentIndex: state.currentIndex,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||||
|
|
||||||
@@ -90,6 +91,12 @@ class _ScanPageState extends State<ScanPage> with WidgetsBindingObserver {
|
|||||||
},
|
},
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
),
|
),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: globalState.appController.addProfileFormQrCode,
|
||||||
|
icon: const Icon(Icons.add_photo_alternate_outlined),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(bottom: 32),
|
margin: const EdgeInsets.only(bottom: 32),
|
||||||
@@ -115,7 +122,7 @@ class _ScanPageState extends State<ScanPage> with WidgetsBindingObserver {
|
|||||||
icon: icon,
|
icon: icon,
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
const MaterialStatePropertyAll(Colors.white),
|
const MaterialStatePropertyAll(Colors.white),
|
||||||
backgroundColor: MaterialStatePropertyAll(backgroundColor),
|
backgroundColor: MaterialStatePropertyAll(backgroundColor),
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
@@ -197,4 +204,4 @@ class ScannerOverlay extends CustomPainter {
|
|||||||
return scanWindow != oldDelegate.scanWindow ||
|
return scanWindow != oldDelegate.scanWindow ||
|
||||||
borderRadius != oldDelegate.borderRadius;
|
borderRadius != oldDelegate.borderRadius;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,21 +9,24 @@ import 'package:fl_clash/plugins/app.dart';
|
|||||||
import 'package:fl_clash/widgets/scaffold.dart';
|
import 'package:fl_clash/widgets/scaffold.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'controller.dart';
|
||||||
import 'models/models.dart';
|
import 'models/models.dart';
|
||||||
import 'common/common.dart';
|
import 'common/common.dart';
|
||||||
|
|
||||||
class GlobalState {
|
class GlobalState {
|
||||||
Timer? timer;
|
Timer? timer;
|
||||||
Function? updateSortNumDebounce;
|
Function? healthcheckLockDebounce;
|
||||||
Timer? groupsUpdateTimer;
|
Timer? groupsUpdateTimer;
|
||||||
Function? updateCurrentDelayDebounce;
|
Function? updateCurrentDelayDebounce;
|
||||||
PageController? pageController;
|
PageController? pageController;
|
||||||
final navigatorKey = GlobalKey<NavigatorState>();
|
final navigatorKey = GlobalKey<NavigatorState>();
|
||||||
final Map<int, String?> packageNameMap = {};
|
final Map<int, String?> packageNameMap = {};
|
||||||
|
late AppController appController;
|
||||||
GlobalKey<CommonScaffoldState> homeScaffoldKey = GlobalKey();
|
GlobalKey<CommonScaffoldState> homeScaffoldKey = GlobalKey();
|
||||||
List<Function> updateFunctionLists = [];
|
List<Function> updateFunctionLists = [];
|
||||||
List<NavigationItem> currentNavigationItems = [];
|
List<NavigationItem> currentNavigationItems = [];
|
||||||
bool updatePackagesLock = false;
|
bool updatePackagesLock = false;
|
||||||
|
bool healthcheckLock = false;
|
||||||
|
|
||||||
startListenUpdate() {
|
startListenUpdate() {
|
||||||
if (timer != null && timer!.isActive == true) return;
|
if (timer != null && timer!.isActive == true) return;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ class _AndroidContainerState extends State<AndroidContainer>
|
|||||||
Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
|
Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
|
||||||
final isPaused = state == AppLifecycleState.paused;
|
final isPaused = state == AppLifecycleState.paused;
|
||||||
if (isPaused) {
|
if (isPaused) {
|
||||||
await context.appController.savePreferences();
|
await globalState.appController.savePreferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ class AppStateContainer extends StatelessWidget {
|
|||||||
builder: (context, state, child) {
|
builder: (context, state, child) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback(
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
(_) {
|
(_) {
|
||||||
context.appController.appState.navigationItems =
|
globalState.appController.appState.navigationItems =
|
||||||
navigation.getItems(
|
navigation.getItems(
|
||||||
openLogs: state.openLogs,
|
openLogs: state.openLogs,
|
||||||
hasProxies: state.hasProxies,
|
hasProxies: state.hasProxies,
|
||||||
|
|||||||
@@ -38,14 +38,22 @@ class _ClashMessageContainerState extends State<ClashMessageContainer>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onDelay(Delay delay) {
|
void onDelay(Delay delay) {
|
||||||
final appController = context.appController;
|
globalState.healthcheckLock = true;
|
||||||
|
final appController = globalState.appController;
|
||||||
appController.setDelay(delay);
|
appController.setDelay(delay);
|
||||||
|
globalState.healthcheckLockDebounce ??= debounce<Function()>(
|
||||||
|
() async {
|
||||||
|
globalState.healthcheckLock = false;
|
||||||
|
},
|
||||||
|
milliseconds: 5000,
|
||||||
|
);
|
||||||
|
globalState.healthcheckLockDebounce!();
|
||||||
super.onDelay(delay);
|
super.onDelay(delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onLog(Log log) {
|
void onLog(Log log) {
|
||||||
context.appController.appState.addLog(log);
|
globalState.appController.appState.addLog(log);
|
||||||
super.onLog(log);
|
super.onLog(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'card.dart';
|
import 'card.dart';
|
||||||
import 'grid.dart';
|
import 'grid.dart';
|
||||||
@@ -25,7 +25,7 @@ class ColorSchemeBox extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Theme.of(context).copyWith(
|
return Theme.of(context).copyWith(
|
||||||
colorScheme: context.appController.appState.systemColorSchemes
|
colorScheme: globalState.appController.appState.systemColorSchemes
|
||||||
.getSystemColorSchemeForBrightness(Theme.of(context).brightness),
|
.getSystemColorSchemeForBrightness(Theme.of(context).brightness),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,6 @@ showExtendPage(
|
|||||||
key: globalKey,
|
key: globalKey,
|
||||||
child: body,
|
child: body,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Flexible(
|
|
||||||
// flex: 0,
|
|
||||||
// child: Row(
|
|
||||||
// children: [
|
|
||||||
// Expanded(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: kTabLabelPadding,
|
|
||||||
// child: Text(
|
|
||||||
// title,
|
|
||||||
// style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const SizedBox(
|
|
||||||
// height: kToolbarHeight,
|
|
||||||
// width: kToolbarHeight,
|
|
||||||
// child: CloseButton(),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
navigator.push(
|
navigator.push(
|
||||||
ModalSideSheetRoute(
|
ModalSideSheetRoute(
|
||||||
modalBarrierColor: Colors.black38,
|
modalBarrierColor: Colors.black38,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
|
||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
class PopContainer extends StatefulWidget {
|
class PopContainer extends StatefulWidget {
|
||||||
@@ -24,7 +24,7 @@ class _PopContainerState extends State<PopContainer> {
|
|||||||
if (canPop) {
|
if (canPop) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} else {
|
} else {
|
||||||
await context.appController.handleBackOrExit();
|
await globalState.appController.handleBackOrExit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:fl_clash/common/system.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
@@ -69,8 +70,10 @@ class CommonScaffoldState extends State<CommonScaffold> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
_platformContainer({required Widget child}) {
|
||||||
Widget build(BuildContext context) {
|
if (system.isDesktop) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
return AnnotatedRegion(
|
return AnnotatedRegion(
|
||||||
value: SystemUiOverlayStyle(
|
value: SystemUiOverlayStyle(
|
||||||
statusBarColor: Colors.transparent,
|
statusBarColor: Colors.transparent,
|
||||||
@@ -80,6 +83,13 @@ class CommonScaffoldState extends State<CommonScaffold> {
|
|||||||
systemNavigationBarColor: Colors.transparent,
|
systemNavigationBarColor: Colors.transparent,
|
||||||
systemNavigationBarDividerColor: Colors.transparent,
|
systemNavigationBarDividerColor: Colors.transparent,
|
||||||
),
|
),
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return _platformContainer(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: PreferredSize(
|
appBar: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(kToolbarHeight),
|
preferredSize: const Size.fromHeight(kToolbarHeight),
|
||||||
@@ -114,3 +124,23 @@ class CommonScaffoldState extends State<CommonScaffold> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class AppIcon extends StatelessWidget {
|
||||||
|
const AppIcon({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 16,
|
||||||
|
),
|
||||||
|
width: 30,
|
||||||
|
height: 30,
|
||||||
|
child: const CircleAvatar(
|
||||||
|
foregroundImage: AssetImage("assets/images/launch_icon.png"),
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../state.dart';
|
||||||
|
|
||||||
class TooltipText extends StatelessWidget {
|
class TooltipText extends StatelessWidget {
|
||||||
final Text text;
|
final Text text;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ class TooltipText extends StatelessWidget {
|
|||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, container) {
|
builder: (context, container) {
|
||||||
final maxWidth = container.maxWidth;
|
final maxWidth = container.maxWidth;
|
||||||
final size = context.appController.measure.computeTextSize(
|
final size = globalState.appController.measure.computeTextSize(
|
||||||
text,
|
text,
|
||||||
);
|
);
|
||||||
if (maxWidth < size.width) {
|
if (maxWidth < size.width) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
|
||||||
import 'package:fl_clash/plugins/tile.dart';
|
import 'package:fl_clash/plugins/tile.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class TileContainer extends StatefulWidget {
|
class TileContainer extends StatefulWidget {
|
||||||
@@ -24,13 +24,13 @@ class _TileContainerState extends State<TileContainer> with TileListener {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onStart() {
|
void onStart() {
|
||||||
context.appController.updateSystemProxy(true);
|
globalState.appController.updateSystemProxy(true);
|
||||||
super.onStart();
|
super.onStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onStop() {
|
void onStop() {
|
||||||
context.appController.updateSystemProxy(false);
|
globalState.appController.updateSystemProxy(false);
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/common/common.dart';
|
||||||
import 'package:fl_clash/enum/enum.dart';
|
import 'package:fl_clash/enum/enum.dart';
|
||||||
import 'package:fl_clash/models/models.dart';
|
import 'package:fl_clash/models/models.dart';
|
||||||
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -32,7 +33,7 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
|||||||
_updateOtherTray() async {
|
_updateOtherTray() async {
|
||||||
if (isTrayInit == false) {
|
if (isTrayInit == false) {
|
||||||
await trayManager.setIcon(
|
await trayManager.setIcon(
|
||||||
Other.getTrayIconPath(),
|
other.getTrayIconPath(),
|
||||||
);
|
);
|
||||||
isTrayInit = true;
|
isTrayInit = true;
|
||||||
}
|
}
|
||||||
@@ -41,7 +42,7 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
|||||||
_updateLinuxTray() async {
|
_updateLinuxTray() async {
|
||||||
await trayManager.destroy();
|
await trayManager.destroy();
|
||||||
await trayManager.setIcon(
|
await trayManager.setIcon(
|
||||||
Other.getTrayIconPath(),
|
other.getTrayIconPath(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,11 +69,11 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
|||||||
// label: proxy.name,
|
// label: proxy.name,
|
||||||
// checked: isCurrentGroup && isCurrentProxy,
|
// checked: isCurrentGroup && isCurrentProxy,
|
||||||
// onClick: (_) {
|
// onClick: (_) {
|
||||||
// final config = context.appController.config;
|
// final config = globalState.appController.config;
|
||||||
// config.currentProfile?.groupName = group.name;
|
// config.currentProfile?.groupName = group.name;
|
||||||
// config.currentProfile?.proxyName = proxy.name;
|
// config.currentProfile?.proxyName = proxy.name;
|
||||||
// config.update();
|
// config.update();
|
||||||
// context.appController.changeProxy();
|
// globalState.appController.changeProxy();
|
||||||
// }),
|
// }),
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
@@ -93,7 +94,7 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
|||||||
MenuItem.checkbox(
|
MenuItem.checkbox(
|
||||||
label: Intl.message(mode.name),
|
label: Intl.message(mode.name),
|
||||||
onClick: (_) {
|
onClick: (_) {
|
||||||
context.appController.clashConfig.mode = mode;
|
globalState.appController.clashConfig.mode = mode;
|
||||||
},
|
},
|
||||||
checked: mode == state.mode,
|
checked: mode == state.mode,
|
||||||
),
|
),
|
||||||
@@ -103,7 +104,7 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
|||||||
final proxyMenuItem = MenuItem.checkbox(
|
final proxyMenuItem = MenuItem.checkbox(
|
||||||
label: appLocalizations.systemProxy,
|
label: appLocalizations.systemProxy,
|
||||||
onClick: (_) async {
|
onClick: (_) async {
|
||||||
context.appController.updateSystemProxy(!state.isRun);
|
globalState.appController.updateSystemProxy(!state.isRun);
|
||||||
},
|
},
|
||||||
checked: state.isRun,
|
checked: state.isRun,
|
||||||
);
|
);
|
||||||
@@ -111,8 +112,8 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
|||||||
final autoStartMenuItem = MenuItem.checkbox(
|
final autoStartMenuItem = MenuItem.checkbox(
|
||||||
label: appLocalizations.autoLaunch,
|
label: appLocalizations.autoLaunch,
|
||||||
onClick: (_) async {
|
onClick: (_) async {
|
||||||
context.appController.config.autoLaunch =
|
globalState.appController.config.autoLaunch =
|
||||||
!context.appController.config.autoLaunch;
|
!globalState.appController.config.autoLaunch;
|
||||||
},
|
},
|
||||||
checked: state.autoLaunch,
|
checked: state.autoLaunch,
|
||||||
);
|
);
|
||||||
@@ -121,7 +122,7 @@ class _TrayContainerState extends State<TrayContainer> with TrayListener {
|
|||||||
final exitMenuItem = MenuItem(
|
final exitMenuItem = MenuItem(
|
||||||
label: appLocalizations.exit,
|
label: appLocalizations.exit,
|
||||||
onClick: (_) async {
|
onClick: (_) async {
|
||||||
await context.appController.handleExit();
|
await globalState.appController.handleExit();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
menuItems.add(exitMenuItem);
|
menuItems.add(exitMenuItem);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import 'package:fl_clash/common/common.dart';
|
import 'package:fl_clash/state.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
@@ -29,13 +29,13 @@ class _WindowContainerState extends State<WindowContainer>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onWindowClose() async {
|
void onWindowClose() async {
|
||||||
await context.appController.handleBackOrExit();
|
await globalState.appController.handleBackOrExit();
|
||||||
super.onWindowClose();
|
super.onWindowClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onWindowMinimize() async {
|
void onWindowMinimize() async {
|
||||||
await context.appController.savePreferences();
|
await globalState.appController.savePreferences();
|
||||||
super.onWindowMinimize();
|
super.onWindowMinimize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <dynamic_color/dynamic_color_plugin.h>
|
#include <dynamic_color/dynamic_color_plugin.h>
|
||||||
|
#include <file_selector_linux/file_selector_plugin.h>
|
||||||
#include <gtk/gtk_plugin.h>
|
#include <gtk/gtk_plugin.h>
|
||||||
#include <screen_retriever/screen_retriever_plugin.h>
|
#include <screen_retriever/screen_retriever_plugin.h>
|
||||||
#include <tray_manager/tray_manager_plugin.h>
|
#include <tray_manager/tray_manager_plugin.h>
|
||||||
@@ -17,6 +18,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
|||||||
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||||
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
||||||
|
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
|
||||||
|
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
|
||||||
g_autoptr(FlPluginRegistrar) gtk_registrar =
|
g_autoptr(FlPluginRegistrar) gtk_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
|
||||||
gtk_plugin_register_with_registrar(gtk_registrar);
|
gtk_plugin_register_with_registrar(gtk_registrar);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
dynamic_color
|
dynamic_color
|
||||||
|
file_selector_linux
|
||||||
gtk
|
gtk
|
||||||
screen_retriever
|
screen_retriever
|
||||||
tray_manager
|
tray_manager
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Foundation
|
|||||||
|
|
||||||
import app_links
|
import app_links
|
||||||
import dynamic_color
|
import dynamic_color
|
||||||
|
import file_selector_macos
|
||||||
import mobile_scanner
|
import mobile_scanner
|
||||||
import package_info_plus
|
import package_info_plus
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
@@ -19,6 +20,7 @@ import window_manager
|
|||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
|
AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin"))
|
||||||
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
|
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
|
||||||
|
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||||
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
|
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
|
||||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
|||||||
188
pubspec.lock
188
pubspec.lock
@@ -33,6 +33,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.5.1"
|
version: "3.5.1"
|
||||||
|
archive:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: archive
|
||||||
|
sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "3.5.1"
|
||||||
args:
|
args:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -129,6 +137,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.0"
|
||||||
|
charcode:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: charcode
|
||||||
|
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "1.3.1"
|
||||||
checked_yaml:
|
checked_yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -177,6 +193,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.1"
|
version: "3.1.1"
|
||||||
|
cross_file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cross_file
|
||||||
|
sha256: "55d7b444feb71301ef6b8838dbc1ae02e63dd48c8773f3810ff53bb1e2945b32"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.4+1"
|
||||||
crypto:
|
crypto:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -241,6 +265,38 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.2.1"
|
version: "6.2.1"
|
||||||
|
file_selector_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_linux
|
||||||
|
sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.9.2+1"
|
||||||
|
file_selector_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_macos
|
||||||
|
sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.9.4"
|
||||||
|
file_selector_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_platform_interface
|
||||||
|
sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "2.6.2"
|
||||||
|
file_selector_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_windows
|
||||||
|
sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.9.3+1"
|
||||||
fixnum:
|
fixnum:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -279,10 +335,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_plugin_android_lifecycle
|
name: flutter_plugin_android_lifecycle
|
||||||
sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f"
|
sha256: "592dc01a18961a51c24ae5d963b724b2b7fa4a95c100fe8eb6ca8a5a4732cadf"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.19"
|
version: "2.0.18"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -365,14 +421,86 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.2"
|
version: "4.0.2"
|
||||||
|
image:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: image
|
||||||
|
sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "4.1.7"
|
||||||
|
image_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: image_picker
|
||||||
|
sha256: "33974eca2e87e8b4e3727f1b94fa3abcb25afe80b6bc2c4d449a0e150aedf720"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.1"
|
||||||
|
image_picker_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_picker_android
|
||||||
|
sha256: "79455f6cff4cbef583b2b524bbf0d4ec424e5959f4d464e36ef5323715b98370"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.8.12"
|
||||||
|
image_picker_for_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_picker_for_web
|
||||||
|
sha256: "6a1704fdd75022272e7e7a897a9068e9c2ff3cd6a66820bf3ded810633eac954"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.3"
|
||||||
|
image_picker_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_picker_ios
|
||||||
|
sha256: cb0db0ec0d3e2cd49674f2e6053be25ccdb959832607c1cbd215dd6cf10fb0dd
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.8.11"
|
||||||
|
image_picker_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_picker_linux
|
||||||
|
sha256: "4ed1d9bb36f7cd60aa6e6cd479779cc56a4cb4e4de8f49d487b1aaad831300fa"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.1+1"
|
||||||
|
image_picker_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_picker_macos
|
||||||
|
sha256: "3f5ad1e8112a9a6111c46d0b57a7be2286a9a07fc6e1976fdf5be2bd31d4ff62"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.1+1"
|
||||||
|
image_picker_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_picker_platform_interface
|
||||||
|
sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "2.10.0"
|
||||||
|
image_picker_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: image_picker_windows
|
||||||
|
sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.1+1"
|
||||||
intl:
|
intl:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: intl
|
name: intl
|
||||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.18.1"
|
version: "0.19.0"
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -417,26 +545,26 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: leak_tracker
|
name: leak_tracker
|
||||||
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
|
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "10.0.0"
|
version: "10.0.4"
|
||||||
leak_tracker_flutter_testing:
|
leak_tracker_flutter_testing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: leak_tracker_flutter_testing
|
name: leak_tracker_flutter_testing
|
||||||
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
|
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "3.0.3"
|
||||||
leak_tracker_testing:
|
leak_tracker_testing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: leak_tracker_testing
|
name: leak_tracker_testing
|
||||||
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
|
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.1"
|
version: "3.0.1"
|
||||||
lints:
|
lints:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -481,10 +609,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
|
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.11.0"
|
version: "1.12.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -589,6 +717,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.1"
|
||||||
|
petitparser:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: petitparser
|
||||||
|
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "6.0.2"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -672,10 +808,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_android
|
name: shared_preferences_android
|
||||||
sha256: "1ee8bf911094a1b592de7ab29add6f826a7331fb854273d55918693d5364a1f2"
|
sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.2"
|
version: "2.2.1"
|
||||||
shared_preferences_foundation:
|
shared_preferences_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -813,10 +949,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
|
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.1"
|
version: "0.7.0"
|
||||||
timing:
|
timing:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -917,10 +1053,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
|
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "13.0.0"
|
version: "14.2.1"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -985,6 +1121,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "1.0.4"
|
||||||
|
xml:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: xml
|
||||||
|
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "6.5.0"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1001,6 +1145,14 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.1"
|
||||||
|
zxing2:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: zxing2
|
||||||
|
sha256: "6cf995abd3c86f01ba882968dedffa7bc130185e382f2300239d2e857fc7912c"
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.3"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.3.0 <4.0.0"
|
dart: ">=3.3.0 <4.0.0"
|
||||||
flutter: ">=3.19.0"
|
flutter: ">=3.19.0"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: fl_clash
|
name: fl_clash
|
||||||
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
|
description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free.
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.8.0
|
version: 0.8.3
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.1.0 <4.0.0'
|
sdk: '>=3.1.0 <4.0.0'
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ dependencies:
|
|||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
intl: ^0.18.1
|
intl: ^0.19.0
|
||||||
path_provider: ^2.1.0
|
path_provider: ^2.1.0
|
||||||
path: ^1.8.3
|
path: ^1.8.3
|
||||||
shared_preferences: ^2.2.0
|
shared_preferences: ^2.2.0
|
||||||
@@ -35,6 +35,9 @@ dependencies:
|
|||||||
url_launcher: ^6.2.6
|
url_launcher: ^6.2.6
|
||||||
flutter_adaptive_scaffold: ^0.1.10+1
|
flutter_adaptive_scaffold: ^0.1.10+1
|
||||||
freezed_annotation: ^2.4.1
|
freezed_annotation: ^2.4.1
|
||||||
|
image_picker: ^1.1.1
|
||||||
|
zxing2: ^0.2.3
|
||||||
|
image: ^4.1.7
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <app_links/app_links_plugin_c_api.h>
|
#include <app_links/app_links_plugin_c_api.h>
|
||||||
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
||||||
|
#include <file_selector_windows/file_selector_windows.h>
|
||||||
#include <proxy/proxy_plugin_c_api.h>
|
#include <proxy/proxy_plugin_c_api.h>
|
||||||
#include <screen_retriever/screen_retriever_plugin.h>
|
#include <screen_retriever/screen_retriever_plugin.h>
|
||||||
#include <tray_manager/tray_manager_plugin.h>
|
#include <tray_manager/tray_manager_plugin.h>
|
||||||
@@ -20,6 +21,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|||||||
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
|
registry->GetRegistrarForPlugin("AppLinksPluginCApi"));
|
||||||
DynamicColorPluginCApiRegisterWithRegistrar(
|
DynamicColorPluginCApiRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
||||||
|
FileSelectorWindowsRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
||||||
ProxyPluginCApiRegisterWithRegistrar(
|
ProxyPluginCApiRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("ProxyPluginCApi"));
|
registry->GetRegistrarForPlugin("ProxyPluginCApi"));
|
||||||
ScreenRetrieverPluginRegisterWithRegistrar(
|
ScreenRetrieverPluginRegisterWithRegistrar(
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
app_links
|
app_links
|
||||||
dynamic_color
|
dynamic_color
|
||||||
|
file_selector_windows
|
||||||
proxy
|
proxy
|
||||||
screen_retriever
|
screen_retriever
|
||||||
tray_manager
|
tray_manager
|
||||||
|
|||||||
Reference in New Issue
Block a user