This commit is contained in:
xkeyC 2023-11-30 20:28:03 +08:00
parent 5786534480
commit b9d4cbef5e
3 changed files with 242 additions and 265 deletions

View File

@ -17,9 +17,9 @@ import 'package:window_manager/window_manager.dart';
import '../base/ui.dart'; import '../base/ui.dart';
class AppConf { class AppConf {
static const String appVersion = "2.9.21 Beta"; static const String appVersion = "2.9.22 Beta";
static const int appVersionCode = 32; static const int appVersionCode = 33;
static const String appVersionDate = "2023-11-28"; static const String appVersionDate = "2023-11-30";
static const String gitlabHomeUrl = static const String gitlabHomeUrl =
"https://jihulab.com/StarCitizenCN_Community/StarCitizenDoctor"; "https://jihulab.com/StarCitizenCN_Community/StarCitizenDoctor";
@ -98,8 +98,8 @@ class AppConf {
/// init windows /// init windows
await windowManager.ensureInitialized(); await windowManager.ensureInitialized();
windowManager.waitUntilReadyToShow().then((_) async { windowManager.waitUntilReadyToShow().then((_) async {
await windowManager.setSize(const Size(1300, 830)); await windowManager.setSize(const Size(1280, 810));
await windowManager.setMinimumSize(const Size(1300, 830)); await windowManager.setMinimumSize(const Size(1280, 810));
await windowManager.center(animate: true); await windowManager.center(animate: true);
await windowManager.setSkipTaskbar(false); await windowManager.setSkipTaskbar(false);
await windowManager.setTitleBarStyle( await windowManager.setTitleBarStyle(

View File

@ -77,7 +77,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
Stack( Stack(
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.only(top: 64, bottom: 64), padding: const EdgeInsets.only(top: 64, bottom: 0),
child: SizedBox( child: SizedBox(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: Center( child: Center(
@ -91,6 +91,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
height: 260, height: 260,
), ),
), ),
makeGameStatusCard(context, model, 320)
], ],
), ),
), ),
@ -98,261 +99,14 @@ class HomeUI extends BaseUI<HomeUIModel> {
), ),
Positioned( Positioned(
top: 0, top: 0,
right: 24,
child: Stack(
children: [
Column(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color:
FluentTheme.of(context).cardColor.withOpacity(.03),
),
child: Padding(
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
makeWebViewButton(model,
icon: SvgPicture.asset(
"assets/rsi.svg",
colorFilter: makeSvgColor(Colors.white),
height: 18,
),
name: "星际公民官网汉化",
webTitle: "星际公民官网汉化",
webURL: "https://robertsspaceindustries.com",
info: "罗伯茨航天工业公司,万物的起源",
useLocalization: true,
width: width,
touchKey: "webLocalization_rsi"),
const SizedBox(height: 12),
makeWebViewButton(model,
icon: Row(
children: [
SvgPicture.asset(
"assets/uex.svg",
height: 18,
),
const SizedBox(width: 12),
],
),
name: "UEX 汉化",
webTitle: "UEX 汉化",
webURL: "https://uexcorp.space",
info: "采矿、精炼、贸易计算器、价格、船信息",
useLocalization: true,
width: width,
touchKey: "webLocalization_uex"),
const SizedBox(height: 12),
makeWebViewButton(model,
icon: Row(
children: [
Image.asset(
"assets/dps.png",
height: 20,
),
const SizedBox(width: 12),
],
),
name: "DPS计算器汉化",
webTitle: "DPS计算器汉化",
webURL:
"https://www.erkul.games/live/calculator",
info: "在线改船,查询伤害数值和配件购买地点",
useLocalization: true,
width: width,
touchKey: "webLocalization_dps"),
const SizedBox(height: 12),
const Text("外部浏览器拓展:"),
const SizedBox(height: 8),
Row(
children: [
Button(
child: const FaIcon(FontAwesomeIcons.chrome,
size: 18),
onPressed: () {
launchUrlString(
"https://chrome.google.com/webstore/detail/gocnjckojmledijgmadmacoikibcggja?authuser=0&hl=zh-CN");
},
),
const SizedBox(width: 12),
Button(
child: const FaIcon(FontAwesomeIcons.edge,
size: 18),
onPressed: () {
launchUrlString(
"https://microsoftedge.microsoft.com/addons/detail/lipbbcckldklpdcpfagicipecaacikgi");
},
),
const SizedBox(width: 12),
Button(
child: const FaIcon(
FontAwesomeIcons.firefoxBrowser,
size: 18),
onPressed: () {
launchUrlString(
"https://addons.mozilla.org/zh-CN/firefox/"
"addon/%E6%98%9F%E9%99%85%E5%85%AC%E6%B0%91%E7%9B%92%E5%AD%90%E6%B5%8F%E8%A7%88%E5%99%A8%E6%8B%93%E5%B1%95/");
},
),
const SizedBox(width: 12),
Button(
child: const FaIcon(FontAwesomeIcons.github,
size: 18),
onPressed: () {
launchUrlString(
"https://github.com/xkeyC/StarCitizenBoxBrowserEx");
},
),
],
)
],
),
),
),
const SizedBox(height: 12),
makeActivityBanner(context, model, width),
],
),
if (model.appWebLocalizationVersionsData == null)
Positioned.fill(
child: Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(.3),
borderRadius: BorderRadius.circular(12)),
child: const Center(
child: ProgressRing(),
),
))
],
),
),
Positioned(
left: 24, left: 24,
bottom: 0, child: makeLeftColumn(context, model, width),
child: SizedBox(
height: 415,
child: ScrollConfiguration(
behavior:
ScrollConfiguration.of(context).copyWith(scrollbars: false),
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: 190,
width: 316,
child: Tilt(
shadowConfig: const ShadowConfig(maxIntensity: .3),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
child: model.rssVideoItems == null
? Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(.1)),
child: makeLoading(context),
)
: Swiper(
itemCount: model.rssVideoItems?.length ?? 0,
itemBuilder: (context, index) {
final item = model.rssVideoItems![index];
return GestureDetector(
onTap: () {
if (item.link != null) {
launchUrlString(item.link!);
}
},
child: CacheNetImage(
url: model.getRssImage(item),
fit: BoxFit.cover,
),
);
},
autoplay: true,
),
)),
SizedBox(
width: 316,
child: Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(.1),
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12))),
child: model.rssTextItems == null
? Padding(
padding: const EdgeInsets.only(
top: 24, bottom: 24),
child: makeLoading(context),
)
: Column(
children: [
const SizedBox(height: 1),
ListView.builder(
physics:
const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder:
(BuildContext context, int index) {
final item = model.rssTextItems![index];
return Tilt(
shadowConfig: const ShadowConfig(
maxIntensity: .3),
borderRadius:
BorderRadius.circular(12),
child: GestureDetector(
onTap: () {
if (item.link != null) {
launchUrlString(item.link!);
}
},
child: Padding(
padding: const EdgeInsets.only(
left: 12,
right: 12,
top: 4,
bottom: 4),
child: Row(
children: [
const Text("· "),
Expanded(
child: Text(
"${item.title}",
textAlign:
TextAlign.start,
maxLines: 1,
overflow: TextOverflow
.ellipsis,
style: const TextStyle(
fontSize: 12.2),
),
)
],
),
),
));
},
itemCount: model.rssTextItems?.length,
),
const SizedBox(height: 12),
],
)),
),
],
)),
),
),
), ),
Positioned( Positioned(
left: 0, right: 24,
right: 0, top: 0,
bottom: 0, child: makeNewsCard(context, model),
child: Center( ),
child: makeGameStatusCard(context, model, 320),
))
], ],
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
@ -428,6 +182,227 @@ class HomeUI extends BaseUI<HomeUIModel> {
]; ];
} }
Widget makeLeftColumn(BuildContext context, HomeUIModel model, double width) {
return Stack(
children: [
Column(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: FluentTheme.of(context).cardColor.withOpacity(.03),
),
child: Padding(
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
makeWebViewButton(model,
icon: SvgPicture.asset(
"assets/rsi.svg",
colorFilter: makeSvgColor(Colors.white),
height: 18,
),
name: "星际公民官网汉化",
webTitle: "星际公民官网汉化",
webURL: "https://robertsspaceindustries.com",
info: "罗伯茨航天工业公司,万物的起源",
useLocalization: true,
width: width,
touchKey: "webLocalization_rsi"),
const SizedBox(height: 12),
makeWebViewButton(model,
icon: Row(
children: [
SvgPicture.asset(
"assets/uex.svg",
height: 18,
),
const SizedBox(width: 12),
],
),
name: "UEX 汉化",
webTitle: "UEX 汉化",
webURL: "https://uexcorp.space",
info: "采矿、精炼、贸易计算器、价格、船信息",
useLocalization: true,
width: width,
touchKey: "webLocalization_uex"),
const SizedBox(height: 12),
makeWebViewButton(model,
icon: Row(
children: [
Image.asset(
"assets/dps.png",
height: 20,
),
const SizedBox(width: 12),
],
),
name: "DPS计算器汉化",
webTitle: "DPS计算器汉化",
webURL: "https://www.erkul.games/live/calculator",
info: "在线改船,查询伤害数值和配件购买地点",
useLocalization: true,
width: width,
touchKey: "webLocalization_dps"),
const SizedBox(height: 12),
const Text("外部浏览器拓展:"),
const SizedBox(height: 12),
Row(
children: [
Button(
child:
const FaIcon(FontAwesomeIcons.chrome, size: 18),
onPressed: () {
launchUrlString(
"https://chrome.google.com/webstore/detail/gocnjckojmledijgmadmacoikibcggja?authuser=0&hl=zh-CN");
},
),
const SizedBox(width: 12),
Button(
child: const FaIcon(FontAwesomeIcons.edge, size: 18),
onPressed: () {
launchUrlString(
"https://microsoftedge.microsoft.com/addons/detail/lipbbcckldklpdcpfagicipecaacikgi");
},
),
const SizedBox(width: 12),
Button(
child: const FaIcon(FontAwesomeIcons.firefoxBrowser,
size: 18),
onPressed: () {
launchUrlString(
"https://addons.mozilla.org/zh-CN/firefox/"
"addon/%E6%98%9F%E9%99%85%E5%85%AC%E6%B0%91%E7%9B%92%E5%AD%90%E6%B5%8F%E8%A7%88%E5%99%A8%E6%8B%93%E5%B1%95/");
},
),
const SizedBox(width: 12),
Button(
child:
const FaIcon(FontAwesomeIcons.github, size: 18),
onPressed: () {
launchUrlString(
"https://github.com/xkeyC/StarCitizenBoxBrowserEx");
},
),
],
)
],
),
),
),
const SizedBox(height: 16),
makeActivityBanner(context, model, width),
],
),
if (model.appWebLocalizationVersionsData == null)
Positioned.fill(
child: Container(
decoration: BoxDecoration(
color: Colors.black.withOpacity(.3),
borderRadius: BorderRadius.circular(12)),
child: const Center(
child: ProgressRing(),
),
))
],
);
}
Widget makeNewsCard(BuildContext context, HomeUIModel model) {
return ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false),
child: Container(
width: 316,
height: 386,
decoration: BoxDecoration(
color: Colors.white.withOpacity(.1),
borderRadius: BorderRadius.circular(12)),
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: 190,
width: 316,
child: Tilt(
shadowConfig: const ShadowConfig(maxIntensity: .3),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
child: model.rssVideoItems == null
? Container(
decoration: BoxDecoration(
color: Colors.white.withOpacity(.1)),
child: makeLoading(context),
)
: Swiper(
itemCount: model.rssVideoItems?.length ?? 0,
itemBuilder: (context, index) {
final item = model.rssVideoItems![index];
return GestureDetector(
onTap: () {
if (item.link != null) {
launchUrlString(item.link!);
}
},
child: CacheNetImage(
url: model.getRssImage(item),
fit: BoxFit.cover,
),
);
},
autoplay: true,
),
)),
const SizedBox(height: 1),
if (model.rssTextItems == null)
makeLoading(context)
else
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
final item = model.rssTextItems![index];
return Tilt(
shadowConfig: const ShadowConfig(maxIntensity: .3),
borderRadius: BorderRadius.circular(12),
child: GestureDetector(
onTap: () {
if (item.link != null) {
launchUrlString(item.link!);
}
},
child: Padding(
padding: const EdgeInsets.only(
left: 12, right: 12, top: 4, bottom: 4),
child: Row(
children: [
const Text("· "),
Expanded(
child: Text(
"${model.handleTitle(item.title)}",
textAlign: TextAlign.start,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12.2),
),
)
],
),
),
));
},
itemCount: model.rssTextItems?.length,
),
const SizedBox(height: 12),
],
),
)),
);
}
Widget makeIndexActionLists(BuildContext context, HomeUIModel model) { Widget makeIndexActionLists(BuildContext context, HomeUIModel model) {
final items = [ final items = [
_HomeItemData("auto_check", "一键诊断", "一键诊断星际公民常见问题", _HomeItemData("auto_check", "一键诊断", "一键诊断星际公民常见问题",
@ -661,18 +636,13 @@ class HomeUI extends BaseUI<HomeUIModel> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: Column(children: [ child: Column(children: [
const Row(
children: [
Text("星际公民服务器状态:"),
],
),
const SizedBox(height: 12),
if (model.scServerStatus == null) if (model.scServerStatus == null)
makeLoading(context, width: 20) makeLoading(context, width: 20)
else else
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text("状态:"),
for (final item in model.scServerStatus ?? []) for (final item in model.scServerStatus ?? [])
Row( Row(
children: [ children: [
@ -716,7 +686,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
decoration: BoxDecoration(color: FluentTheme.of(context).cardColor), decoration: BoxDecoration(color: FluentTheme.of(context).cardColor),
child: Padding( child: Padding(
padding: padding:
const EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), const EdgeInsets.only(left: 12, right: 12, top: 8, bottom: 8),
child: (model.countdownFestivalListData == null) child: (model.countdownFestivalListData == null)
? SizedBox( ? SizedBox(
width: width, width: width,

View File

@ -604,4 +604,11 @@ class HomeUIModel extends BaseUIModel {
} }
return ""; return "";
} }
handleTitle(String? title) {
if (title == null) return "";
title = title.replaceAll("", "[ ");
title = title.replaceAll("", " ] ");
return title;
}
} }