Compare commits

...

6 Commits

Author SHA1 Message Date
chen08209
07bd21580b Fix android repeated request notification issues 2024-06-28 21:16:47 +08:00
chen08209
57ceb64a5e Fix memory overflow issues 2024-06-28 07:49:06 +08:00
chen08209
713e83d9d8 Optimize proxies expansion panel 2
Fix android scan qrcode error
2024-06-27 19:39:49 +08:00
chen08209
5e3b0e4929 Optimize proxies expansion panel
Fix text error
2024-06-27 15:54:10 +08:00
chen08209
0389b6eb29 Optimize proxy
Optimize delayed sorting performance

Add expansion panel proxies page

Support to adjust the proxy card size

Support to adjust proxies columns number
2024-06-26 16:04:30 +08:00
chen08209
8f22cbf746 Fix autoRun show issues
Fix Android 10 issues

Optimize ip show
2024-06-23 03:07:52 +08:00
48 changed files with 5839 additions and 636 deletions

View File

@@ -64,7 +64,6 @@ class AppPlugin : FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAware
toast!!.show() toast!!.show()
} }
@RequiresApi(Build.VERSION_CODES.Q)
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) { override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
when (call.method) { when (call.method) {
"moveTaskToBack" -> { "moveTaskToBack" -> {
@@ -151,7 +150,6 @@ class AppPlugin : FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAware
val message = call.argument<String>("message") val message = call.argument<String>("message")
tip(message) tip(message)
result.success(true) result.success(true)
} }
else -> { else -> {

View File

@@ -44,6 +44,7 @@ class ProxyPlugin : FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAwar
private var props: Props? = null private var props: Props? = null
private lateinit var title: String private lateinit var title: String
private lateinit var content: String private lateinit var content: String
var isBlockNotification: Boolean = false
private val connection = object : ServiceConnection { private val connection = object : ServiceConnection {
override fun onServiceConnected(className: ComponentName, service: IBinder) { override fun onServiceConnected(className: ComponentName, service: IBinder) {
@@ -152,13 +153,14 @@ class ProxyPlugin : FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAwar
if (permission == PackageManager.PERMISSION_GRANTED) { if (permission == PackageManager.PERMISSION_GRANTED) {
startForeground() startForeground()
} else { } else {
activity?.let { if (isBlockNotification) return
ActivityCompat.requestPermissions( if (activity == null) return
it, ActivityCompat.requestPermissions(
arrayOf(Manifest.permission.POST_NOTIFICATIONS), activity!!,
NOTIFICATION_PERMISSION_REQUEST_CODE arrayOf(Manifest.permission.POST_NOTIFICATIONS),
) NOTIFICATION_PERMISSION_REQUEST_CODE
} )
} }
} else { } else {
startForeground() startForeground()
@@ -192,11 +194,14 @@ class ProxyPlugin : FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAwar
grantResults: IntArray grantResults: IntArray
): Boolean { ): Boolean {
if (requestCode == NOTIFICATION_PERMISSION_REQUEST_CODE) { if (requestCode == NOTIFICATION_PERMISSION_REQUEST_CODE) {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { isBlockNotification = true
startForeground() if (grantResults.isNotEmpty()) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startForeground()
}
} }
} }
return true; return false;
} }

View File

@@ -1,6 +1,7 @@
package dart_bridge package dart_bridge
/* /*
#include <stdlib.h>
#include "stdint.h" #include "stdint.h"
#include "include/dart_api_dl.h" #include "include/dart_api_dl.h"
#include "include/dart_api_dl.c" #include "include/dart_api_dl.c"
@@ -28,6 +29,7 @@ func SendToPort(port int64, msg string) {
var obj C.Dart_CObject var obj C.Dart_CObject
obj._type = C.Dart_CObject_kString obj._type = C.Dart_CObject_kString
msgString := C.CString(msg) msgString := C.CString(msg)
defer C.free(unsafe.Pointer(msgString))
ptr := unsafe.Pointer(&obj.value[0]) ptr := unsafe.Pointer(&obj.value[0])
*(**C.char)(ptr) = msgString *(**C.char)(ptr) = msgString
isSuccess := C.GoDart_PostCObject(C.Dart_Port_DL(port), &obj) isSuccess := C.GoDart_PostCObject(C.Dart_Port_DL(port), &obj)

View File

@@ -1,5 +1,8 @@
package main package main
/*
#include <stdlib.h>
*/
import "C" import "C"
import ( import (
bridge "core/dart-bridge" bridge "core/dart-bridge"
@@ -71,8 +74,8 @@ func forceGc() {
//export validateConfig //export validateConfig
func validateConfig(s *C.char, port C.longlong) { func validateConfig(s *C.char, port C.longlong) {
i := int64(port) i := int64(port)
bytes := []byte(C.GoString(s))
go func() { go func() {
bytes := []byte(C.GoString(s))
_, err := config.UnmarshalRawConfig(bytes) _, err := config.UnmarshalRawConfig(bytes)
if err != nil { if err != nil {
bridge.SendToPort(i, err.Error()) bridge.SendToPort(i, err.Error())
@@ -85,8 +88,8 @@ func validateConfig(s *C.char, port C.longlong) {
//export updateConfig //export updateConfig
func updateConfig(s *C.char, port C.longlong) { func updateConfig(s *C.char, port C.longlong) {
i := int64(port) i := int64(port)
paramsString := C.GoString(s)
go func() { go func() {
paramsString := C.GoString(s)
var params = &GenerateConfigParams{} var params = &GenerateConfigParams{}
err := json.Unmarshal([]byte(paramsString), params) err := json.Unmarshal([]byte(paramsString), params)
if err != nil { if err != nil {
@@ -148,8 +151,8 @@ func getProxies() *C.char {
//export changeProxy //export changeProxy
func changeProxy(s *C.char) bool { func changeProxy(s *C.char) bool {
paramsString := C.GoString(s)
go func() { go func() {
paramsString := C.GoString(s)
var params = &ChangeProxyParams{} var params = &ChangeProxyParams{}
err := json.Unmarshal([]byte(paramsString), params) err := json.Unmarshal([]byte(paramsString), params)
if err != nil { if err != nil {
@@ -211,8 +214,8 @@ func resetTraffic() {
//export asyncTestDelay //export asyncTestDelay
func asyncTestDelay(s *C.char, port C.longlong) { func asyncTestDelay(s *C.char, port C.longlong) {
i := int64(port) i := int64(port)
paramsString := C.GoString(s)
go func() { go func() {
paramsString := C.GoString(s)
var params = &TestDelayParams{} var params = &TestDelayParams{}
err := json.Unmarshal([]byte(paramsString), params) err := json.Unmarshal([]byte(paramsString), params)
if err != nil { if err != nil {
@@ -296,7 +299,6 @@ func closeConnections() bool {
//export closeConnection //export closeConnection
func closeConnection(id *C.char) bool { func closeConnection(id *C.char) bool {
connectionId := C.GoString(id) connectionId := C.GoString(id)
err := statistic.DefaultManager.Get(connectionId).Close() err := statistic.DefaultManager.Get(connectionId).Close()
if err != nil { if err != nil {
return false return false
@@ -307,10 +309,13 @@ func closeConnection(id *C.char) bool {
//export getProviders //export getProviders
func getProviders() *C.char { func getProviders() *C.char {
data, err := json.Marshal(tunnel.Providers()) data, err := json.Marshal(tunnel.Providers())
var msg *C.char
if err != nil { if err != nil {
return C.CString("") msg = C.CString("")
return msg
} }
return C.CString(string(data)) msg = C.CString(string(data))
return msg
} }
//export getProvider //export getProvider
@@ -360,10 +365,9 @@ func getExternalProviders() *C.char {
//export updateExternalProvider //export updateExternalProvider
func updateExternalProvider(providerName *C.char, providerType *C.char, port C.longlong) { func updateExternalProvider(providerName *C.char, providerType *C.char, port C.longlong) {
i := int64(port) i := int64(port)
providerNameString := C.GoString(providerName)
providerTypeString := C.GoString(providerType)
go func() { go func() {
providerNameString := C.GoString(providerName)
providerTypeString := C.GoString(providerType)
switch providerTypeString { switch providerTypeString {
case "Proxy": case "Proxy":
providers := tunnel.Providers() providers := tunnel.Providers()
@@ -409,6 +413,11 @@ func initNativeApiBridge(api unsafe.Pointer, port C.longlong) {
bridge.Port = &i bridge.Port = &i
} }
//export freeCString
func freeCString(s *C.char) {
C.free(unsafe.Pointer(s))
}
func init() { func init() {
provider.HealthcheckHook = func(name string, delay uint16) { provider.HealthcheckHook = func(name string, delay uint16) {
delayData := &Delay{ delayData := &Delay{

42
core/platform/limit.go Normal file
View File

@@ -0,0 +1,42 @@
//go:build android
package platform
import "syscall"
var nullFd int
var maxFdCount int
func init() {
fd, err := syscall.Open("/dev/null", syscall.O_WRONLY, 0644)
if err != nil {
panic(err.Error())
}
nullFd = fd
var limit syscall.Rlimit
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
maxFdCount = 1024
} else {
maxFdCount = int(limit.Cur)
}
maxFdCount = maxFdCount / 4 * 3
}
func ShouldBlockConnection() bool {
fd, err := syscall.Dup(nullFd)
if err != nil {
return true
}
_ = syscall.Close(fd)
if fd > maxFdCount {
return true
}
return false
}

View File

@@ -71,8 +71,8 @@ func setProcessMap(s *C.char) {
if s == nil { if s == nil {
return return
} }
paramsString := C.GoString(s)
go func() { go func() {
paramsString := C.GoString(s)
var processMapItem = &ProcessMapItem{} var processMapItem = &ProcessMapItem{}
err := json.Unmarshal([]byte(paramsString), processMapItem) err := json.Unmarshal([]byte(paramsString), processMapItem)
if err == nil { if err == nil {

View File

@@ -4,7 +4,9 @@ package main
import "C" import "C"
import ( import (
"core/platform"
t "core/tun" t "core/tun"
"errors"
"github.com/metacubex/mihomo/component/dialer" "github.com/metacubex/mihomo/component/dialer"
"github.com/metacubex/mihomo/log" "github.com/metacubex/mihomo/log"
"golang.org/x/sync/semaphore" "golang.org/x/sync/semaphore"
@@ -59,8 +61,13 @@ func stopTun() {
}() }()
} }
var errBlocked = errors.New("blocked")
func init() { func init() {
dialer.DefaultSocketHook = func(network, address string, conn syscall.RawConn) error { dialer.DefaultSocketHook = func(network, address string, conn syscall.RawConn) error {
if platform.ShouldBlockConnection() {
return errBlocked
}
return conn.Control(func(fd uintptr) { return conn.Control(func(fd uintptr) {
if tun != nil { if tun != nil {
tun.MarkSocket(int(fd)) tun.MarkSocket(int(fd))

View File

@@ -130,7 +130,6 @@ class ApplicationState extends State<Application> {
httpTimeoutDuration, httpTimeoutDuration,
(timer) async { (timer) async {
await globalState.appController.updateGroups(); await globalState.appController.updateGroups();
globalState.appController.appState.sortNum++;
}, },
); );
} }
@@ -165,7 +164,6 @@ class ApplicationState extends State<Application> {
themeMode: state.themeMode, themeMode: state.themeMode,
theme: ThemeData( theme: ThemeData(
useMaterial3: true, useMaterial3: true,
fontFamily: '',
pageTransitionsTheme: _pageTransitionsTheme, pageTransitionsTheme: _pageTransitionsTheme,
colorScheme: _getAppColorScheme( colorScheme: _getAppColorScheme(
brightness: Brightness.light, brightness: Brightness.light,
@@ -175,7 +173,6 @@ class ApplicationState extends State<Application> {
), ),
darkTheme: ThemeData( darkTheme: ThemeData(
useMaterial3: true, useMaterial3: true,
fontFamily: '',
pageTransitionsTheme: _pageTransitionsTheme, pageTransitionsTheme: _pageTransitionsTheme,
colorScheme: _getAppColorScheme( colorScheme: _getAppColorScheme(
brightness: Brightness.dark, brightness: Brightness.dark,

View File

@@ -45,10 +45,10 @@ class ClashCore {
} }
bool init(String homeDir) { bool init(String homeDir) {
return clashFFI.initClash( final homeDirChar = homeDir.toNativeUtf8().cast<Char>();
homeDir.toNativeUtf8().cast(), final isInit = clashFFI.initClash(homeDirChar) == 1;
) == malloc.free(homeDirChar);
1; return isInit;
} }
shutdown() { shutdown() {
@@ -67,10 +67,12 @@ class ClashCore {
receiver.close(); receiver.close();
} }
}); });
final dataChar = data.toNativeUtf8().cast<Char>();
clashFFI.validateConfig( clashFFI.validateConfig(
data.toNativeUtf8().cast(), dataChar,
receiver.sendPort.nativePort, receiver.sendPort.nativePort,
); );
malloc.free(dataChar);
return completer.future; return completer.future;
} }
@@ -84,20 +86,23 @@ class ClashCore {
} }
}); });
final params = json.encode(updateConfigParams); final params = json.encode(updateConfigParams);
final paramsChar = params.toNativeUtf8().cast<Char>();
clashFFI.updateConfig( clashFFI.updateConfig(
params.toNativeUtf8().cast(), paramsChar,
receiver.sendPort.nativePort, receiver.sendPort.nativePort,
); );
malloc.free(paramsChar);
return completer.future; return completer.future;
} }
Future<List<Group>> getProxiesGroups() { Future<List<Group>> getProxiesGroups() {
final proxiesRaw = clashFFI.getProxies(); final proxiesRaw = clashFFI.getProxies();
final proxiesRawString = proxiesRaw.cast<Utf8>().toDartString(); final proxiesRawString = proxiesRaw.cast<Utf8>().toDartString();
clashFFI.freeCString(proxiesRaw);
return Isolate.run<List<Group>>(() { return Isolate.run<List<Group>>(() {
if(proxiesRawString.isEmpty) return []; if (proxiesRawString.isEmpty) return [];
final proxies = json.decode(proxiesRawString) as Map; final proxies = (json.decode(proxiesRawString) ?? {}) as Map;
if(proxies.isEmpty) return []; if (proxies.isEmpty) return [];
final groupNames = [ final groupNames = [
UsedProxy.GLOBAL.name, UsedProxy.GLOBAL.name,
...(proxies[UsedProxy.GLOBAL.name]["all"] as List).where((e) { ...(proxies[UsedProxy.GLOBAL.name]["all"] as List).where((e) {
@@ -111,7 +116,7 @@ class ClashCore {
group["all"] = ((group["all"] ?? []) as List) group["all"] = ((group["all"] ?? []) as List)
.map( .map(
(name) => proxies[name], (name) => proxies[name],
) )
.toList(); .toList();
return group; return group;
}).toList(); }).toList();
@@ -122,14 +127,15 @@ class ClashCore {
Future<List<ExternalProvider>> getExternalProviders() { Future<List<ExternalProvider>> getExternalProviders() {
final externalProvidersRaw = clashFFI.getExternalProviders(); final externalProvidersRaw = clashFFI.getExternalProviders();
final externalProvidersRawString = final externalProvidersRawString =
externalProvidersRaw.cast<Utf8>().toDartString(); externalProvidersRaw.cast<Utf8>().toDartString();
clashFFI.freeCString(externalProvidersRaw);
return Isolate.run<List<ExternalProvider>>(() { return Isolate.run<List<ExternalProvider>>(() {
final externalProviders = final externalProviders =
(json.decode(externalProvidersRawString) as List<dynamic>) (json.decode(externalProvidersRawString) as List<dynamic>)
.map( .map(
(item) => ExternalProvider.fromJson(item), (item) => ExternalProvider.fromJson(item),
) )
.toList(); .toList();
return externalProviders; return externalProviders;
}); });
} }
@@ -146,17 +152,24 @@ class ClashCore {
receiver.close(); receiver.close();
} }
}); });
final providerNameChar = providerName.toNativeUtf8().cast<Char>();
final providerTypeChar = providerType.toNativeUtf8().cast<Char>();
clashFFI.updateExternalProvider( clashFFI.updateExternalProvider(
providerName.toNativeUtf8().cast(), providerNameChar,
providerType.toNativeUtf8().cast(), providerTypeChar,
receiver.sendPort.nativePort, receiver.sendPort.nativePort,
); );
malloc.free(providerNameChar);
malloc.free(providerTypeChar);
return completer.future; return completer.future;
} }
bool changeProxy(ChangeProxyParams changeProxyParams) { bool changeProxy(ChangeProxyParams changeProxyParams) {
final params = json.encode(changeProxyParams); final params = json.encode(changeProxyParams);
return clashFFI.changeProxy(params.toNativeUtf8().cast()) == 1; final paramsChar = params.toNativeUtf8().cast<Char>();
final isInit = clashFFI.changeProxy(paramsChar) == 1;
malloc.free(paramsChar);
return isInit;
} }
Future<Delay> getDelay(String proxyName) { Future<Delay> getDelay(String proxyName) {
@@ -172,13 +185,15 @@ class ClashCore {
receiver.close(); receiver.close();
} }
}); });
final delayParamsChar = json.encode(delayParams).toNativeUtf8().cast<Char>();
clashFFI.asyncTestDelay( clashFFI.asyncTestDelay(
json.encode(delayParams).toNativeUtf8().cast(), delayParamsChar,
receiver.sendPort.nativePort, receiver.sendPort.nativePort,
); );
malloc.free(delayParamsChar);
Future.delayed(httpTimeoutDuration + moreDuration, () { Future.delayed(httpTimeoutDuration + moreDuration, () {
receiver.close(); receiver.close();
if(!completer.isCompleted){ if (!completer.isCompleted) {
completer.complete( completer.complete(
Delay(name: proxyName, value: -1), Delay(name: proxyName, value: -1),
); );
@@ -188,28 +203,33 @@ class ClashCore {
} }
clearEffect(String path) { clearEffect(String path) {
clashFFI.clearEffect(path.toNativeUtf8().cast()); final pathChar = path.toNativeUtf8().cast<Char>();
clashFFI.clearEffect(pathChar);
malloc.free(pathChar);
} }
VersionInfo getVersionInfo() { VersionInfo getVersionInfo() {
final versionInfoRaw = clashFFI.getVersionInfo(); final versionInfoRaw = clashFFI.getVersionInfo();
final versionInfo = json.decode(versionInfoRaw.cast<Utf8>().toDartString()); final versionInfo = json.decode(versionInfoRaw.cast<Utf8>().toDartString());
clashFFI.freeCString(versionInfoRaw);
return VersionInfo.fromJson(versionInfo); return VersionInfo.fromJson(versionInfo);
} }
Traffic getTraffic() { Traffic getTraffic() {
final trafficRaw = clashFFI.getTraffic(); final trafficRaw = clashFFI.getTraffic();
final trafficMap = json.decode(trafficRaw.cast<Utf8>().toDartString()); final trafficMap = json.decode(trafficRaw.cast<Utf8>().toDartString());
clashFFI.freeCString(trafficRaw);
return Traffic.fromMap(trafficMap); return Traffic.fromMap(trafficMap);
} }
Traffic getTotalTraffic() { Traffic getTotalTraffic() {
final trafficRaw = clashFFI.getTotalTraffic(); final trafficRaw = clashFFI.getTotalTraffic();
final trafficMap = json.decode(trafficRaw.cast<Utf8>().toDartString()); final trafficMap = json.decode(trafficRaw.cast<Utf8>().toDartString());
clashFFI.freeCString(trafficRaw);
return Traffic.fromMap(trafficMap); return Traffic.fromMap(trafficMap);
} }
void resetTraffic(){ void resetTraffic() {
clashFFI.resetTraffic(); clashFFI.resetTraffic();
} }
@@ -234,7 +254,9 @@ class ClashCore {
} }
void setProcessMap(ProcessMapItem processMapItem) { void setProcessMap(ProcessMapItem processMapItem) {
clashFFI.setProcessMap(json.encode(processMapItem).toNativeUtf8().cast()); final processMapItemChar = json.encode(processMapItem).toNativeUtf8().cast<Char>();
clashFFI.setProcessMap(processMapItemChar);
malloc.free(processMapItemChar);
} }
// DateTime? getRunTime() { // DateTime? getRunTime() {
@@ -246,13 +268,16 @@ class ClashCore {
List<Connection> getConnections() { List<Connection> getConnections() {
final connectionsDataRaw = clashFFI.getConnections(); final connectionsDataRaw = clashFFI.getConnections();
final connectionsData = final connectionsData =
json.decode(connectionsDataRaw.cast<Utf8>().toDartString()) as Map; json.decode(connectionsDataRaw.cast<Utf8>().toDartString()) as Map;
clashFFI.freeCString(connectionsDataRaw);
final connectionsRaw = connectionsData['connections'] as List? ?? []; final connectionsRaw = connectionsData['connections'] as List? ?? [];
return connectionsRaw.map((e) => Connection.fromJson(e)).toList(); return connectionsRaw.map((e) => Connection.fromJson(e)).toList();
} }
closeConnections(String id) { closeConnections(String id) {
clashFFI.closeConnection(id.toNativeUtf8().cast()); final idChar = id.toNativeUtf8().cast<Char>();
clashFFI.closeConnection(idChar);
malloc.free(idChar);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,6 @@ class Android {
init() async { init() async {
app?.onExit = () { app?.onExit = () {
clashCore.shutdown(); clashCore.shutdown();
print("adsadda==>");
exit(0); exit(0);
}; };
} }

View File

@@ -7,6 +7,7 @@ const coreName = "clash.meta";
const packageName = "FlClash"; const packageName = "FlClash";
const httpTimeoutDuration = Duration(milliseconds: 5000); const httpTimeoutDuration = Duration(milliseconds: 5000);
const moreDuration = Duration(milliseconds: 100); const moreDuration = Duration(milliseconds: 100);
const animateDuration = Duration(milliseconds: 100);
const defaultUpdateDuration = Duration(days: 1); const defaultUpdateDuration = Duration(days: 1);
const mmdbFileName = "geoip.metadb"; const mmdbFileName = "geoip.metadb";
const geoSiteFileName = "GeoSite.dat"; const geoSiteFileName = "GeoSite.dat";

View File

@@ -7,8 +7,12 @@ extension BuildContextExtension on BuildContext {
return findAncestorStateOfType<CommonScaffoldState>(); return findAncestorStateOfType<CommonScaffoldState>();
} }
Size get appSize{
return MediaQuery.of(this).size;
}
double get width { double get width {
return MediaQuery.of(this).size.width; return appSize.width;
} }
ColorScheme get colorScheme => Theme.of(this).colorScheme; ColorScheme get colorScheme => Theme.of(this).colorScheme;

View File

@@ -2,20 +2,13 @@ import 'package:flutter/material.dart';
import 'color.dart'; import 'color.dart';
extension TextStyleExtension on TextStyle { extension TextStyleExtension on TextStyle {
toLight() { TextStyle get toLight => copyWith(color: color?.toLight());
return copyWith(color: color?.toLight());
}
toLighter() { TextStyle get toLighter => copyWith(color: color?.toLighter());
return copyWith(color: color?.toLighter());
}
TextStyle get toSoftBold => copyWith(fontWeight: FontWeight.w500);
toSoftBold() { TextStyle get toBold => copyWith(fontWeight: FontWeight.bold);
return copyWith(fontWeight: FontWeight.w500);
}
toBold() { TextStyle get toMinus => copyWith(fontSize: fontSize! - 1);
return copyWith(fontWeight: FontWeight.bold); }
}
}

View File

@@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:fl_clash/enum/enum.dart'; import 'package:fl_clash/enum/enum.dart';
import 'package:fl_clash/plugins/app.dart';
import 'package:fl_clash/state.dart'; import 'package:fl_clash/state.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -267,6 +266,7 @@ class AppController {
} }
init() async { init() async {
updateLogStatus();
if (!config.silentLaunch) { if (!config.silentLaunch) {
window?.show(); window?.show();
} }
@@ -290,14 +290,13 @@ class AppController {
} }
afterInit() async { afterInit() async {
if (config.autoRun) { await proxyManager.updateStartTime();
if (proxyManager.isStart) {
await updateSystemProxy(true); await updateSystemProxy(true);
} else { } else {
await proxyManager.updateStartTime(); await updateSystemProxy(config.autoRun);
await updateSystemProxy(proxyManager.isStart);
} }
autoUpdateProfiles(); autoUpdateProfiles();
updateLogStatus();
autoCheckUpdate(); autoCheckUpdate();
} }
@@ -360,7 +359,9 @@ class AppController {
} }
addProfileFormURL(String url) async { addProfileFormURL(String url) async {
globalState.navigatorKey.currentState?.popUntil((route) => route.isFirst); if (globalState.navigatorKey.currentState?.canPop() ?? false) {
globalState.navigatorKey.currentState?.popUntil((route) => route.isFirst);
}
toProfiles(); toProfiles();
final commonScaffoldState = globalState.homeScaffoldKey.currentState; final commonScaffoldState = globalState.homeScaffoldKey.currentState;
if (commonScaffoldState?.mounted != true) return; if (commonScaffoldState?.mounted != true) return;
@@ -406,9 +407,54 @@ class AppController {
addProfileFormURL(url); addProfileFormURL(url);
} }
int get columns =>
globalState.getColumns(appState.viewMode, config.proxiesColumns);
changeColumns() {
config.proxiesColumns = globalState.getColumns(
appState.viewMode,
columns - 1,
);
}
updateViewWidth(double width) { updateViewWidth(double width) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
appState.viewWidth = width; appState.viewWidth = width;
}); });
} }
List<Proxy> _sortOfName(List<Proxy> proxies) {
return List.of(proxies)
..sort(
(a, b) => other.sortByChar(a.name, b.name),
);
}
List<Proxy> _sortOfDelay(List<Proxy> proxies) {
return proxies = List.of(proxies)
..sort(
(a, b) {
final aDelay = appState.getDelay(a.name);
final bDelay = appState.getDelay(b.name);
if (aDelay == null && bDelay == null) {
return 0;
}
if (aDelay == null || aDelay == -1) {
return 1;
}
if (bDelay == null || bDelay == -1) {
return -1;
}
return aDelay.compareTo(bDelay);
},
);
}
List<Proxy> getSortProxies(List<Proxy> proxies) {
return switch (config.proxiesSortType) {
ProxiesSortType.none => proxies,
ProxiesSortType.delay => _sortOfDelay(proxies),
ProxiesSortType.name => _sortOfName(proxies),
};
}
} }

View File

@@ -65,7 +65,10 @@ enum RecoveryOption {
onlyProfiles, onlyProfiles,
} }
enum ChipType { enum ChipType { action, delete }
action,
delete, enum CommonCardType { plain, filled }
}
enum ProxiesType { tab, expansion }
enum ProxyCardType { expand, shrink }

View File

@@ -191,7 +191,7 @@ class _ConfigFragmentState extends State<ConfigFragment> {
builder: (_, ipv6, __) { builder: (_, ipv6, __) {
return ListItem.switchItem( return ListItem.switchItem(
leading: const Icon(Icons.water_outlined), leading: const Icon(Icons.water_outlined),
title: const Text("Ipv6"), title: const Text("IPv6"),
subtitle: Text(appLocalizations.ipv6Desc), subtitle: Text(appLocalizations.ipv6Desc),
delegate: SwitchDelegate( delegate: SwitchDelegate(
value: ipv6, value: ipv6,

View File

@@ -198,7 +198,7 @@ class ConnectionItem extends StatelessWidget {
} }
String _getRequestText(Metadata metadata) { String _getRequestText(Metadata metadata) {
var text = "${metadata.network}:://"; var text = "${metadata.network}://";
final ips = [ final ips = [
metadata.host, metadata.host,
metadata.destinationIP, metadata.destinationIP,

View File

@@ -13,6 +13,7 @@ class CoreInfo extends StatelessWidget {
selector: (_, appState) => appState.versionInfo, selector: (_, appState) => appState.versionInfo,
builder: (_, versionInfo, __) { builder: (_, versionInfo, __) {
return CommonCard( return CommonCard(
onPressed: () {},
info: Info( info: Info(
label: appLocalizations.coreInfo, label: appLocalizations.coreInfo,
iconData: Icons.memory, iconData: Icons.memory,
@@ -31,7 +32,7 @@ class CoreInfo extends StatelessWidget {
style: context style: context
.textTheme .textTheme
.titleMedium .titleMedium
?.toSoftBold(), ?.toSoftBold,
), ),
), ),
const SizedBox( const SizedBox(
@@ -44,7 +45,7 @@ class CoreInfo extends StatelessWidget {
style: context style: context
.textTheme .textTheme
.titleLarge .titleLarge
?.toSoftBold(), ?.toSoftBold,
), ),
), ),
], ],

View File

@@ -56,7 +56,7 @@ class _DashboardFragmentState extends State<DashboardFragment> {
), ),
GridItem( GridItem(
crossAxisCellCount: isDesktop ? 4 : 6, crossAxisCellCount: isDesktop ? 4 : 6,
child: const IntranetIp(), child: const IntranetIP(),
), ),
], ],
); );

View File

@@ -5,21 +5,21 @@ 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';
class IntranetIp extends StatefulWidget { class IntranetIP extends StatefulWidget {
const IntranetIp({super.key}); const IntranetIP({super.key});
@override @override
State<IntranetIp> createState() => _IntranetIpState(); State<IntranetIP> createState() => _IntranetIPState();
} }
class _IntranetIpState extends State<IntranetIp> { class _IntranetIPState extends State<IntranetIP> {
final ipNotifier = ValueNotifier<String>(""); final ipNotifier = ValueNotifier<String>("");
Future<String?> getLocalIpAddress() async { Future<String?> getLocalIpAddress() async {
List<NetworkInterface> interfaces = await NetworkInterface.list(); List<NetworkInterface> interfaces = await NetworkInterface.list();
for (final interface in interfaces) { for (final interface in interfaces) {
for (final address in interface.addresses) { for (final address in interface.addresses) {
if (address.type == InternetAddressType.IPv4 && !address.isLoopback) { if (!address.isLoopback) {
return address.address; return address.address;
} }
} }
@@ -45,12 +45,15 @@ class _IntranetIpState extends State<IntranetIp> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CommonCard( return CommonCard(
info: Info( info: Info(
label: appLocalizations.intranetIp, label: appLocalizations.intranetIP,
iconData: Icons.devices, iconData: Icons.devices,
), ),
onPressed: (){
},
child: Container( child: Container(
padding: const EdgeInsets.all(16).copyWith(top: 0), padding: const EdgeInsets.all(16).copyWith(top: 0),
height: globalState.appController.measure.titleLargeHeight + 16, height: globalState.appController.measure.titleLargeHeight + 24 - 1,
child: ValueListenableBuilder( child: ValueListenableBuilder(
valueListenable: ipNotifier, valueListenable: ipNotifier,
builder: (_, value, __) { builder: (_, value, __) {
@@ -65,7 +68,7 @@ class _IntranetIpState extends State<IntranetIp> {
child: TooltipText( child: TooltipText(
text: Text( text: Text(
value, value,
style: context.textTheme.titleLarge?.toSoftBold(), style: context.textTheme.titleLarge?.toSoftBold.toMinus,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
@@ -74,8 +77,11 @@ class _IntranetIpState extends State<IntranetIp> {
], ],
) )
: const Padding( : const Padding(
padding: EdgeInsets.all(4), padding: EdgeInsets.all(2),
child: CircularProgressIndicator(), child: AspectRatio(
aspectRatio: 1,
child: CircularProgressIndicator(),
),
), ),
); );
}, },

View File

@@ -78,6 +78,7 @@ class _NetworkDetectionState extends State<NetworkDetection> {
valueListenable: ipInfoNotifier, valueListenable: ipInfoNotifier,
builder: (_, ipInfo, __) { builder: (_, ipInfo, __) {
return CommonCard( return CommonCard(
onPressed: () {},
child: Column( child: Column(
children: [ children: [
Flexible( Flexible(
@@ -134,8 +135,9 @@ class _NetworkDetectionState extends State<NetworkDetection> {
), ),
), ),
Container( Container(
height: height: globalState.appController.measure.titleLargeHeight +
globalState.appController.measure.titleLargeHeight + 24, 24 -
1,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: const EdgeInsets.all(16).copyWith(top: 0), padding: const EdgeInsets.all(16).copyWith(top: 0),
child: FadeBox( child: FadeBox(
@@ -150,7 +152,7 @@ class _NetworkDetectionState extends State<NetworkDetection> {
text: Text( text: Text(
ipInfo.ip, ipInfo.ip,
style: context.textTheme.titleLarge style: context.textTheme.titleLarge
?.toSoftBold(), ?.toSoftBold.toMinus,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
@@ -164,9 +166,10 @@ class _NetworkDetectionState extends State<NetworkDetection> {
if (timeout) { if (timeout) {
return Text( return Text(
"timeout", "timeout",
style: context.textTheme.titleMedium style: context.textTheme.titleLarge
?.copyWith(color: Colors.red) ?.copyWith(color: Colors.red)
.toSoftBold(), .toSoftBold
.toMinus,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
); );

View File

@@ -47,8 +47,8 @@ class _NetworkSpeedState extends State<NetworkSpeed> {
final showValue = value.showValue; final showValue = value.showValue;
final showUnit = "${value.showUnit}/s"; final showUnit = "${value.showUnit}/s";
final titleLargeSoftBold = final titleLargeSoftBold =
Theme.of(context).textTheme.titleLarge?.toSoftBold(); Theme.of(context).textTheme.titleLarge?.toSoftBold;
final bodyMedium = Theme.of(context).textTheme.bodySmall?.toLight(); final bodyMedium = Theme.of(context).textTheme.bodySmall?.toLight;
final valueText = Text( final valueText = Text(
showValue, showValue,
style: titleLargeSoftBold, style: titleLargeSoftBold,
@@ -75,7 +75,7 @@ class _NetworkSpeedState extends State<NetworkSpeed> {
Flexible( Flexible(
child: Text( child: Text(
label, label,
style: Theme.of(context).textTheme.titleSmall?.toSoftBold(), style: Theme.of(context).textTheme.titleSmall?.toSoftBold,
), ),
), ),
], ],
@@ -111,6 +111,7 @@ class _NetworkSpeedState extends State<NetworkSpeed> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CommonCard( return CommonCard(
onPressed: () {},
info: Info( info: Info(
label: appLocalizations.networkSpeed, label: appLocalizations.networkSpeed,
iconData: Icons.speed, iconData: Icons.speed,

View File

@@ -33,6 +33,7 @@ class OutboundMode extends StatelessWidget {
selector: (_, clashConfig) => clashConfig.mode, selector: (_, clashConfig) => clashConfig.mode,
builder: (_, mode, __) { builder: (_, mode, __) {
return CommonCard( return CommonCard(
onPressed: () {},
info: Info( info: Info(
label: appLocalizations.outboundMode, label: appLocalizations.outboundMode,
iconData: Icons.call_split, iconData: Icons.call_split,
@@ -67,7 +68,7 @@ class OutboundMode extends StatelessWidget {
.of(context) .of(context)
.textTheme .textTheme
.titleMedium .titleMedium
?.toSoftBold(), ?.toSoftBold,
), ),
), ),
], ],

View File

@@ -13,19 +13,17 @@ class StartButton extends StatefulWidget {
class _StartButtonState extends State<StartButton> class _StartButtonState extends State<StartButton>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
bool isStart = false;
bool isInit = false;
late AnimationController _controller; late AnimationController _controller;
bool isStart = false;
@override @override
void initState() { void initState() {
isStart = globalState.appController.appState.isStart; super.initState();
_controller = AnimationController( _controller = AnimationController(
vsync: this, vsync: this,
value: isStart ? 1 : 0, value: 0,
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
); );
super.initState();
} }
@override @override
@@ -35,9 +33,12 @@ class _StartButtonState extends State<StartButton>
} }
handleSwitchStart() { handleSwitchStart() {
isStart = !isStart; final appController = globalState.appController;
updateController(); if (isStart == appController.appState.isStart) {
updateSystemProxy(); isStart = !isStart;
updateController();
appController.updateSystemProxy(isStart);
}
} }
updateController() { updateController() {
@@ -48,11 +49,18 @@ class _StartButtonState extends State<StartButton>
} }
} }
updateSystemProxy() { Widget _updateControllerContainer(Widget child) {
WidgetsBinding.instance.addPostFrameCallback((_) async { return Selector<AppState, bool>(
final appController = globalState.appController; selector: (_, appState) => appState.isStart,
await appController.updateSystemProxy(isStart); builder: (_, isStart, child) {
}); if(isStart != this.isStart){
this.isStart = isStart;
updateController();
}
return child!;
},
child: child,
);
} }
@override @override
@@ -72,8 +80,7 @@ class _StartButtonState extends State<StartButton>
other.getTimeDifference( other.getTimeDifference(
DateTime.now(), DateTime.now(),
), ),
style: style: Theme.of(context).textTheme.titleMedium?.toSoftBold,
Theme.of(context).textTheme.titleMedium?.toSoftBold(),
), ),
) )
.width + .width +
@@ -119,24 +126,14 @@ class _StartButtonState extends State<StartButton>
child: child, child: child,
); );
}, },
child: Selector<AppState, bool>( child: _updateControllerContainer(
selector: (_, appState) => appState.runTime != null, Selector<AppState, int?>(
builder: (_, isRun, child) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (isStart != isRun) {
isStart = isRun;
updateController();
}
});
return child!;
},
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,
); );
}, },
), ),

View File

@@ -42,7 +42,7 @@ class TrafficUsage extends StatelessWidget {
), ),
Text( Text(
trafficValue.showUnit, trafficValue.showUnit,
style: context.textTheme.labelMedium?.toLight(), style: context.textTheme.labelMedium?.toLight,
), ),
], ],
); );
@@ -51,6 +51,7 @@ class TrafficUsage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CommonCard( return CommonCard(
onPressed: () {},
info: Info( info: Info(
label: appLocalizations.trafficUsage, label: appLocalizations.trafficUsage,
iconData: Icons.data_saver_off, iconData: Icons.data_saver_off,

View File

@@ -25,7 +25,9 @@ class AddProfile extends StatelessWidget {
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) {
_handleAddProfileFormURL(url); WidgetsBinding.instance.addPostFrameCallback((_){
_handleAddProfileFormURL(url);
});
} }
} }
@@ -91,7 +93,8 @@ class _URLFormDialogState extends State<URLFormDialog> {
runSpacing: 16, runSpacing: 16,
children: [ children: [
TextField( TextField(
maxLines: null, maxLines: 5,
minLines: 1,
controller: urlController, controller: urlController,
decoration: InputDecoration( decoration: InputDecoration(
border: const OutlineInputBorder(), border: const OutlineInputBorder(),

View File

@@ -94,7 +94,8 @@ class _EditProfileState extends State<EditProfile> {
ListItem( ListItem(
title: TextFormField( title: TextFormField(
controller: urlController, controller: urlController,
maxLines: null, maxLines: 5,
minLines: 1,
decoration: InputDecoration( decoration: InputDecoration(
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
labelText: appLocalizations.url, labelText: appLocalizations.url,

View File

@@ -55,7 +55,7 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
_updateProfiles() async { _updateProfiles() async {
final updateProfiles = profileItemKeys.map<Future>( final updateProfiles = profileItemKeys.map<Future>(
(key) async => await key.currentState?.updateProfile(false)); (key) async => await key.currentState?.updateProfile(false));
final result = await Future.wait(updateProfiles); await Future.wait(updateProfiles);
} }
_initScaffoldState() { _initScaffoldState() {
@@ -253,7 +253,7 @@ class _ProfileItemState extends State<ProfileItem> {
), ),
Text( Text(
profile.lastUpdateDate?.lastUpdateTimeDesc ?? '', profile.lastUpdateDate?.lastUpdateTimeDesc ?? '',
style: textTheme.labelMedium?.toLight(), style: textTheme.labelMedium?.toLight,
), ),
], ],
), ),
@@ -284,7 +284,7 @@ class _ProfileItemState extends State<ProfileItem> {
), ),
Text( Text(
"$useShow / $totalShow", "$useShow / $totalShow",
style: textTheme.labelMedium?.toLight(), style: textTheme.labelMedium?.toLight,
), ),
const SizedBox( const SizedBox(
height: 2, height: 2,
@@ -293,14 +293,14 @@ class _ProfileItemState extends State<ProfileItem> {
children: [ children: [
Text( Text(
appLocalizations.expirationTime, appLocalizations.expirationTime,
style: textTheme.labelMedium?.toLighter(), style: textTheme.labelMedium?.toLighter,
), ),
const SizedBox( const SizedBox(
width: 4, width: 4,
), ),
Text( Text(
expireShow, expireShow,
style: textTheme.labelMedium?.toLighter(), style: textTheme.labelMedium?.toLighter,
), ),
], ],
) )
@@ -437,16 +437,16 @@ class _ProfileItemState extends State<ProfileItem> {
label: appLocalizations.update, label: appLocalizations.update,
iconData: Icons.sync, iconData: Icons.sync,
), ),
CommonPopupMenuItem(
action: ProfileActions.view,
label: appLocalizations.view,
iconData: Icons.visibility,
),
CommonPopupMenuItem( CommonPopupMenuItem(
action: ProfileActions.delete, action: ProfileActions.delete,
label: appLocalizations.delete, label: appLocalizations.delete,
iconData: Icons.delete, iconData: Icons.delete,
), ),
CommonPopupMenuItem(
action: ProfileActions.view,
label: "查看",
iconData: Icons.visibility,
),
], ],
onSelected: (ProfileActions? action) async { onSelected: (ProfileActions? action) async {
switch (action) { switch (action) {

File diff suppressed because it is too large Load Diff

View File

@@ -193,7 +193,7 @@ class RequestItem extends StatelessWidget {
} }
String _getRequestText(Metadata metadata) { String _getRequestText(Metadata metadata) {
var text = "${metadata.network}:://"; var text = "${metadata.network}://";
final ips = [ final ips = [
metadata.host, metadata.host,
metadata.destinationIP, metadata.destinationIP,

View File

@@ -111,7 +111,7 @@
"noMoreInfoDesc": "No more info", "noMoreInfoDesc": "No more info",
"profileParseErrorDesc": "profile parse error", "profileParseErrorDesc": "profile parse error",
"proxyPort": "ProxyPort", "proxyPort": "ProxyPort",
"proxyPortDesc": "Set the clash listening port", "proxyPortDesc": "Set the Clash listening port",
"port": "Port", "port": "Port",
"logLevel": "LogLevel", "logLevel": "LogLevel",
"show": "Show", "show": "Show",
@@ -161,20 +161,19 @@
"checking": "Checking...", "checking": "Checking...",
"country": "Country", "country": "Country",
"checkError": "Check error", "checkError": "Check error",
"ipCheckTimeout": "Ip check timeout",
"search": "Search", "search": "Search",
"allowBypass": "Allow applications to bypass VPN", "allowBypass": "Allow applications to bypass VPN",
"allowBypassDesc": "Some apps can bypass VPN when turned on", "allowBypassDesc": "Some apps can bypass VPN when turned on",
"externalController": "ExternalController", "externalController": "ExternalController",
"externalControllerDesc": "Once enabled, the clash kernel can be controlled on port 9090", "externalControllerDesc": "Once enabled, the Clash kernel can be controlled on port 9090",
"ipv6Desc": "When turned on it will be able to receive ipv6 traffic", "ipv6Desc": "When turned on it will be able to receive IPv6 traffic",
"app": "App", "app": "App",
"general": "General", "general": "General",
"systemProxyDesc": "Attach HTTP proxy to VpnService", "systemProxyDesc": "Attach HTTP proxy to VpnService",
"unifiedDelay": "Unified delay", "unifiedDelay": "Unified delay",
"unifiedDelayDesc": "Remove extra delays such as handshaking", "unifiedDelayDesc": "Remove extra delays such as handshaking",
"tcpConcurrent": "Tcp concurrent", "tcpConcurrent": "TCP concurrent",
"tcpConcurrentDesc": "Enabling it will allow tcp concurrency", "tcpConcurrentDesc": "Enabling it will allow TCP concurrency",
"geodataLoader": "Geo Low Memory Mode", "geodataLoader": "Geo Low Memory Mode",
"geodataLoaderDesc": "Enabling will use the Geo low memory loader", "geodataLoaderDesc": "Enabling will use the Geo low memory loader",
"requests": "Requests", "requests": "Requests",
@@ -187,8 +186,8 @@
"connections": "Connections", "connections": "Connections",
"connectionsDesc": "View current connection", "connectionsDesc": "View current connection",
"nullRequestsDesc": "No requests", "nullRequestsDesc": "No requests",
"nullConnectionsDesc": "No Connections", "nullConnectionsDesc": "No connections",
"intranetIp": "Intranet IP", "intranetIP": "Intranet IP",
"view": "View", "view": "View",
"cut": "Cut", "cut": "Cut",
"copy": "Copy", "copy": "Copy",

View File

@@ -111,7 +111,7 @@
"noMoreInfoDesc": "暂无更多信息", "noMoreInfoDesc": "暂无更多信息",
"profileParseErrorDesc": "配置文件解析错误", "profileParseErrorDesc": "配置文件解析错误",
"proxyPort": "代理端口", "proxyPort": "代理端口",
"proxyPortDesc": "设置clash监听端口", "proxyPortDesc": "设置Clash监听端口",
"port": "端口", "port": "端口",
"logLevel": "日志等级", "logLevel": "日志等级",
"show": "显示", "show": "显示",
@@ -161,20 +161,19 @@
"checking": "检测中...", "checking": "检测中...",
"country": "区域", "country": "区域",
"checkError": "检测失败", "checkError": "检测失败",
"ipCheckTimeout": "Ip检测超时",
"search": "搜索", "search": "搜索",
"allowBypass": "允许应用绕过vpn", "allowBypass": "允许应用绕过VPN",
"allowBypassDesc": "开启后部分应用可绕过VPN", "allowBypassDesc": "开启后部分应用可绕过VPN",
"externalController": "外部控制器", "externalController": "外部控制器",
"externalControllerDesc": "开启后将可以通过9090端口控制clash内核", "externalControllerDesc": "开启后将可以通过9090端口控制Clash内核",
"ipv6Desc": "开启后将可以接收ipv6流量", "ipv6Desc": "开启后将可以接收IPv6流量",
"app": "应用", "app": "应用",
"general": "基础", "general": "基础",
"systemProxyDesc": "为VpnService附加HTTP代理", "systemProxyDesc": "为VpnService附加HTTP代理",
"unifiedDelay": "统一延迟", "unifiedDelay": "统一延迟",
"unifiedDelayDesc": "去除握手等额外延迟", "unifiedDelayDesc": "去除握手等额外延迟",
"tcpConcurrent": "TCP并发", "tcpConcurrent": "TCP并发",
"tcpConcurrentDesc": "开启后允许tcp并发", "tcpConcurrentDesc": "开启后允许TCP并发",
"geodataLoader": "Geo低内存模式", "geodataLoader": "Geo低内存模式",
"geodataLoaderDesc": "开启将使用Geo低内存加载器", "geodataLoaderDesc": "开启将使用Geo低内存加载器",
"requests": "请求", "requests": "请求",
@@ -188,7 +187,7 @@
"connectionsDesc": "查看当前连接", "connectionsDesc": "查看当前连接",
"nullRequestsDesc": "暂无请求", "nullRequestsDesc": "暂无请求",
"nullConnectionsDesc": "暂无连接", "nullConnectionsDesc": "暂无连接",
"intranetIp": "内网 IP", "intranetIP": "内网 IP",
"view": "查看", "view": "查看",
"cut": "剪切", "cut": "剪切",
"copy": "复制", "copy": "复制",

View File

@@ -127,7 +127,7 @@ class MessageLookup extends MessageLookupByLibrary {
"externalController": "externalController":
MessageLookupByLibrary.simpleMessage("ExternalController"), MessageLookupByLibrary.simpleMessage("ExternalController"),
"externalControllerDesc": MessageLookupByLibrary.simpleMessage( "externalControllerDesc": MessageLookupByLibrary.simpleMessage(
"Once enabled, the clash kernel can be controlled on port 9090"), "Once enabled, the Clash kernel can be controlled on port 9090"),
"externalResources": "externalResources":
MessageLookupByLibrary.simpleMessage("External resources"), MessageLookupByLibrary.simpleMessage("External resources"),
"file": MessageLookupByLibrary.simpleMessage("File"), "file": MessageLookupByLibrary.simpleMessage("File"),
@@ -152,11 +152,9 @@ class MessageLookup extends MessageLookupByLibrary {
"infiniteTime": "infiniteTime":
MessageLookupByLibrary.simpleMessage("Long term effective"), MessageLookupByLibrary.simpleMessage("Long term effective"),
"init": MessageLookupByLibrary.simpleMessage("Init"), "init": MessageLookupByLibrary.simpleMessage("Init"),
"intranetIp": MessageLookupByLibrary.simpleMessage("Intranet IP"), "intranetIP": MessageLookupByLibrary.simpleMessage("Intranet IP"),
"ipCheckTimeout":
MessageLookupByLibrary.simpleMessage("Ip check timeout"),
"ipv6Desc": MessageLookupByLibrary.simpleMessage( "ipv6Desc": MessageLookupByLibrary.simpleMessage(
"When turned on it will be able to receive ipv6 traffic"), "When turned on it will be able to receive IPv6 traffic"),
"just": MessageLookupByLibrary.simpleMessage("Just"), "just": MessageLookupByLibrary.simpleMessage("Just"),
"language": MessageLookupByLibrary.simpleMessage("Language"), "language": MessageLookupByLibrary.simpleMessage("Language"),
"light": MessageLookupByLibrary.simpleMessage("Light"), "light": MessageLookupByLibrary.simpleMessage("Light"),
@@ -186,7 +184,7 @@ class MessageLookup extends MessageLookupByLibrary {
"notSelectedTip": MessageLookupByLibrary.simpleMessage( "notSelectedTip": MessageLookupByLibrary.simpleMessage(
"The current proxy group cannot be selected."), "The current proxy group cannot be selected."),
"nullConnectionsDesc": "nullConnectionsDesc":
MessageLookupByLibrary.simpleMessage("No Connections"), MessageLookupByLibrary.simpleMessage("No connections"),
"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"),
@@ -230,7 +228,7 @@ class MessageLookup extends MessageLookupByLibrary {
"proxies": MessageLookupByLibrary.simpleMessage("Proxies"), "proxies": MessageLookupByLibrary.simpleMessage("Proxies"),
"proxyPort": MessageLookupByLibrary.simpleMessage("ProxyPort"), "proxyPort": MessageLookupByLibrary.simpleMessage("ProxyPort"),
"proxyPortDesc": MessageLookupByLibrary.simpleMessage( "proxyPortDesc": MessageLookupByLibrary.simpleMessage(
"Set the clash listening port"), "Set the Clash listening port"),
"qrcode": MessageLookupByLibrary.simpleMessage("QR code"), "qrcode": MessageLookupByLibrary.simpleMessage("QR code"),
"qrcodeDesc": MessageLookupByLibrary.simpleMessage( "qrcodeDesc": MessageLookupByLibrary.simpleMessage(
"Scan QR code to obtain profile"), "Scan QR code to obtain profile"),
@@ -268,9 +266,9 @@ class MessageLookup extends MessageLookupByLibrary {
"tabAnimation": MessageLookupByLibrary.simpleMessage("Tab animation"), "tabAnimation": MessageLookupByLibrary.simpleMessage("Tab animation"),
"tabAnimationDesc": MessageLookupByLibrary.simpleMessage( "tabAnimationDesc": MessageLookupByLibrary.simpleMessage(
"When enabled, the home tab will add a toggle animation"), "When enabled, the home tab will add a toggle animation"),
"tcpConcurrent": MessageLookupByLibrary.simpleMessage("Tcp concurrent"), "tcpConcurrent": MessageLookupByLibrary.simpleMessage("TCP concurrent"),
"tcpConcurrentDesc": MessageLookupByLibrary.simpleMessage( "tcpConcurrentDesc": MessageLookupByLibrary.simpleMessage(
"Enabling it will allow tcp concurrency"), "Enabling it will allow TCP concurrency"),
"theme": MessageLookupByLibrary.simpleMessage("Theme"), "theme": MessageLookupByLibrary.simpleMessage("Theme"),
"themeColor": MessageLookupByLibrary.simpleMessage("Theme color"), "themeColor": MessageLookupByLibrary.simpleMessage("Theme color"),
"themeDesc": MessageLookupByLibrary.simpleMessage( "themeDesc": MessageLookupByLibrary.simpleMessage(

View File

@@ -36,7 +36,7 @@ class MessageLookup extends MessageLookupByLibrary {
"addressHelp": MessageLookupByLibrary.simpleMessage("WebDAV服务器地址"), "addressHelp": MessageLookupByLibrary.simpleMessage("WebDAV服务器地址"),
"addressTip": MessageLookupByLibrary.simpleMessage("请输入有效的WebDAV地址"), "addressTip": MessageLookupByLibrary.simpleMessage("请输入有效的WebDAV地址"),
"ago": MessageLookupByLibrary.simpleMessage(""), "ago": MessageLookupByLibrary.simpleMessage(""),
"allowBypass": MessageLookupByLibrary.simpleMessage("允许应用绕过vpn"), "allowBypass": MessageLookupByLibrary.simpleMessage("允许应用绕过VPN"),
"allowBypassDesc": "allowBypassDesc":
MessageLookupByLibrary.simpleMessage("开启后部分应用可绕过VPN"), MessageLookupByLibrary.simpleMessage("开启后部分应用可绕过VPN"),
"allowLan": MessageLookupByLibrary.simpleMessage("局域网代理"), "allowLan": MessageLookupByLibrary.simpleMessage("局域网代理"),
@@ -104,7 +104,7 @@ class MessageLookup extends MessageLookupByLibrary {
"expirationTime": MessageLookupByLibrary.simpleMessage("到期时间"), "expirationTime": MessageLookupByLibrary.simpleMessage("到期时间"),
"externalController": MessageLookupByLibrary.simpleMessage("外部控制器"), "externalController": MessageLookupByLibrary.simpleMessage("外部控制器"),
"externalControllerDesc": "externalControllerDesc":
MessageLookupByLibrary.simpleMessage("开启后将可以通过9090端口控制clash内核"), MessageLookupByLibrary.simpleMessage("开启后将可以通过9090端口控制Clash内核"),
"externalResources": MessageLookupByLibrary.simpleMessage("外部资源"), "externalResources": MessageLookupByLibrary.simpleMessage("外部资源"),
"file": MessageLookupByLibrary.simpleMessage("文件"), "file": MessageLookupByLibrary.simpleMessage("文件"),
"fileDesc": MessageLookupByLibrary.simpleMessage("直接上传配置文件"), "fileDesc": MessageLookupByLibrary.simpleMessage("直接上传配置文件"),
@@ -123,9 +123,8 @@ class MessageLookup extends MessageLookupByLibrary {
"importFromURL": MessageLookupByLibrary.simpleMessage("从URL导入"), "importFromURL": MessageLookupByLibrary.simpleMessage("从URL导入"),
"infiniteTime": MessageLookupByLibrary.simpleMessage("长期有效"), "infiniteTime": MessageLookupByLibrary.simpleMessage("长期有效"),
"init": MessageLookupByLibrary.simpleMessage("初始化"), "init": MessageLookupByLibrary.simpleMessage("初始化"),
"intranetIp": MessageLookupByLibrary.simpleMessage("内网 IP"), "intranetIP": MessageLookupByLibrary.simpleMessage("内网 IP"),
"ipCheckTimeout": MessageLookupByLibrary.simpleMessage("Ip检测超时"), "ipv6Desc": MessageLookupByLibrary.simpleMessage("开启后将可以接收IPv6流量"),
"ipv6Desc": MessageLookupByLibrary.simpleMessage("开启后将可以接收ipv6流量"),
"just": MessageLookupByLibrary.simpleMessage("刚刚"), "just": MessageLookupByLibrary.simpleMessage("刚刚"),
"language": MessageLookupByLibrary.simpleMessage("语言"), "language": MessageLookupByLibrary.simpleMessage("语言"),
"light": MessageLookupByLibrary.simpleMessage("浅色"), "light": MessageLookupByLibrary.simpleMessage("浅色"),
@@ -186,7 +185,7 @@ class MessageLookup extends MessageLookupByLibrary {
"project": MessageLookupByLibrary.simpleMessage("项目"), "project": MessageLookupByLibrary.simpleMessage("项目"),
"proxies": MessageLookupByLibrary.simpleMessage("代理"), "proxies": MessageLookupByLibrary.simpleMessage("代理"),
"proxyPort": MessageLookupByLibrary.simpleMessage("代理端口"), "proxyPort": MessageLookupByLibrary.simpleMessage("代理端口"),
"proxyPortDesc": MessageLookupByLibrary.simpleMessage("设置clash监听端口"), "proxyPortDesc": MessageLookupByLibrary.simpleMessage("设置Clash监听端口"),
"qrcode": MessageLookupByLibrary.simpleMessage("二维码"), "qrcode": MessageLookupByLibrary.simpleMessage("二维码"),
"qrcodeDesc": MessageLookupByLibrary.simpleMessage("扫描二维码获取配置文件"), "qrcodeDesc": MessageLookupByLibrary.simpleMessage("扫描二维码获取配置文件"),
"recovery": MessageLookupByLibrary.simpleMessage("恢复"), "recovery": MessageLookupByLibrary.simpleMessage("恢复"),
@@ -217,7 +216,7 @@ class MessageLookup extends MessageLookupByLibrary {
"tabAnimationDesc": "tabAnimationDesc":
MessageLookupByLibrary.simpleMessage("开启后,主页选项卡将添加切换动画"), MessageLookupByLibrary.simpleMessage("开启后,主页选项卡将添加切换动画"),
"tcpConcurrent": MessageLookupByLibrary.simpleMessage("TCP并发"), "tcpConcurrent": MessageLookupByLibrary.simpleMessage("TCP并发"),
"tcpConcurrentDesc": MessageLookupByLibrary.simpleMessage("开启后允许tcp并发"), "tcpConcurrentDesc": MessageLookupByLibrary.simpleMessage("开启后允许TCP并发"),
"theme": MessageLookupByLibrary.simpleMessage("主题"), "theme": MessageLookupByLibrary.simpleMessage("主题"),
"themeColor": MessageLookupByLibrary.simpleMessage("主题色彩"), "themeColor": MessageLookupByLibrary.simpleMessage("主题色彩"),
"themeDesc": MessageLookupByLibrary.simpleMessage("设置深色模式,调整色彩"), "themeDesc": MessageLookupByLibrary.simpleMessage("设置深色模式,调整色彩"),

View File

@@ -1170,10 +1170,10 @@ class AppLocalizations {
); );
} }
/// `Set the clash listening port` /// `Set the Clash listening port`
String get proxyPortDesc { String get proxyPortDesc {
return Intl.message( return Intl.message(
'Set the clash listening port', 'Set the Clash listening port',
name: 'proxyPortDesc', name: 'proxyPortDesc',
desc: '', desc: '',
args: [], args: [],
@@ -1670,16 +1670,6 @@ class AppLocalizations {
); );
} }
/// `Ip check timeout`
String get ipCheckTimeout {
return Intl.message(
'Ip check timeout',
name: 'ipCheckTimeout',
desc: '',
args: [],
);
}
/// `Search` /// `Search`
String get search { String get search {
return Intl.message( return Intl.message(
@@ -1720,20 +1710,20 @@ class AppLocalizations {
); );
} }
/// `Once enabled, the clash kernel can be controlled on port 9090` /// `Once enabled, the Clash kernel can be controlled on port 9090`
String get externalControllerDesc { String get externalControllerDesc {
return Intl.message( return Intl.message(
'Once enabled, the clash kernel can be controlled on port 9090', 'Once enabled, the Clash kernel can be controlled on port 9090',
name: 'externalControllerDesc', name: 'externalControllerDesc',
desc: '', desc: '',
args: [], args: [],
); );
} }
/// `When turned on it will be able to receive ipv6 traffic` /// `When turned on it will be able to receive IPv6 traffic`
String get ipv6Desc { String get ipv6Desc {
return Intl.message( return Intl.message(
'When turned on it will be able to receive ipv6 traffic', 'When turned on it will be able to receive IPv6 traffic',
name: 'ipv6Desc', name: 'ipv6Desc',
desc: '', desc: '',
args: [], args: [],
@@ -1790,20 +1780,20 @@ class AppLocalizations {
); );
} }
/// `Tcp concurrent` /// `TCP concurrent`
String get tcpConcurrent { String get tcpConcurrent {
return Intl.message( return Intl.message(
'Tcp concurrent', 'TCP concurrent',
name: 'tcpConcurrent', name: 'tcpConcurrent',
desc: '', desc: '',
args: [], args: [],
); );
} }
/// `Enabling it will allow tcp concurrency` /// `Enabling it will allow TCP concurrency`
String get tcpConcurrentDesc { String get tcpConcurrentDesc {
return Intl.message( return Intl.message(
'Enabling it will allow tcp concurrency', 'Enabling it will allow TCP concurrency',
name: 'tcpConcurrentDesc', name: 'tcpConcurrentDesc',
desc: '', desc: '',
args: [], args: [],
@@ -1930,10 +1920,10 @@ class AppLocalizations {
); );
} }
/// `No Connections` /// `No connections`
String get nullConnectionsDesc { String get nullConnectionsDesc {
return Intl.message( return Intl.message(
'No Connections', 'No connections',
name: 'nullConnectionsDesc', name: 'nullConnectionsDesc',
desc: '', desc: '',
args: [], args: [],
@@ -1941,10 +1931,10 @@ class AppLocalizations {
} }
/// `Intranet IP` /// `Intranet IP`
String get intranetIp { String get intranetIP {
return Intl.message( return Intl.message(
'Intranet IP', 'Intranet IP',
name: 'intranetIp', name: 'intranetIP',
desc: '', desc: '',
args: [], args: [],
); );

View File

@@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:collection/collection.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';
@@ -56,6 +57,9 @@ class Config extends ChangeNotifier {
bool _allowBypass; bool _allowBypass;
bool _systemProxy; bool _systemProxy;
DAV? _dav; DAV? _dav;
ProxiesType _proxiesType;
ProxyCardType _proxyCardType;
int _proxiesColumns;
Config() Config()
: _profiles = [], : _profiles = [],
@@ -73,7 +77,10 @@ class Config extends ChangeNotifier {
_systemProxy = true, _systemProxy = true,
_accessControl = const AccessControl(), _accessControl = const AccessControl(),
_isAnimateToPage = true, _isAnimateToPage = true,
_allowBypass = true; _allowBypass = true,
_proxyCardType = ProxyCardType.expand,
_proxiesType = ProxiesType.tab,
_proxiesColumns = 2;
deleteProfileById(String id) { deleteProfileById(String id) {
_profiles = profiles.where((element) => element.id != id).toList(); _profiles = profiles.where((element) => element.id != id).toList();
@@ -150,6 +157,19 @@ class Config extends ChangeNotifier {
String? get currentGroupName => currentProfile?.currentGroupName; String? get currentGroupName => currentProfile?.currentGroupName;
Set<String> get currentUnfoldSet => currentProfile?.unfoldSet ?? {};
updateCurrentUnfoldSet(Set<String> value) {
if (!const SetEquality<String>().equals(currentUnfoldSet, value)) {
_setProfile(
currentProfile!.copyWith(
unfoldSet: value,
),
);
notifyListeners();
}
}
updateCurrentGroupName(String groupName) { updateCurrentGroupName(String groupName) {
if (currentProfile != null && if (currentProfile != null &&
currentProfile!.currentGroupName != groupName) { currentProfile!.currentGroupName != groupName) {
@@ -364,6 +384,36 @@ class Config extends ChangeNotifier {
} }
} }
@JsonKey(defaultValue: ProxiesType.tab)
ProxiesType get proxiesType => _proxiesType;
set proxiesType(ProxiesType value) {
if (_proxiesType != value) {
_proxiesType = value;
notifyListeners();
}
}
@JsonKey(defaultValue: ProxyCardType.expand)
ProxyCardType get proxyCardType => _proxyCardType;
set proxyCardType(ProxyCardType value) {
if (_proxyCardType != value) {
_proxyCardType = value;
notifyListeners();
}
}
@JsonKey(defaultValue: 2)
int get proxiesColumns => _proxiesColumns;
set proxiesColumns(int value) {
if (_proxiesColumns != value) {
_proxiesColumns = value;
notifyListeners();
}
}
update([ update([
Config? config, Config? config,
RecoveryOption recoveryOptions = RecoveryOption.all, RecoveryOption recoveryOptions = RecoveryOption.all,
@@ -383,6 +433,7 @@ class Config extends ChangeNotifier {
_autoLaunch = config._autoLaunch; _autoLaunch = config._autoLaunch;
_silentLaunch = config._silentLaunch; _silentLaunch = config._silentLaunch;
_autoRun = config._autoRun; _autoRun = config._autoRun;
_proxiesType = config._proxiesType;
_openLog = config._openLog; _openLog = config._openLog;
_themeMode = config._themeMode; _themeMode = config._themeMode;
_locale = config._locale; _locale = config._locale;

View File

@@ -34,7 +34,14 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config()
..isCompatible = json['isCompatible'] as bool? ?? true ..isCompatible = json['isCompatible'] as bool? ?? true
..autoCheckUpdate = json['autoCheckUpdate'] as bool? ?? true ..autoCheckUpdate = json['autoCheckUpdate'] as bool? ?? true
..allowBypass = json['allowBypass'] as bool? ?? true ..allowBypass = json['allowBypass'] as bool? ?? true
..systemProxy = json['systemProxy'] as bool? ?? true; ..systemProxy = json['systemProxy'] as bool? ?? true
..proxiesType =
$enumDecodeNullable(_$ProxiesTypeEnumMap, json['proxiesType']) ??
ProxiesType.tab
..proxyCardType =
$enumDecodeNullable(_$ProxyCardTypeEnumMap, json['proxyCardType']) ??
ProxyCardType.expand
..proxiesColumns = (json['proxiesColumns'] as num?)?.toInt() ?? 2;
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
'profiles': instance.profiles, 'profiles': instance.profiles,
@@ -56,6 +63,9 @@ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
'autoCheckUpdate': instance.autoCheckUpdate, 'autoCheckUpdate': instance.autoCheckUpdate,
'allowBypass': instance.allowBypass, 'allowBypass': instance.allowBypass,
'systemProxy': instance.systemProxy, 'systemProxy': instance.systemProxy,
'proxiesType': _$ProxiesTypeEnumMap[instance.proxiesType]!,
'proxyCardType': _$ProxyCardTypeEnumMap[instance.proxyCardType]!,
'proxiesColumns': instance.proxiesColumns,
}; };
const _$ThemeModeEnumMap = { const _$ThemeModeEnumMap = {
@@ -70,6 +80,16 @@ const _$ProxiesSortTypeEnumMap = {
ProxiesSortType.name: 'name', ProxiesSortType.name: 'name',
}; };
const _$ProxiesTypeEnumMap = {
ProxiesType.tab: 'tab',
ProxiesType.expansion: 'expansion',
};
const _$ProxyCardTypeEnumMap = {
ProxyCardType.expand: 'expand',
ProxyCardType.shrink: 'shrink',
};
_$AccessControlImpl _$$AccessControlImplFromJson(Map<String, dynamic> json) => _$AccessControlImpl _$$AccessControlImplFromJson(Map<String, dynamic> json) =>
_$AccessControlImpl( _$AccessControlImpl(
mode: $enumDecodeNullable(_$AccessControlModeEnumMap, json['mode']) ?? mode: $enumDecodeNullable(_$AccessControlModeEnumMap, json['mode']) ??

View File

@@ -222,6 +222,7 @@ mixin _$Profile {
UserInfo? get userInfo => throw _privateConstructorUsedError; UserInfo? get userInfo => throw _privateConstructorUsedError;
bool get autoUpdate => throw _privateConstructorUsedError; bool get autoUpdate => throw _privateConstructorUsedError;
Map<String, String> get selectedMap => throw _privateConstructorUsedError; Map<String, String> get selectedMap => throw _privateConstructorUsedError;
Set<String> get unfoldSet => throw _privateConstructorUsedError;
Map<String, dynamic> toJson() => throw _privateConstructorUsedError; Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
@@ -242,7 +243,8 @@ abstract class $ProfileCopyWith<$Res> {
Duration autoUpdateDuration, Duration autoUpdateDuration,
UserInfo? userInfo, UserInfo? userInfo,
bool autoUpdate, bool autoUpdate,
Map<String, String> selectedMap}); Map<String, String> selectedMap,
Set<String> unfoldSet});
$UserInfoCopyWith<$Res>? get userInfo; $UserInfoCopyWith<$Res>? get userInfo;
} }
@@ -269,6 +271,7 @@ class _$ProfileCopyWithImpl<$Res, $Val extends Profile>
Object? userInfo = freezed, Object? userInfo = freezed,
Object? autoUpdate = null, Object? autoUpdate = null,
Object? selectedMap = null, Object? selectedMap = null,
Object? unfoldSet = null,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
id: null == id id: null == id
@@ -307,6 +310,10 @@ class _$ProfileCopyWithImpl<$Res, $Val extends Profile>
? _value.selectedMap ? _value.selectedMap
: selectedMap // ignore: cast_nullable_to_non_nullable : selectedMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>, as Map<String, String>,
unfoldSet: null == unfoldSet
? _value.unfoldSet
: unfoldSet // ignore: cast_nullable_to_non_nullable
as Set<String>,
) as $Val); ) as $Val);
} }
@@ -339,7 +346,8 @@ abstract class _$$ProfileImplCopyWith<$Res> implements $ProfileCopyWith<$Res> {
Duration autoUpdateDuration, Duration autoUpdateDuration,
UserInfo? userInfo, UserInfo? userInfo,
bool autoUpdate, bool autoUpdate,
Map<String, String> selectedMap}); Map<String, String> selectedMap,
Set<String> unfoldSet});
@override @override
$UserInfoCopyWith<$Res>? get userInfo; $UserInfoCopyWith<$Res>? get userInfo;
@@ -365,6 +373,7 @@ class __$$ProfileImplCopyWithImpl<$Res>
Object? userInfo = freezed, Object? userInfo = freezed,
Object? autoUpdate = null, Object? autoUpdate = null,
Object? selectedMap = null, Object? selectedMap = null,
Object? unfoldSet = null,
}) { }) {
return _then(_$ProfileImpl( return _then(_$ProfileImpl(
id: null == id id: null == id
@@ -403,6 +412,10 @@ class __$$ProfileImplCopyWithImpl<$Res>
? _value._selectedMap ? _value._selectedMap
: selectedMap // ignore: cast_nullable_to_non_nullable : selectedMap // ignore: cast_nullable_to_non_nullable
as Map<String, String>, as Map<String, String>,
unfoldSet: null == unfoldSet
? _value._unfoldSet
: unfoldSet // ignore: cast_nullable_to_non_nullable
as Set<String>,
)); ));
} }
} }
@@ -419,8 +432,10 @@ class _$ProfileImpl implements _Profile {
required this.autoUpdateDuration, required this.autoUpdateDuration,
this.userInfo, this.userInfo,
this.autoUpdate = true, this.autoUpdate = true,
final Map<String, String> selectedMap = const {}}) final Map<String, String> selectedMap = const {},
: _selectedMap = selectedMap; final Set<String> unfoldSet = const {}})
: _selectedMap = selectedMap,
_unfoldSet = unfoldSet;
factory _$ProfileImpl.fromJson(Map<String, dynamic> json) => factory _$ProfileImpl.fromJson(Map<String, dynamic> json) =>
_$$ProfileImplFromJson(json); _$$ProfileImplFromJson(json);
@@ -452,9 +467,18 @@ class _$ProfileImpl implements _Profile {
return EqualUnmodifiableMapView(_selectedMap); return EqualUnmodifiableMapView(_selectedMap);
} }
final Set<String> _unfoldSet;
@override
@JsonKey()
Set<String> get unfoldSet {
if (_unfoldSet is EqualUnmodifiableSetView) return _unfoldSet;
// ignore: implicit_dynamic_type
return EqualUnmodifiableSetView(_unfoldSet);
}
@override @override
String toString() { String toString() {
return 'Profile(id: $id, label: $label, currentGroupName: $currentGroupName, url: $url, lastUpdateDate: $lastUpdateDate, autoUpdateDuration: $autoUpdateDuration, userInfo: $userInfo, autoUpdate: $autoUpdate, selectedMap: $selectedMap)'; return 'Profile(id: $id, label: $label, currentGroupName: $currentGroupName, url: $url, lastUpdateDate: $lastUpdateDate, autoUpdateDuration: $autoUpdateDuration, userInfo: $userInfo, autoUpdate: $autoUpdate, selectedMap: $selectedMap, unfoldSet: $unfoldSet)';
} }
@override @override
@@ -476,7 +500,9 @@ class _$ProfileImpl implements _Profile {
(identical(other.autoUpdate, autoUpdate) || (identical(other.autoUpdate, autoUpdate) ||
other.autoUpdate == autoUpdate) && other.autoUpdate == autoUpdate) &&
const DeepCollectionEquality() const DeepCollectionEquality()
.equals(other._selectedMap, _selectedMap)); .equals(other._selectedMap, _selectedMap) &&
const DeepCollectionEquality()
.equals(other._unfoldSet, _unfoldSet));
} }
@JsonKey(ignore: true) @JsonKey(ignore: true)
@@ -491,7 +517,8 @@ class _$ProfileImpl implements _Profile {
autoUpdateDuration, autoUpdateDuration,
userInfo, userInfo,
autoUpdate, autoUpdate,
const DeepCollectionEquality().hash(_selectedMap)); const DeepCollectionEquality().hash(_selectedMap),
const DeepCollectionEquality().hash(_unfoldSet));
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@@ -517,7 +544,8 @@ abstract class _Profile implements Profile {
required final Duration autoUpdateDuration, required final Duration autoUpdateDuration,
final UserInfo? userInfo, final UserInfo? userInfo,
final bool autoUpdate, final bool autoUpdate,
final Map<String, String> selectedMap}) = _$ProfileImpl; final Map<String, String> selectedMap,
final Set<String> unfoldSet}) = _$ProfileImpl;
factory _Profile.fromJson(Map<String, dynamic> json) = _$ProfileImpl.fromJson; factory _Profile.fromJson(Map<String, dynamic> json) = _$ProfileImpl.fromJson;
@@ -540,6 +568,8 @@ abstract class _Profile implements Profile {
@override @override
Map<String, String> get selectedMap; Map<String, String> get selectedMap;
@override @override
Set<String> get unfoldSet;
@override
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$ProfileImplCopyWith<_$ProfileImpl> get copyWith => _$$ProfileImplCopyWith<_$ProfileImpl> get copyWith =>
throw _privateConstructorUsedError; throw _privateConstructorUsedError;

View File

@@ -41,6 +41,10 @@ _$ProfileImpl _$$ProfileImplFromJson(Map<String, dynamic> json) =>
(k, e) => MapEntry(k, e as String), (k, e) => MapEntry(k, e as String),
) ?? ) ??
const {}, const {},
unfoldSet: (json['unfoldSet'] as List<dynamic>?)
?.map((e) => e as String)
.toSet() ??
const {},
); );
Map<String, dynamic> _$$ProfileImplToJson(_$ProfileImpl instance) => Map<String, dynamic> _$$ProfileImplToJson(_$ProfileImpl instance) =>
@@ -54,4 +58,5 @@ Map<String, dynamic> _$$ProfileImplToJson(_$ProfileImpl instance) =>
'userInfo': instance.userInfo, 'userInfo': instance.userInfo,
'autoUpdate': instance.autoUpdate, 'autoUpdate': instance.autoUpdate,
'selectedMap': instance.selectedMap, 'selectedMap': instance.selectedMap,
'unfoldSet': instance.unfoldSet.toList(),
}; };

View File

@@ -1730,39 +1730,37 @@ abstract class _ProxiesSelectorState implements ProxiesSelectorState {
} }
/// @nodoc /// @nodoc
mixin _$ProxiesTabViewSelectorState { mixin _$ProxyGroupSelectorState {
ProxiesSortType get proxiesSortType => throw _privateConstructorUsedError; ProxiesSortType get proxiesSortType => throw _privateConstructorUsedError;
ProxyCardType get proxyCardType => throw _privateConstructorUsedError;
num get sortNum => throw _privateConstructorUsedError; num get sortNum => throw _privateConstructorUsedError;
Group get group => throw _privateConstructorUsedError; List<Proxy> get proxies => throw _privateConstructorUsedError;
ViewMode get viewMode => throw _privateConstructorUsedError; int get columns => throw _privateConstructorUsedError;
@JsonKey(ignore: true) @JsonKey(ignore: true)
$ProxiesTabViewSelectorStateCopyWith<ProxiesTabViewSelectorState> $ProxyGroupSelectorStateCopyWith<ProxyGroupSelectorState> get copyWith =>
get copyWith => throw _privateConstructorUsedError; throw _privateConstructorUsedError;
} }
/// @nodoc /// @nodoc
abstract class $ProxiesTabViewSelectorStateCopyWith<$Res> { abstract class $ProxyGroupSelectorStateCopyWith<$Res> {
factory $ProxiesTabViewSelectorStateCopyWith( factory $ProxyGroupSelectorStateCopyWith(ProxyGroupSelectorState value,
ProxiesTabViewSelectorState value, $Res Function(ProxyGroupSelectorState) then) =
$Res Function(ProxiesTabViewSelectorState) then) = _$ProxyGroupSelectorStateCopyWithImpl<$Res, ProxyGroupSelectorState>;
_$ProxiesTabViewSelectorStateCopyWithImpl<$Res,
ProxiesTabViewSelectorState>;
@useResult @useResult
$Res call( $Res call(
{ProxiesSortType proxiesSortType, {ProxiesSortType proxiesSortType,
ProxyCardType proxyCardType,
num sortNum, num sortNum,
Group group, List<Proxy> proxies,
ViewMode viewMode}); int columns});
$GroupCopyWith<$Res> get group;
} }
/// @nodoc /// @nodoc
class _$ProxiesTabViewSelectorStateCopyWithImpl<$Res, class _$ProxyGroupSelectorStateCopyWithImpl<$Res,
$Val extends ProxiesTabViewSelectorState> $Val extends ProxyGroupSelectorState>
implements $ProxiesTabViewSelectorStateCopyWith<$Res> { implements $ProxyGroupSelectorStateCopyWith<$Res> {
_$ProxiesTabViewSelectorStateCopyWithImpl(this._value, this._then); _$ProxyGroupSelectorStateCopyWithImpl(this._value, this._then);
// ignore: unused_field // ignore: unused_field
final $Val _value; final $Val _value;
@@ -1773,165 +1771,177 @@ class _$ProxiesTabViewSelectorStateCopyWithImpl<$Res,
@override @override
$Res call({ $Res call({
Object? proxiesSortType = null, Object? proxiesSortType = null,
Object? proxyCardType = null,
Object? sortNum = null, Object? sortNum = null,
Object? group = null, Object? proxies = null,
Object? viewMode = null, Object? columns = null,
}) { }) {
return _then(_value.copyWith( return _then(_value.copyWith(
proxiesSortType: null == proxiesSortType proxiesSortType: null == proxiesSortType
? _value.proxiesSortType ? _value.proxiesSortType
: proxiesSortType // ignore: cast_nullable_to_non_nullable : proxiesSortType // ignore: cast_nullable_to_non_nullable
as ProxiesSortType, as ProxiesSortType,
proxyCardType: null == proxyCardType
? _value.proxyCardType
: proxyCardType // ignore: cast_nullable_to_non_nullable
as ProxyCardType,
sortNum: null == sortNum sortNum: null == sortNum
? _value.sortNum ? _value.sortNum
: sortNum // ignore: cast_nullable_to_non_nullable : sortNum // ignore: cast_nullable_to_non_nullable
as num, as num,
group: null == group proxies: null == proxies
? _value.group ? _value.proxies
: group // ignore: cast_nullable_to_non_nullable : proxies // ignore: cast_nullable_to_non_nullable
as Group, as List<Proxy>,
viewMode: null == viewMode columns: null == columns
? _value.viewMode ? _value.columns
: viewMode // ignore: cast_nullable_to_non_nullable : columns // ignore: cast_nullable_to_non_nullable
as ViewMode, as int,
) as $Val); ) as $Val);
} }
@override
@pragma('vm:prefer-inline')
$GroupCopyWith<$Res> get group {
return $GroupCopyWith<$Res>(_value.group, (value) {
return _then(_value.copyWith(group: value) as $Val);
});
}
} }
/// @nodoc /// @nodoc
abstract class _$$ProxiesTabViewSelectorStateImplCopyWith<$Res> abstract class _$$ProxyGroupSelectorStateImplCopyWith<$Res>
implements $ProxiesTabViewSelectorStateCopyWith<$Res> { implements $ProxyGroupSelectorStateCopyWith<$Res> {
factory _$$ProxiesTabViewSelectorStateImplCopyWith( factory _$$ProxyGroupSelectorStateImplCopyWith(
_$ProxiesTabViewSelectorStateImpl value, _$ProxyGroupSelectorStateImpl value,
$Res Function(_$ProxiesTabViewSelectorStateImpl) then) = $Res Function(_$ProxyGroupSelectorStateImpl) then) =
__$$ProxiesTabViewSelectorStateImplCopyWithImpl<$Res>; __$$ProxyGroupSelectorStateImplCopyWithImpl<$Res>;
@override @override
@useResult @useResult
$Res call( $Res call(
{ProxiesSortType proxiesSortType, {ProxiesSortType proxiesSortType,
ProxyCardType proxyCardType,
num sortNum, num sortNum,
Group group, List<Proxy> proxies,
ViewMode viewMode}); int columns});
@override
$GroupCopyWith<$Res> get group;
} }
/// @nodoc /// @nodoc
class __$$ProxiesTabViewSelectorStateImplCopyWithImpl<$Res> class __$$ProxyGroupSelectorStateImplCopyWithImpl<$Res>
extends _$ProxiesTabViewSelectorStateCopyWithImpl<$Res, extends _$ProxyGroupSelectorStateCopyWithImpl<$Res,
_$ProxiesTabViewSelectorStateImpl> _$ProxyGroupSelectorStateImpl>
implements _$$ProxiesTabViewSelectorStateImplCopyWith<$Res> { implements _$$ProxyGroupSelectorStateImplCopyWith<$Res> {
__$$ProxiesTabViewSelectorStateImplCopyWithImpl( __$$ProxyGroupSelectorStateImplCopyWithImpl(
_$ProxiesTabViewSelectorStateImpl _value, _$ProxyGroupSelectorStateImpl _value,
$Res Function(_$ProxiesTabViewSelectorStateImpl) _then) $Res Function(_$ProxyGroupSelectorStateImpl) _then)
: super(_value, _then); : super(_value, _then);
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
@override @override
$Res call({ $Res call({
Object? proxiesSortType = null, Object? proxiesSortType = null,
Object? proxyCardType = null,
Object? sortNum = null, Object? sortNum = null,
Object? group = null, Object? proxies = null,
Object? viewMode = null, Object? columns = null,
}) { }) {
return _then(_$ProxiesTabViewSelectorStateImpl( return _then(_$ProxyGroupSelectorStateImpl(
proxiesSortType: null == proxiesSortType proxiesSortType: null == proxiesSortType
? _value.proxiesSortType ? _value.proxiesSortType
: proxiesSortType // ignore: cast_nullable_to_non_nullable : proxiesSortType // ignore: cast_nullable_to_non_nullable
as ProxiesSortType, as ProxiesSortType,
proxyCardType: null == proxyCardType
? _value.proxyCardType
: proxyCardType // ignore: cast_nullable_to_non_nullable
as ProxyCardType,
sortNum: null == sortNum sortNum: null == sortNum
? _value.sortNum ? _value.sortNum
: sortNum // ignore: cast_nullable_to_non_nullable : sortNum // ignore: cast_nullable_to_non_nullable
as num, as num,
group: null == group proxies: null == proxies
? _value.group ? _value._proxies
: group // ignore: cast_nullable_to_non_nullable : proxies // ignore: cast_nullable_to_non_nullable
as Group, as List<Proxy>,
viewMode: null == viewMode columns: null == columns
? _value.viewMode ? _value.columns
: viewMode // ignore: cast_nullable_to_non_nullable : columns // ignore: cast_nullable_to_non_nullable
as ViewMode, as int,
)); ));
} }
} }
/// @nodoc /// @nodoc
class _$ProxiesTabViewSelectorStateImpl class _$ProxyGroupSelectorStateImpl implements _ProxyGroupSelectorState {
implements _ProxiesTabViewSelectorState { const _$ProxyGroupSelectorStateImpl(
const _$ProxiesTabViewSelectorStateImpl(
{required this.proxiesSortType, {required this.proxiesSortType,
required this.proxyCardType,
required this.sortNum, required this.sortNum,
required this.group, required final List<Proxy> proxies,
required this.viewMode}); required this.columns})
: _proxies = proxies;
@override @override
final ProxiesSortType proxiesSortType; final ProxiesSortType proxiesSortType;
@override @override
final ProxyCardType proxyCardType;
@override
final num sortNum; final num sortNum;
final List<Proxy> _proxies;
@override @override
final Group group; List<Proxy> get proxies {
if (_proxies is EqualUnmodifiableListView) return _proxies;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_proxies);
}
@override @override
final ViewMode viewMode; final int columns;
@override @override
String toString() { String toString() {
return 'ProxiesTabViewSelectorState(proxiesSortType: $proxiesSortType, sortNum: $sortNum, group: $group, viewMode: $viewMode)'; return 'ProxyGroupSelectorState(proxiesSortType: $proxiesSortType, proxyCardType: $proxyCardType, sortNum: $sortNum, proxies: $proxies, columns: $columns)';
} }
@override @override
bool operator ==(Object other) { bool operator ==(Object other) {
return identical(this, other) || return identical(this, other) ||
(other.runtimeType == runtimeType && (other.runtimeType == runtimeType &&
other is _$ProxiesTabViewSelectorStateImpl && other is _$ProxyGroupSelectorStateImpl &&
(identical(other.proxiesSortType, proxiesSortType) || (identical(other.proxiesSortType, proxiesSortType) ||
other.proxiesSortType == proxiesSortType) && other.proxiesSortType == proxiesSortType) &&
(identical(other.proxyCardType, proxyCardType) ||
other.proxyCardType == proxyCardType) &&
(identical(other.sortNum, sortNum) || other.sortNum == sortNum) && (identical(other.sortNum, sortNum) || other.sortNum == sortNum) &&
(identical(other.group, group) || other.group == group) && const DeepCollectionEquality().equals(other._proxies, _proxies) &&
(identical(other.viewMode, viewMode) || (identical(other.columns, columns) || other.columns == columns));
other.viewMode == viewMode));
} }
@override @override
int get hashCode => int get hashCode => Object.hash(runtimeType, proxiesSortType, proxyCardType,
Object.hash(runtimeType, proxiesSortType, sortNum, group, viewMode); sortNum, const DeepCollectionEquality().hash(_proxies), columns);
@JsonKey(ignore: true) @JsonKey(ignore: true)
@override @override
@pragma('vm:prefer-inline') @pragma('vm:prefer-inline')
_$$ProxiesTabViewSelectorStateImplCopyWith<_$ProxiesTabViewSelectorStateImpl> _$$ProxyGroupSelectorStateImplCopyWith<_$ProxyGroupSelectorStateImpl>
get copyWith => __$$ProxiesTabViewSelectorStateImplCopyWithImpl< get copyWith => __$$ProxyGroupSelectorStateImplCopyWithImpl<
_$ProxiesTabViewSelectorStateImpl>(this, _$identity); _$ProxyGroupSelectorStateImpl>(this, _$identity);
} }
abstract class _ProxiesTabViewSelectorState abstract class _ProxyGroupSelectorState implements ProxyGroupSelectorState {
implements ProxiesTabViewSelectorState { const factory _ProxyGroupSelectorState(
const factory _ProxiesTabViewSelectorState(
{required final ProxiesSortType proxiesSortType, {required final ProxiesSortType proxiesSortType,
required final ProxyCardType proxyCardType,
required final num sortNum, required final num sortNum,
required final Group group, required final List<Proxy> proxies,
required final ViewMode viewMode}) = _$ProxiesTabViewSelectorStateImpl; required final int columns}) = _$ProxyGroupSelectorStateImpl;
@override @override
ProxiesSortType get proxiesSortType; ProxiesSortType get proxiesSortType;
@override @override
ProxyCardType get proxyCardType;
@override
num get sortNum; num get sortNum;
@override @override
Group get group; List<Proxy> get proxies;
@override @override
ViewMode get viewMode; int get columns;
@override @override
@JsonKey(ignore: true) @JsonKey(ignore: true)
_$$ProxiesTabViewSelectorStateImplCopyWith<_$ProxiesTabViewSelectorStateImpl> _$$ProxyGroupSelectorStateImplCopyWith<_$ProxyGroupSelectorStateImpl>
get copyWith => throw _privateConstructorUsedError; get copyWith => throw _privateConstructorUsedError;
} }

View File

@@ -54,6 +54,7 @@ class Profile with _$Profile {
UserInfo? userInfo, UserInfo? userInfo,
@Default(true) bool autoUpdate, @Default(true) bool autoUpdate,
@Default({}) SelectedMap selectedMap, @Default({}) SelectedMap selectedMap,
@Default({}) Set<String> unfoldSet,
}) = _Profile; }) = _Profile;
factory Profile.fromJson(Map<String, Object?> json) => factory Profile.fromJson(Map<String, Object?> json) =>

View File

@@ -99,13 +99,14 @@ class ProxiesSelectorState with _$ProxiesSelectorState {
} }
@freezed @freezed
class ProxiesTabViewSelectorState with _$ProxiesTabViewSelectorState { class ProxyGroupSelectorState with _$ProxyGroupSelectorState {
const factory ProxiesTabViewSelectorState({ const factory ProxyGroupSelectorState({
required ProxiesSortType proxiesSortType, required ProxiesSortType proxiesSortType,
required ProxyCardType proxyCardType,
required num sortNum, required num sortNum,
required Group group, required List<Proxy> proxies,
required ViewMode viewMode, required int columns,
}) = _ProxiesTabViewSelectorState; }) = _ProxyGroupSelectorState;
} }
@freezed @freezed

View File

@@ -4,6 +4,7 @@ import 'dart:io';
import 'package:animations/animations.dart'; import 'package:animations/animations.dart';
import 'package:fl_clash/clash/clash.dart'; import 'package:fl_clash/clash/clash.dart';
import 'package:fl_clash/enum/enum.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';
@@ -261,6 +262,18 @@ class GlobalState {
return null; return null;
} }
} }
int getColumns(ViewMode viewMode,int currentColumns){
final targetColumnsArray = switch (viewMode) {
ViewMode.mobile => [2, 1],
ViewMode.laptop => [3, 2],
ViewMode.desktop => [4, 3],
};
if (targetColumnsArray.contains(currentColumns)) {
return currentColumns;
}
return targetColumnsArray.first;
}
} }
final globalState = GlobalState(); final globalState = GlobalState();

View File

@@ -1,4 +1,5 @@
import 'package:fl_clash/common/common.dart'; import 'package:fl_clash/common/common.dart';
import 'package:fl_clash/enum/enum.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'text.dart'; import 'text.dart';
@@ -54,6 +55,7 @@ class CommonCard extends StatelessWidget {
const CommonCard({ const CommonCard({
super.key, super.key,
bool? isSelected, bool? isSelected,
this.type = CommonCardType.plain,
this.onPressed, this.onPressed,
this.info, this.info,
this.selectWidget, this.selectWidget,
@@ -65,10 +67,14 @@ class CommonCard extends StatelessWidget {
final Widget? selectWidget; final Widget? selectWidget;
final Widget child; final Widget child;
final Info? info; final Info? info;
final CommonCardType type;
BorderSide getBorderSide(BuildContext context, Set<WidgetState> states) { BorderSide getBorderSide(BuildContext context, Set<WidgetState> states) {
if(type == CommonCardType.filled){
return BorderSide.none;
}
final colorScheme = Theme.of(context).colorScheme; final colorScheme = Theme.of(context).colorScheme;
var hoverColor = isSelected final hoverColor = isSelected
? colorScheme.primary.toLight() ? colorScheme.primary.toLight()
: colorScheme.primary.toLighter(); : colorScheme.primary.toLighter();
if (states.contains(WidgetState.hovered) || if (states.contains(WidgetState.hovered) ||
@@ -86,17 +92,28 @@ class CommonCard extends StatelessWidget {
Color? getBackgroundColor(BuildContext context, Set<WidgetState> states) { Color? getBackgroundColor(BuildContext context, Set<WidgetState> states) {
final colorScheme = Theme.of(context).colorScheme; final colorScheme = Theme.of(context).colorScheme;
if (isSelected) { switch(type){
return colorScheme.secondaryContainer; case CommonCardType.plain:
if (isSelected) {
return colorScheme.secondaryContainer;
}
if (states.isEmpty) {
return colorScheme.secondaryContainer.toLittle();
}
return Theme.of(context)
.outlinedButtonTheme
.style
?.backgroundColor
?.resolve(states);
case CommonCardType.filled:
if (isSelected) {
return colorScheme.secondaryContainer;
}
if (states.isEmpty) {
return colorScheme.surfaceContainerLow;
}
return colorScheme.surfaceContainer;
} }
if (states.isEmpty) {
return colorScheme.secondaryContainer.toLittle();
}
return Theme.of(context)
.outlinedButtonTheme
.style
?.backgroundColor
?.resolve(states);
} }
@override @override
@@ -136,11 +153,7 @@ class CommonCard extends StatelessWidget {
(states) => getBorderSide(context, states), (states) => getBorderSide(context, states),
), ),
), ),
onPressed: () { onPressed: onPressed,
if (onPressed != null) {
onPressed!();
}
},
child: Builder( child: Builder(
builder: (_) { builder: (_) {
List<Widget> children = []; List<Widget> children = [];

View File

@@ -17,12 +17,17 @@ class CommonChip extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if(type == ChipType.delete){ if (type == ChipType.delete) {
return Chip( return Chip(
avatar: avatar, avatar: avatar,
padding: const EdgeInsets.symmetric(
vertical: 0,
horizontal: 4,
),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onDeleted: onPressed ?? () {}, onDeleted: onPressed ?? () {},
side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.2)), side:
BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.2)),
labelStyle: Theme.of(context).textTheme.bodyMedium, labelStyle: Theme.of(context).textTheme.bodyMedium,
label: Text(label), label: Text(label),
); );
@@ -30,6 +35,10 @@ class CommonChip extends StatelessWidget {
return ActionChip( return ActionChip(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
avatar: avatar, avatar: avatar,
padding: const EdgeInsets.symmetric(
vertical: 0,
horizontal: 4,
),
onPressed: onPressed ?? () {}, onPressed: onPressed ?? () {},
side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.2)), side: BorderSide(color: Theme.of(context).dividerColor.withOpacity(0.2)),
labelStyle: Theme.of(context).textTheme.bodyMedium, labelStyle: Theme.of(context).textTheme.bodyMedium,

View File

@@ -11,7 +11,7 @@ class NullStatus extends StatelessWidget {
return Center( return Center(
child: Text( child: Text(
label, label,
style: Theme.of(context).textTheme.titleMedium?.toBold(), style: Theme.of(context).textTheme.titleMedium?.toBold,
), ),
); );
} }

View File

@@ -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.26 version: 0.8.32
environment: environment:
sdk: '>=3.1.0 <4.0.0' sdk: '>=3.1.0 <4.0.0'