mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 05:23:44 +08:00
feat:riverpod 迁移 AboutUI
This commit is contained in:
parent
46e5dcf01b
commit
07ae0d1636
177
lib/ui/about/about_ui.dart
Normal file
177
lib/ui/about/about_ui.dart
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:starcitizen_doctor/app.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/utils/base_utils.dart';
|
||||||
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
|
class AboutUI extends HookConsumerWidget {
|
||||||
|
const AboutUI({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final isTipTextCn = useState(false);
|
||||||
|
|
||||||
|
return Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Spacer(),
|
||||||
|
const SizedBox(height: 64),
|
||||||
|
Image.asset("assets/app_logo.png", width: 128, height: 128),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
const Text(
|
||||||
|
"SC汉化盒子 V${ConstConf.appVersion} ${ConstConf.isMSE ? "" : " +Dev"}",
|
||||||
|
style: TextStyle(fontSize: 18)),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Button(
|
||||||
|
onPressed: () => _onCheckUpdate(context, ref),
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(4),
|
||||||
|
child: Text("检查更新"),
|
||||||
|
)),
|
||||||
|
const SizedBox(height: 32),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: FluentTheme.of(context).cardColor,
|
||||||
|
borderRadius: BorderRadius.circular(12)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
child: Text(
|
||||||
|
"不仅仅是汉化!\n\nSC汉化盒子是你探索宇宙的好帮手,我们致力于为各位公民解决游戏中的常见问题,并为社区汉化、性能调优、常用网站汉化 等操作提供便利。",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14, color: Colors.white.withOpacity(.9)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(FontAwesomeIcons.link),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
"在线反馈",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14, color: Colors.white.withOpacity(.6)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(URLConf.feedbackUrl);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 24),
|
||||||
|
IconButton(
|
||||||
|
icon: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(FontAwesomeIcons.qq),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
"QQ群: 940696487",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14, color: Colors.white.withOpacity(.6)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://qm.qq.com/cgi-bin/qm/qr?k=TdyR3QU-x77OeD0NQ5w--F0uiNxPq-Tn&jump_from=webapi&authKey=m8s5GhF/7bRCvm5vI4aNl7RQEx5KOViwkzzIl54K+u9w2hzFpr9N/3avG4W/HaVS");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 24),
|
||||||
|
IconButton(
|
||||||
|
icon: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(FontAwesomeIcons.envelope),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
"邮箱: scbox@xkeyc.com",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14, color: Colors.white.withOpacity(.6)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString("mailto:scbox@xkeyc.com");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 24),
|
||||||
|
IconButton(
|
||||||
|
icon: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(FontAwesomeIcons.github),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
"开源",
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14, color: Colors.white.withOpacity(.6)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString("https://github.com/StarCitizenToolBox/app");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
const Spacer(),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const Spacer(),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * .35,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: FluentTheme.of(context).cardColor.withOpacity(.03),
|
||||||
|
borderRadius: BorderRadius.circular(12)),
|
||||||
|
child: IconButton(
|
||||||
|
icon: Padding(
|
||||||
|
padding: const EdgeInsets.all(3),
|
||||||
|
child: Text(
|
||||||
|
isTipTextCn.value ? tipTextCN : tipTextEN,
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12, color: Colors.white.withOpacity(.9)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
isTipTextCn.value = !isTipTextCn.value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const tipTextEN =
|
||||||
|
"This is an unofficial Star Citizen fan-made tools, not affiliated with the Cloud Imperium group of companies. All content on this Software not authored by its host or users are property of their respective owners. \nStar Citizen®, Roberts Space Industries® and Cloud Imperium® are registered trademarks of Cloud Imperium Rights LLC.";
|
||||||
|
|
||||||
|
static const tipTextCN =
|
||||||
|
"这是一个非官方的星际公民工具,不隶属于 Cloud Imperium 公司集团。 本软件中非由其主机或用户创作的所有内容均为其各自所有者的财产。 \nStar Citizen®、Roberts Space Industries® 和 Cloud Imperium® 是 Cloud Imperium Rights LLC 的注册商标。";
|
||||||
|
|
||||||
|
_onCheckUpdate(BuildContext context, WidgetRef ref) async {
|
||||||
|
if (ConstConf.isMSE) {
|
||||||
|
launchUrlString("ms-windows-store://pdp/?productid=9NF3SWFWNKL1");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
final hasUpdate =
|
||||||
|
await ref.read(appGlobalModelProvider.notifier).checkUpdate(context);
|
||||||
|
if (!hasUpdate) {
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showToast(context, "已经是最新版本!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,15 +4,16 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
||||||
import 'package:starcitizen_doctor/provider/aria2c.dart';
|
import 'package:starcitizen_doctor/provider/aria2c.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/home_ui.dart';
|
|
||||||
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
|
||||||
import 'package:starcitizen_doctor/ui/party_room/party_room_ui.dart';
|
import 'package:starcitizen_doctor/ui/party_room/party_room_ui.dart';
|
||||||
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
||||||
import 'package:starcitizen_doctor/ui/tools/tools_ui.dart';
|
|
||||||
import 'package:starcitizen_doctor/widgets/widgets.dart';
|
import 'package:starcitizen_doctor/widgets/widgets.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
|
import 'about/about_ui.dart';
|
||||||
|
import 'home/home_ui.dart';
|
||||||
import 'settings/settings_ui.dart';
|
import 'settings/settings_ui.dart';
|
||||||
|
import 'tools/tools_ui.dart';
|
||||||
|
|
||||||
class IndexUI extends HookConsumerWidget {
|
class IndexUI extends HookConsumerWidget {
|
||||||
const IndexUI({super.key});
|
const IndexUI({super.key});
|
||||||
@ -128,6 +129,8 @@ class IndexUI extends HookConsumerWidget {
|
|||||||
return const ToolsUI();
|
return const ToolsUI();
|
||||||
case 3:
|
case 3:
|
||||||
return const SettingsUI();
|
return const SettingsUI();
|
||||||
|
case 4:
|
||||||
|
return const AboutUI();
|
||||||
default:
|
default:
|
||||||
return Center(
|
return Center(
|
||||||
child: Text("UnimplPage $value"),
|
child: Text("UnimplPage $value"),
|
||||||
|
Loading…
Reference in New Issue
Block a user