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

View File

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

View File

@ -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,13 +75,17 @@ class HomeUI extends BaseUI<HomeUIModel> {
children: [
Padding(
padding: const EdgeInsets.only(top: 64, bottom: 64),
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: Center(
child: Image.asset(
"assets/sc_logo.png",
height: 256,
width: MediaQuery.of(context).size.width,
fit: BoxFit.fitHeight,
),
),
),
),
Positioned(
top: 0,
right: 24,
@ -226,14 +231,15 @@ class HomeUI extends BaseUI<HomeUIModel> {
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(
child: Padding(
padding: const EdgeInsets.all(12),
child: Column(children: [
const Row(
@ -246,8 +252,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
makeLoading(context, width: 20)
else
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
for (final item in model.scServerStatus ?? [])
Row(
@ -257,8 +262,8 @@ class HomeUI extends BaseUI<HomeUIModel> {
child: Center(
child: Icon(
FontAwesomeIcons.solidCircle,
color: model
.isRSIServerStatusOK(item)
color:
model.isRSIServerStatusOK(item)
? Colors.green
: Colors.red,
size: 12,
@ -276,11 +281,15 @@ class HomeUI extends BaseUI<HomeUIModel> {
)
]),
),
onPressed: () {
launchUrlString(
"https://status.robertsspaceindustries.com/");
},
)),
// child: IconButton(
// icon: ,
// onPressed: () {
// launchUrlString(
// "https://status.robertsspaceindustries.com/");
// },
// ),
),
),
],
))
],
@ -526,17 +535,24 @@ class HomeUI extends BaseUI<HomeUIModel> {
required String jumpUrl,
}) {
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,
height: 128,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: FluentTheme.of(context).cardColor,
),
child: Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(12),
Padding(
padding: const EdgeInsets.all(.3),
child: ExtendedImage.network(
bgURl,
fit: BoxFit.cover,
@ -545,9 +561,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
),
Container(
width: width,
height: 128,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: Colors.black.withOpacity(.7),
),
),
@ -556,8 +570,7 @@ class HomeUI extends BaseUI<HomeUIModel> {
bottom: 0,
left: 0,
right: 0,
child: IconButton(
icon: Center(
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
@ -571,18 +584,18 @@ class HomeUI extends BaseUI<HomeUIModel> {
Text(
subtitle,
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,
String? info,
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,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: FluentTheme.of(context).cardColor,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
icon: Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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: [
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" : ""}"),
],
),
),

View File

@ -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