Skip to content

Commit

Permalink
多项更改
Browse files Browse the repository at this point in the history
- 初始界面改为 Visibility
- 登录后面板添加一个状态标志避免重复请求
- 将自定义颜色种子改为 Material 颜色选取
  • Loading branch information
Muska-Ami committed Nov 27, 2024
1 parent 7b0d68d commit 65239c7
Show file tree
Hide file tree
Showing 26 changed files with 329 additions and 228 deletions.
4 changes: 2 additions & 2 deletions nyalcf_cli/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ packages:
path: "../nyalcf_core"
relative: true
source: path
version: "1.2.4"
version: "1.2.5"
nyalcf_env:
dependency: "direct main"
description:
Expand All @@ -266,7 +266,7 @@ packages:
path: "../nyalcf_inject"
relative: true
source: path
version: "1.2.4"
version: "1.2.5"
package_config:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf_core
description: 'Nya LoCyanFrp! core module.'
version: 1.2.4
version: 1.2.5
homepage: https://nyalcf.1l1.icu
publish_to: none
# repository: https://github.com/my_org/my_repo
Expand Down
3 changes: 2 additions & 1 deletion nyalcf_gui/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@ class _AppState extends State<App> with WindowListener {
return DynamicColorBuilder(builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
final lcs = LauncherConfigurationStorage();

// 定义初始主题数据
ThemeData lightThemeData = ThemeControl.getLightTheme();
ThemeData darkThemeData = ThemeControl.getDarkTheme();

// 非自动下切换深色主题逻辑
if (lcs.getThemeAuto() != true && lcs.getThemeDarkEnable()) Get.changeThemeMode(ThemeMode.dark);

// Monet 取色
if (lcs.getThemeAuto() == true && lcs.getThemeMonet() == true) {
if (lcs.getThemeMonet() == true) {
if (lightDynamic != null && darkDynamic != null) {
// 亮色模式 Monet 取色
lightThemeData = ThemeData(
Expand Down
15 changes: 15 additions & 0 deletions nyalcf_gui/nyalcf_core_extend/lib/utils/color_utils.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Flutter imports:
import 'package:flutter/material.dart';

class ColorUtils {
/// 将 Color 转为 HexCode
static String colorToHex(Color color) => color.value.toRadixString(16).padLeft(8, '0').toUpperCase();

/// 将 HexCode 转为 Color
static Color hexToColor(String hexString) {
final buffer = StringBuffer();
if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
buffer.write(hexString.replaceFirst('#', ''));
return Color(int.parse(buffer.toString(), radix: 16));
}
}
16 changes: 12 additions & 4 deletions nyalcf_gui/nyalcf_core_extend/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.2"
flutter_colorpicker:
dependency: transitive
description:
name: flutter_colorpicker
sha256: "969de5f6f9e2a570ac660fb7b501551451ea2a1ab9e2097e89475f60e07816ea"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
flutter_highlight:
dependency: transitive
description:
Expand Down Expand Up @@ -406,7 +414,7 @@ packages:
path: "../../nyalcf_core"
relative: true
source: path
version: "1.2.4"
version: "1.2.5"
nyalcf_env:
dependency: "direct main"
description:
Expand All @@ -420,21 +428,21 @@ packages:
path: "../../nyalcf_inject"
relative: true
source: path
version: "1.2.4"
version: "1.2.5"
nyalcf_inject_extend:
dependency: "direct main"
description:
path: "../nyalcf_inject_extend"
relative: true
source: path
version: "1.2.4"
version: "1.2.5"
nyalcf_ui:
dependency: "direct main"
description:
path: "../nyalcf_ui"
relative: true
source: path
version: "1.2.1"
version: "1.2.2"
open_filex:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_core_extend/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf_core_extend
description: "Nya LoCyanFrp! core extend module."
version: 1.2.4
version: 1.2.5
homepage: https://nyalcf.1l1.icu
publish_to: none

Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_inject_extend/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: nyalcf_inject_extend
description: "Nya LoCyanFrp! communication injector extend module."
version: 1.2.4
version: 1.2.5
homepage: https://nyalcf.1l1.icu
publish_to: none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class HomePanelController extends GetxController {
var announcement = '喵喵喵?正在请求捏'.obs;

/// 加载控制器
load() async {
load({bool force = false}) async {
if (loaded && !force) return;
final notice = await OtherAnnouncement.getNotice();
if (notice.status) {
notice as NoticeResponse;
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_ui/lib/models/account_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Widget accountDialog(BuildContext context) {
const url = 'https://cravatar.cn';
if (!await launchUrl(Uri.parse(url))) {
const snackBar = SnackBar(
content: Text('无法打开网页,请检查设备是否存在WebView'),
content: Text('无法打开网页,请检查设备是否存在 WebView'),
);
if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar(snackBar);
Expand Down
36 changes: 36 additions & 0 deletions nyalcf_gui/nyalcf_ui/lib/models/color_pick_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Flutter imports:
import 'package:flutter/material.dart';

// Package imports:
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'package:get/get.dart';

Widget colorPickDialog(
BuildContext context, {
required Color pickerColor,
Function(Color)? onPrimaryChanged,
required Function(Color) onColorChanged,
}) {
return AlertDialog(
title: const Text('选取一个颜色'),
content: SizedBox(
width: 400.0,
child: Container(
margin: EdgeInsets.only(left: 25, right: 20),
child: MaterialPicker(
pickerColor: pickerColor,
portraitOnly: true,
enableLabel: true,
onPrimaryChanged: onPrimaryChanged,
onColorChanged: onColorChanged,
),
),
),
actions: [
ElevatedButton(
onPressed: () => Get.close(0),
child: Text('完成'),
),
],
);
}
6 changes: 3 additions & 3 deletions nyalcf_gui/nyalcf_ui/lib/models/process_list_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ final ConsoleController _cCtr = Get.find();

Widget processListDialog(BuildContext context) {
return SimpleDialog(
title: const Text('Frpc进程列表'),
title: const Text('Frpc 进程列表'),
children: <Widget>[
Obx(
() => DataTable(
columns: const <DataColumn>[
DataColumn(label: Text('进程PID')),
DataColumn(label: Text('隧道ID')),
DataColumn(label: Text('进程 PID')),
DataColumn(label: Text('隧道 ID')),
DataColumn(label: Text('操作')),
],
// ignore: invalid_use_of_protected_member
Expand Down
8 changes: 4 additions & 4 deletions nyalcf_gui/nyalcf_ui/lib/models/tool_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Widget toolDialog() {
if (!await launchUrl(Uri.parse(url))) {
Get.snackbar(
'发生错误',
'无法打开网页,请检查设备是否存在WebView',
'无法打开网页,请检查设备是否存在 WebView',
snackPosition: SnackPosition.BOTTOM,
animationDuration: const Duration(milliseconds: 300),
);
Expand All @@ -29,7 +29,7 @@ Widget toolDialog() {
if (!await launchUrl(Uri.parse(url))) {
Get.snackbar(
'发生错误',
'无法打开网页,请检查设备是否存在WebView',
'无法打开网页,请检查设备是否存在 WebView',
snackPosition: SnackPosition.BOTTOM,
animationDuration: const Duration(milliseconds: 300),
);
Expand All @@ -42,7 +42,7 @@ Widget toolDialog() {
if (!await launchUrl(Uri.parse(url))) {
Get.snackbar(
'发生错误',
'无法打开网页,请检查设备是否存在WebView',
'无法打开网页,请检查设备是否存在 WebView',
snackPosition: SnackPosition.BOTTOM,
animationDuration: const Duration(milliseconds: 300),
);
Expand All @@ -55,7 +55,7 @@ Widget toolDialog() {
if (!await launchUrl(Uri.parse(url))) {
Get.snackbar(
'发生错误',
'无法打开网页,请检查设备是否存在WebView',
'无法打开网页,请检查设备是否存在 WebView',
snackPosition: SnackPosition.BOTTOM,
animationDuration: const Duration(milliseconds: 300),
);
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_ui/lib/views/auth/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class _LoginState extends State<Login> {
constraints: const BoxConstraints(maxWidth: 400.0),
child: Column(children: <Widget>[
const Text(
'登录到LoCyanFrp',
'登录到 LoCyanFrp',
style: TextStyle(fontSize: 30),
),
Form(
Expand Down
2 changes: 1 addition & 1 deletion nyalcf_gui/nyalcf_ui/lib/views/auth/register.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class _RegisterState extends State<Register> {
child: Column(
children: <Widget>[
const Text(
'注册LoCyanFrp账户',
'注册 LoCyanFrp 账户',
style: TextStyle(fontSize: 30),
),
Form(
Expand Down
6 changes: 3 additions & 3 deletions nyalcf_gui/nyalcf_ui/lib/views/auth/tokenmode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class _TokenModeAuthState extends State {
child: Column(
children: <Widget>[
const Text(
'请输入Frp Token',
'请输入 Frp Token',
style: TextStyle(fontSize: 30),
),
Form(
Expand Down Expand Up @@ -71,7 +71,7 @@ class _TokenModeAuthState extends State {
} else {
Get.snackbar(
'无效数据',
'请输入Frp Token',
'请输入 Frp Token',
snackPosition: SnackPosition.BOTTOM,
animationDuration:
const Duration(milliseconds: 300),
Expand All @@ -82,7 +82,7 @@ class _TokenModeAuthState extends State {
),
),
const Text(
'使用前请确认Frp Token正确喵,猫猫是不会帮你校验Frp Token有效性哒!',
'使用前请确认 Frp Token 正确喵,猫猫是不会帮你校验Frp Token有效性哒!',
style: TextStyle(color: Colors.red),
),
],
Expand Down
Loading

0 comments on commit 65239c7

Please sign in to comment.