tilt import

This commit is contained in:
xkeyC 2023-10-31 00:27:46 +08:00
parent cebe74d972
commit 0fdf56fd7d
5 changed files with 163 additions and 127 deletions

View File

@ -13,9 +13,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.6+1 Beta"; static const String appVersion = "2.9.7 Beta";
static const int appVersionCode = 22; static const int appVersionCode = 23;
static const String appVersionDate = "2023-10-29"; static const String appVersionDate = "2023-10-30";
static const String gitlabHomeUrl = static const String gitlabHomeUrl =
"https://jihulab.com/StarCitizenCN_Community/StarCitizenDoctor"; "https://jihulab.com/StarCitizenCN_Community/StarCitizenDoctor";
@ -38,6 +38,9 @@ class AppConf {
static late final WindowsDeviceInfo windowsDeviceInfo; static late final WindowsDeviceInfo windowsDeviceInfo;
static const isMSE =
String.fromEnvironment("MSE", defaultValue: "false") == "true";
static init() async { static init() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
@ -92,10 +95,12 @@ class AppConf {
static Future<void> _checkUpdate() async { static Future<void> _checkUpdate() async {
// clean path // clean path
if (!isMSE) {
final dir = Directory(getUpgradePath()); final dir = Directory(getUpgradePath());
if (await dir.exists()) { if (await dir.exists()) {
dir.delete(recursive: true); dir.delete(recursive: true);
} }
}
try { try {
networkVersionData = await Api.getAppVersion(); networkVersionData = await Api.getAppVersion();
dPrint( dPrint(

View File

@ -13,6 +13,7 @@ final globalUIModelProvider = ChangeNotifierProvider((ref) => globalUIModel);
class AppGlobalUIModel extends BaseUIModel { class AppGlobalUIModel extends BaseUIModel {
Future<bool> checkUpdate(BuildContext context, {bool init = true}) async { Future<bool> checkUpdate(BuildContext context, {bool init = true}) async {
if (AppConf.isMSE) return true;
if (!init) { if (!init) {
try { try {
AppConf.networkVersionData = await Api.getAppVersion(); AppConf.networkVersionData = await Api.getAppVersion();

View File

@ -1,6 +1,7 @@
import 'package:extended_image/extended_image.dart'; import 'package:extended_image/extended_image.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:flutter_svg/flutter_svg.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:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:starcitizen_doctor/api/analytics.dart'; import 'package:starcitizen_doctor/api/analytics.dart';
import 'package:starcitizen_doctor/base/ui.dart'; import 'package:starcitizen_doctor/base/ui.dart';
@ -74,13 +75,17 @@ class HomeUI extends BaseUI<HomeUIModel> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.only(top: 64, bottom: 64), padding: const EdgeInsets.only(top: 64, bottom: 64),
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: Center(
child: Image.asset( child: Image.asset(
"assets/sc_logo.png", "assets/sc_logo.png",
height: 256, height: 256,
width: MediaQuery.of(context).size.width,
fit: BoxFit.fitHeight, fit: BoxFit.fitHeight,
), ),
), ),
),
),
Positioned( Positioned(
top: 0, top: 0,
right: 24, right: 24,
@ -226,14 +231,15 @@ class HomeUI extends BaseUI<HomeUIModel> {
subtitle: "探索宇宙的好伙伴", subtitle: "探索宇宙的好伙伴",
jumpUrl: "https://citizenwiki.cn"), jumpUrl: "https://citizenwiki.cn"),
const SizedBox(height: 12), const SizedBox(height: 12),
Container( Tilt(
shadowConfig: const ShadowConfig(maxIntensity: .2),
borderRadius: BorderRadius.circular(12),
child: Container(
width: width, width: width,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: FluentTheme.of(context).cardColor, color: FluentTheme.of(context).cardColor,
), ),
child: IconButton( child: Padding(
icon: Padding(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
child: Column(children: [ child: Column(children: [
const Row( const Row(
@ -246,8 +252,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
makeLoading(context, width: 20) makeLoading(context, width: 20)
else else
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween,
children: [ children: [
for (final item in model.scServerStatus ?? []) for (final item in model.scServerStatus ?? [])
Row( Row(
@ -257,8 +262,8 @@ class HomeUI extends BaseUI<HomeUIModel> {
child: Center( child: Center(
child: Icon( child: Icon(
FontAwesomeIcons.solidCircle, FontAwesomeIcons.solidCircle,
color: model color:
.isRSIServerStatusOK(item) model.isRSIServerStatusOK(item)
? Colors.green ? Colors.green
: Colors.red, : Colors.red,
size: 12, size: 12,
@ -276,11 +281,15 @@ class HomeUI extends BaseUI<HomeUIModel> {
) )
]), ]),
), ),
onPressed: () { // child: IconButton(
launchUrlString( // icon: ,
"https://status.robertsspaceindustries.com/"); // onPressed: () {
}, // launchUrlString(
)), // "https://status.robertsspaceindustries.com/");
// },
// ),
),
),
], ],
)) ))
], ],
@ -526,17 +535,24 @@ class HomeUI extends BaseUI<HomeUIModel> {
required String jumpUrl, required String jumpUrl,
}) { }) {
final width = MediaQuery.of(context).size.width * .21; final width = MediaQuery.of(context).size.width * .21;
return Container( return Tilt(
shadowConfig: const ShadowConfig(maxIntensity: .3),
borderRadius: BorderRadius.circular(12),
child: GestureDetector(
onTap: () {
launchUrlString(jumpUrl);
},
child: ClipRRect(
child: Container(
width: width, width: width,
height: 128, height: 128,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: FluentTheme.of(context).cardColor, color: FluentTheme.of(context).cardColor,
), ),
child: Stack( child: Stack(
children: [ children: [
ClipRRect( Padding(
borderRadius: BorderRadius.circular(12), padding: const EdgeInsets.all(.3),
child: ExtendedImage.network( child: ExtendedImage.network(
bgURl, bgURl,
fit: BoxFit.cover, fit: BoxFit.cover,
@ -545,9 +561,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
), ),
Container( Container(
width: width, width: width,
height: 128,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.black.withOpacity(.7), color: Colors.black.withOpacity(.7),
), ),
), ),
@ -556,8 +570,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
child: IconButton( child: Center(
icon: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -571,18 +584,18 @@ class HomeUI extends BaseUI<HomeUIModel> {
Text( Text(
subtitle, subtitle,
style: TextStyle( style: TextStyle(
color: Colors.white.withOpacity(.8), fontSize: 14), color: Colors.white.withOpacity(.8),
fontSize: 14),
), ),
], ],
), ),
), ),
onPressed: () {
launchUrlString(jumpUrl);
},
),
) )
], ],
), ),
),
),
),
); );
} }
@ -595,16 +608,24 @@ class HomeUI extends BaseUI<HomeUIModel> {
required double width, required double width,
String? info, String? info,
String? touchKey}) { String? touchKey}) {
return Container( 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, width: width,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: FluentTheme.of(context).cardColor, color: FluentTheme.of(context).cardColor,
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: IconButton( child: Column(
icon: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
@ -627,12 +648,8 @@ class HomeUI extends BaseUI<HomeUIModel> {
) )
], ],
), ),
onPressed: () { ),
if (touchKey != null) { ),
AnalyticsApi.touch(touchKey);
}
model.goWebView(webTitle, webURL, useLocalization: true);
}),
), ),
); );
} }

