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,9 +95,11 @@ class AppConf {
static Future<void> _checkUpdate() async { static Future<void> _checkUpdate() async {
// clean path // clean path
final dir = Directory(getUpgradePath()); if (!isMSE) {
if (await dir.exists()) { final dir = Directory(getUpgradePath());
dir.delete(recursive: true); if (await dir.exists()) {
dir.delete(recursive: true);
}
} }
try { try {
networkVersionData = await Api.getAppVersion(); networkVersionData = await Api.getAppVersion();

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,11 +75,15 @@ 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: Image.asset( child: SizedBox(
"assets/sc_logo.png",
height: 256,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
fit: BoxFit.fitHeight, child: Center(
child: Image.asset(
"assets/sc_logo.png",
height: 256,
fit: BoxFit.fitHeight,
),
),
), ),
), ),
Positioned( Positioned(
@ -226,61 +231,65 @@ 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( children: [
Text("星际公民服务器状态:"),
],
),
const SizedBox(height: 12),
if (model.scServerStatus == null)
makeLoading(context, width: 20)
else
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text("星际公民服务器状态:"), for (final item in model.scServerStatus ?? [])
], Row(
), children: [
const SizedBox(height: 12), SizedBox(
if (model.scServerStatus == null) height: 14,
makeLoading(context, width: 20) child: Center(
else child: Icon(
Row( FontAwesomeIcons.solidCircle,
mainAxisAlignment: color:
MainAxisAlignment.spaceBetween, model.isRSIServerStatusOK(item)
children: [ ? Colors.green
for (final item in model.scServerStatus ?? []) : Colors.red,
Row( size: 12,
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( const SizedBox(width: 3),
"${model.statusCnName[item["name"]] ?? item["name"]}", Text(
style: const TextStyle(fontSize: 13), "${model.statusCnName[item["name"]] ?? item["name"]}",
), style: const TextStyle(fontSize: 13),
], ),
) ],
], )
) ],
]), )
), ]),
onPressed: () { ),
launchUrlString( // child: IconButton(
"https://status.robertsspaceindustries.com/"); // icon: ,
}, // onPressed: () {
)), // launchUrlString(
// "https://status.robertsspaceindustries.com/");
// },
// ),
),
),
], ],
)) ))
], ],
@ -526,62 +535,66 @@ 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(
width: width, shadowConfig: const ShadowConfig(maxIntensity: .3),
height: 128, borderRadius: BorderRadius.circular(12),
decoration: BoxDecoration( child: GestureDetector(
borderRadius: BorderRadius.circular(12), onTap: () {
color: FluentTheme.of(context).cardColor, launchUrlString(jumpUrl);
), },
child: Stack( child: ClipRRect(
children: [ child: Container(
ClipRRect(
borderRadius: BorderRadius.circular(12),
child: ExtendedImage.network(
bgURl,
fit: BoxFit.cover,
width: width,
),
),
Container(
width: width, width: width,
height: 128, height: 128,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), color: FluentTheme.of(context).cardColor,
color: Colors.black.withOpacity(.7), ),
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<HomeUIModel> {
required double width, required double width,
String? info, String? info,
String? touchKey}) { String? touchKey}) {
return Container( return Tilt(
width: width, shadowConfig: const ShadowConfig(maxIntensity: .3),
decoration: BoxDecoration( borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(12), child: GestureDetector(
color: FluentTheme.of(context).cardColor, onTap: () {
), if (touchKey != null) {
child: Padding( AnalyticsApi.touch(touchKey);
padding: const EdgeInsets.all(8.0), }
child: IconButton( model.goWebView(webTitle, webURL, useLocalization: true);
icon: Column( },
child: Container(
width: width,
decoration: BoxDecoration(
color: FluentTheme.of(context).cardColor,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: 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