diff --git a/lib/common/conf.dart b/lib/common/conf.dart index fbdb0c6..e09af4f 100644 --- a/lib/common/conf.dart +++ b/lib/common/conf.dart @@ -13,9 +13,9 @@ import 'package:window_manager/window_manager.dart'; import '../base/ui.dart'; class AppConf { - static const String appVersion = "2.9.6+1 Beta"; - static const int appVersionCode = 22; - static const String appVersionDate = "2023-10-29"; + static const String appVersion = "2.9.7 Beta"; + static const int appVersionCode = 23; + static const String appVersionDate = "2023-10-30"; static const String gitlabHomeUrl = "https://jihulab.com/StarCitizenCN_Community/StarCitizenDoctor"; @@ -38,6 +38,9 @@ class AppConf { static late final WindowsDeviceInfo windowsDeviceInfo; + static const isMSE = + String.fromEnvironment("MSE", defaultValue: "false") == "true"; + static init() async { WidgetsFlutterBinding.ensureInitialized(); @@ -92,9 +95,11 @@ class AppConf { static Future _checkUpdate() async { // clean path - final dir = Directory(getUpgradePath()); - if (await dir.exists()) { - dir.delete(recursive: true); + if (!isMSE) { + final dir = Directory(getUpgradePath()); + if (await dir.exists()) { + dir.delete(recursive: true); + } } try { networkVersionData = await Api.getAppVersion(); diff --git a/lib/global_ui_model.dart b/lib/global_ui_model.dart index 1d8bb86..0a902d7 100644 --- a/lib/global_ui_model.dart +++ b/lib/global_ui_model.dart @@ -13,6 +13,7 @@ final globalUIModelProvider = ChangeNotifierProvider((ref) => globalUIModel); class AppGlobalUIModel extends BaseUIModel { Future checkUpdate(BuildContext context, {bool init = true}) async { + if (AppConf.isMSE) return true; if (!init) { try { AppConf.networkVersionData = await Api.getAppVersion(); diff --git a/lib/ui/home/home_ui.dart b/lib/ui/home/home_ui.dart index 4211832..0a885f6 100644 --- a/lib/ui/home/home_ui.dart +++ b/lib/ui/home/home_ui.dart @@ -1,6 +1,7 @@ import 'package:extended_image/extended_image.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter_tilt/flutter_tilt.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:starcitizen_doctor/api/analytics.dart'; import 'package:starcitizen_doctor/base/ui.dart'; @@ -74,11 +75,15 @@ class HomeUI extends BaseUI { children: [ Padding( padding: const EdgeInsets.only(top: 64, bottom: 64), - child: Image.asset( - "assets/sc_logo.png", - height: 256, + child: SizedBox( width: MediaQuery.of(context).size.width, - fit: BoxFit.fitHeight, + child: Center( + child: Image.asset( + "assets/sc_logo.png", + height: 256, + fit: BoxFit.fitHeight, + ), + ), ), ), Positioned( @@ -226,61 +231,65 @@ class HomeUI extends BaseUI { subtitle: "探索宇宙的好伙伴", jumpUrl: "https://citizenwiki.cn"), const SizedBox(height: 12), - Container( + Tilt( + shadowConfig: const ShadowConfig(maxIntensity: .2), + borderRadius: BorderRadius.circular(12), + child: Container( width: width, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), color: FluentTheme.of(context).cardColor, ), - child: IconButton( - icon: Padding( - padding: const EdgeInsets.all(12), - child: Column(children: [ - const Row( + child: Padding( + padding: const EdgeInsets.all(12), + child: Column(children: [ + const Row( + children: [ + Text("星际公民服务器状态:"), + ], + ), + const SizedBox(height: 12), + if (model.scServerStatus == null) + makeLoading(context, width: 20) + else + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text("星际公民服务器状态:"), - ], - ), - const SizedBox(height: 12), - if (model.scServerStatus == null) - makeLoading(context, width: 20) - else - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - for (final item in model.scServerStatus ?? []) - Row( - children: [ - SizedBox( - height: 14, - child: Center( - child: Icon( - FontAwesomeIcons.solidCircle, - color: model - .isRSIServerStatusOK(item) - ? Colors.green - : Colors.red, - size: 12, - ), + for (final item in model.scServerStatus ?? []) + Row( + children: [ + SizedBox( + height: 14, + child: Center( + child: Icon( + FontAwesomeIcons.solidCircle, + color: + model.isRSIServerStatusOK(item) + ? Colors.green + : Colors.red, + size: 12, ), ), - const SizedBox(width: 3), - Text( - "${model.statusCnName[item["name"]] ?? item["name"]}", - style: const TextStyle(fontSize: 13), - ), - ], - ) - ], - ) - ]), - ), - onPressed: () { - launchUrlString( - "https://status.robertsspaceindustries.com/"); - }, - )), + ), + const SizedBox(width: 3), + Text( + "${model.statusCnName[item["name"]] ?? item["name"]}", + style: const TextStyle(fontSize: 13), + ), + ], + ) + ], + ) + ]), + ), + // child: IconButton( + // icon: , + // onPressed: () { + // launchUrlString( + // "https://status.robertsspaceindustries.com/"); + // }, + // ), + ), + ), ], )) ], @@ -526,62 +535,66 @@ class HomeUI extends BaseUI { required String jumpUrl, }) { final width = MediaQuery.of(context).size.width * .21; - return Container( - width: width, - height: 128, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: FluentTheme.of(context).cardColor, - ), - child: Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(12), - child: ExtendedImage.network( - bgURl, - fit: BoxFit.cover, - width: width, - ), - ), - Container( + return Tilt( + shadowConfig: const ShadowConfig(maxIntensity: .3), + borderRadius: BorderRadius.circular(12), + child: GestureDetector( + onTap: () { + launchUrlString(jumpUrl); + }, + child: ClipRRect( + child: Container( width: width, height: 128, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.black.withOpacity(.7), + color: FluentTheme.of(context).cardColor, + ), + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.all(.3), + child: ExtendedImage.network( + bgURl, + fit: BoxFit.cover, + width: width, + ), + ), + Container( + width: width, + decoration: BoxDecoration( + color: Colors.black.withOpacity(.7), + ), + ), + Positioned( + top: 0, + bottom: 0, + left: 0, + right: 0, + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + title, + style: const TextStyle( + fontSize: 24, + ), + ), + const SizedBox(height: 6), + Text( + subtitle, + style: TextStyle( + color: Colors.white.withOpacity(.8), + fontSize: 14), + ), + ], + ), + ), + ) + ], ), ), - Positioned( - top: 0, - bottom: 0, - left: 0, - right: 0, - child: IconButton( - icon: Center( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - title, - style: const TextStyle( - fontSize: 24, - ), - ), - const SizedBox(height: 6), - Text( - subtitle, - style: TextStyle( - color: Colors.white.withOpacity(.8), fontSize: 14), - ), - ], - ), - ), - onPressed: () { - launchUrlString(jumpUrl); - }, - ), - ) - ], + ), ), ); } @@ -595,16 +608,24 @@ class HomeUI extends BaseUI { required double width, String? info, String? touchKey}) { - return Container( - width: width, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: FluentTheme.of(context).cardColor, - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: IconButton( - icon: Column( + return Tilt( + shadowConfig: const ShadowConfig(maxIntensity: .3), + borderRadius: BorderRadius.circular(12), + child: GestureDetector( + onTap: () { + if (touchKey != null) { + AnalyticsApi.touch(touchKey); + } + model.goWebView(webTitle, webURL, useLocalization: true); + }, + child: Container( + width: width, + decoration: BoxDecoration( + color: FluentTheme.of(context).cardColor, + ), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( @@ -627,12 +648,8 @@ class HomeUI extends BaseUI { ) ], ), - onPressed: () { - if (touchKey != null) { - AnalyticsApi.touch(touchKey); - } - model.goWebView(webTitle, webURL, useLocalization: true); - }), + ), + ), ), ); } diff --git a/lib/ui/index_ui.dart b/lib/ui/index_ui.dart index ac7f28e..a55280f 100644 --- a/lib/ui/index_ui.dart +++ b/lib/ui/index_ui.dart @@ -27,7 +27,8 @@ class IndexUI extends BaseUI { children: [ Image.asset("assets/app_logo.png", width: 24, height: 24), const SizedBox(width: 12), - const Text("星际公民盒子 V${AppConf.appVersion}"), + const Text( + "星际公民盒子 V${AppConf.appVersion}${AppConf.isMSE ? " MSE" : ""}"), ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 1a0db38..e208361 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,8 +50,8 @@ dependencies: flutter_svg: ^2.0.7 archive: ^3.4.4 jwt_decode: ^0.3.1 - html: ^0.15.4 uuid: ^4.1.0 + flutter_tilt: ^2.0.10 dev_dependencies: flutter_test: @@ -63,6 +63,7 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^3.0.0 + msix: ^3.16.4 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec @@ -106,3 +107,14 @@ flutter: # # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages +msix_config: + display_name: 星际公民盒子MSE + publisher_display_name: xkeyC Studio + identity_name: 56575xkeyC.MSE + publisher: CN=B54C897B-C263-4680-B6AB-4913C603DF87 + msix_version: 2.9.7.0 + logo_path: ./assets/app_logo.png + capabilities: internetClient,allowElevation + languages: zh-cn + windows_build_args: --dart-define="MSE=true" +# store: true \ No newline at end of file