View File

@ -27,7 +27,8 @@ class IndexUI extends BaseUI<IndexUIModel> {
children: [ children: [
Image.asset("assets/app_logo.png", width: 24, height: 24), Image.asset("assets/app_logo.png", width: 24, height: 24),
const SizedBox(width: 12), const SizedBox(width: 12),
const Text("星际公民盒子 V${AppConf.appVersion}"), const Text(
"星际公民盒子 V${AppConf.appVersion}${AppConf.isMSE ? " MSE" : ""}"),
], ],
), ),
), ),

View File

@ -50,8 +50,8 @@ dependencies:
flutter_svg: ^2.0.7 flutter_svg: ^2.0.7
archive: ^3.4.4 archive: ^3.4.4
jwt_decode: ^0.3.1 jwt_decode: ^0.3.1
html: ^0.15.4
uuid: ^4.1.0 uuid: ^4.1.0
flutter_tilt: ^2.0.10
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -63,6 +63,7 @@ dev_dependencies:
# package. See that file for information about deactivating specific lint # package. See that file for information about deactivating specific lint
# rules and activating additional ones. # rules and activating additional ones.
flutter_lints: ^3.0.0 flutter_lints: ^3.0.0
msix: ^3.16.4
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec
@ -106,3 +107,14 @@ flutter:
# #
# For details regarding fonts from package dependencies, # For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages # 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