Update core version
Update flutter version Optimize ip check Optimize url-test
This commit is contained in:
@@ -29,4 +29,5 @@ export 'scroll.dart';
|
||||
export 'icons.dart';
|
||||
export 'http.dart';
|
||||
export 'keyboard.dart';
|
||||
export 'network.dart';
|
||||
export 'network.dart';
|
||||
export 'font.dart';
|
||||
3
lib/common/font.dart
Normal file
3
lib/common/font.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
class Fonts{
|
||||
static String get twEmoji => "Twemoji";
|
||||
}
|
||||
@@ -8,7 +8,8 @@ class Measure {
|
||||
|
||||
Measure.of(this.context)
|
||||
: _textScale = TextScaler.linear(
|
||||
WidgetsBinding.instance.platformDispatcher.textScaleFactor);
|
||||
WidgetsBinding.instance.platformDispatcher.textScaleFactor,
|
||||
);
|
||||
|
||||
Size computeTextSize(Text text) {
|
||||
final textPainter = TextPainter(
|
||||
@@ -38,7 +39,6 @@ class Measure {
|
||||
return _bodyMediumHeight!;
|
||||
}
|
||||
|
||||
|
||||
Size get bodyLargeSize {
|
||||
_bodyLargeSize ??= computeTextSize(
|
||||
Text(
|
||||
|
||||
@@ -104,14 +104,17 @@ class Other {
|
||||
required bool isStart,
|
||||
required Brightness brightness,
|
||||
}) {
|
||||
final suffix = Platform.isWindows ? "ico" : "png";
|
||||
if (!isStart && Platform.isWindows) {
|
||||
return switch (brightness) {
|
||||
Brightness.dark => "assets/images/icon_white.$suffix",
|
||||
Brightness.light => "assets/images/icon_black.$suffix",
|
||||
};
|
||||
if(Platform.isMacOS){
|
||||
return "assets/images/icon_white.png";
|
||||
}
|
||||
return "assets/images/icon.$suffix";
|
||||
final suffix = Platform.isWindows ? "ico" : "png";
|
||||
if (isStart && Platform.isWindows) {
|
||||
return "assets/images/icon.$suffix";
|
||||
}
|
||||
return switch (brightness) {
|
||||
Brightness.dark => "assets/images/icon_white.$suffix",
|
||||
Brightness.light => "assets/images/icon_black.$suffix",
|
||||
};
|
||||
}
|
||||
|
||||
int compareVersions(String version1, String version2) {
|
||||
@@ -193,7 +196,7 @@ class Other {
|
||||
|
||||
List<String> parseReleaseBody(String? body) {
|
||||
if (body == null) return [];
|
||||
const pattern = r'- (.+?)\. \[.+?\]';
|
||||
const pattern = r'- \s*(.*)';
|
||||
final regex = RegExp(pattern);
|
||||
return regex
|
||||
.allMatches(body)
|
||||
|
||||
@@ -610,14 +610,18 @@ class AppController {
|
||||
Future _updateSystemTray({
|
||||
required bool isStart,
|
||||
required Brightness? brightness,
|
||||
bool force = false,
|
||||
}) async {
|
||||
await trayManager.destroy();
|
||||
if (Platform.isLinux || force) {
|
||||
await trayManager.destroy();
|
||||
}
|
||||
await trayManager.setIcon(
|
||||
other.getTrayIconPath(
|
||||
isStart: isStart,
|
||||
brightness: brightness ??
|
||||
WidgetsBinding.instance.platformDispatcher.platformBrightness,
|
||||
),
|
||||
isTemplate: true,
|
||||
);
|
||||
if (!Platform.isLinux) {
|
||||
await trayManager.setToolTip(
|
||||
@@ -626,11 +630,12 @@ class AppController {
|
||||
}
|
||||
}
|
||||
|
||||
updateTray() async {
|
||||
updateTray([bool focus = false]) async {
|
||||
if (!Platform.isLinux) {
|
||||
await _updateSystemTray(
|
||||
isStart: appFlowingState.isStart,
|
||||
brightness: appState.brightness,
|
||||
force: focus,
|
||||
);
|
||||
}
|
||||
List<MenuItem> menuItems = [];
|
||||
@@ -642,8 +647,9 @@ class AppController {
|
||||
);
|
||||
menuItems.add(showMenuItem);
|
||||
final startMenuItem = MenuItem.checkbox(
|
||||
label:
|
||||
appFlowingState.isStart ? appLocalizations.stop : appLocalizations.start,
|
||||
label: appFlowingState.isStart
|
||||
? appLocalizations.stop
|
||||
: appLocalizations.start,
|
||||
onClick: (_) async {
|
||||
globalState.appController.updateStart();
|
||||
},
|
||||
@@ -714,6 +720,7 @@ class AppController {
|
||||
await _updateSystemTray(
|
||||
isStart: appFlowingState.isStart,
|
||||
brightness: appState.brightness,
|
||||
force: focus,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ class _NetworkDetectionState extends State<NetworkDetection> {
|
||||
.textTheme
|
||||
.titleLarge
|
||||
?.copyWith(
|
||||
fontFamily: "Twemoji",
|
||||
fontFamily: Fonts.twEmoji,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -142,7 +142,6 @@ class _ClashContainerState extends State<ClashManager> with AppMessageListener {
|
||||
if (log.logLevel == LogLevel.error) {
|
||||
globalState.appController.showSnackBar(log.payload ?? '');
|
||||
}
|
||||
// debugPrint("$log");
|
||||
super.onLog(log);
|
||||
}
|
||||
|
||||
@@ -159,14 +158,14 @@ class _ClashContainerState extends State<ClashManager> with AppMessageListener {
|
||||
}
|
||||
|
||||
@override
|
||||
void onLoaded(String providerName) {
|
||||
Future<void> onLoaded(String providerName) async {
|
||||
final appController = globalState.appController;
|
||||
appController.appState.setProvider(
|
||||
clashCore.getExternalProvider(
|
||||
providerName,
|
||||
),
|
||||
);
|
||||
// appController.addCheckIpNumDebounce();
|
||||
await appController.updateGroupDebounce();
|
||||
super.onLoaded(providerName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class _WindowContainerState extends State<WindowManager> with WindowListener, Wi
|
||||
|
||||
@override
|
||||
void onTaskbarCreated() {
|
||||
globalState.appController.updateTray();
|
||||
globalState.appController.updateTray(true);
|
||||
super.onTaskbarCreated();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:fl_clash/common/common.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:emoji_regex/emoji_regex.dart';
|
||||
|
||||
@@ -62,7 +63,7 @@ class EmojiText extends StatelessWidget {
|
||||
TextSpan(
|
||||
text:match.group(0),
|
||||
style: style?.copyWith(
|
||||
fontFamily: "Twemoji",
|
||||
fontFamily: Fonts.twEmoji,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user