Merge branch 'master_hyx'

This commit is contained in:
anfe 2024-04-29 16:19:09 +08:00
commit 0cd65157b7
9 changed files with 211 additions and 152 deletions

View File

@ -1,6 +1,8 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'dart:io'; import 'dart:io';
import 'package:star_lock/debug/debug_console.dart';
class AppLog { class AppLog {
static bool _printLog = false; static bool _printLog = false;
static bool _onlyError = false; static bool _onlyError = false;
@ -17,6 +19,7 @@ class AppLog {
if(error){ if(error){
msg = '----->>> $msg'; msg = '----->>> $msg';
} }
DebugConsole.info(msg);
print(msg); print(msg);
} }
} }

View File

@ -201,10 +201,6 @@ class DebugConsole extends StatefulWidget {
controller ??= DebugConsole.instance; controller ??= DebugConsole.instance;
runZoned(body, runZoned(body,
zoneSpecification: ZoneSpecification( zoneSpecification: ZoneSpecification(
print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
controller!.log(line);
parent.print(zone, line);
},
handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone, handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone,
Object error, StackTrace stackTrace) { Object error, StackTrace stackTrace) {
controller!.log(error, controller!.log(error,

View File

@ -11,10 +11,11 @@ class DeBug {
static bool open = false; static bool open = false;
static bool openInfo = false; static bool openInfo = false;
static late OverlayEntry overlayEntry;
static void showFloatWidget() { static void showFloatWidget() {
Rx<Offset> offset = Offset(20, 100).obs; // Rx<Offset> offset = Offset(20, 100).obs; //
OverlayEntry overlayEntry = OverlayEntry(builder: (context) { overlayEntry = OverlayEntry(builder: (context) {
return Obx(() => Positioned( return Obx(() => Positioned(
left: offset.value.dx, left: offset.value.dx,
top: offset.value.dy, top: offset.value.dy,
@ -54,5 +55,9 @@ class DeBug {
Get.key.currentState?.overlay?.insert(overlayEntry); Get.key.currentState?.overlay?.insert(overlayEntry);
} }
static void closeFloatWidget() {
overlayEntry.remove();
}
DeBug(); DeBug();
} }

View File

@ -57,7 +57,7 @@ class F {
case Flavor.sky: case Flavor.sky:
return false; return false;
case Flavor.xhj: case Flavor.xhj:
return false; return true;
default: default:
return false; return false;
} }

View File

@ -18,13 +18,9 @@ FutureOr<void> main() async {
// //
await _initTranslation(); await _initTranslation();
if(F.debug){ DebugConsole.listen(() {
DebugConsole.listen(() {
runApp(const MyApp());
});
}else{
runApp(const MyApp()); runApp(const MyApp());
} });
if (AppPlatform.isAndroid) { if (AppPlatform.isAndroid) {
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle systemUiOverlayStyle =

View File

@ -0,0 +1,39 @@
import 'dart:async';
import 'package:get/get.dart';
import 'package:star_lock/debug/debug_tool.dart';
import 'package:star_lock/tools/storage.dart';
class AboutConsole extends GetxController {
int _clickCount = 0;
Timer? _timer;
void handleTap() async {
_clickCount++;
if (_clickCount == 1) {
//
_timer = Timer(const Duration(seconds: 3), () {
// 315
_resetCounter();
});
}
if (_clickCount >= 15) {
_timer?.cancel();
_resetCounter();
bool? openDeBug = await Storage.getBool(isOpenDeBug);
if (openDeBug == true) {
DeBug.closeFloatWidget();
await Storage.setBool(isOpenDeBug, false);
} else {
DeBug.showFloatWidget();
await Storage.setBool(isOpenDeBug, true);
}
}
}
void _resetCounter() {
_clickCount = 0;
}
}

View File

@ -4,6 +4,7 @@ import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:package_info_plus/package_info_plus.dart'; import 'package:package_info_plus/package_info_plus.dart';
import 'package:star_lock/mine/about/about_console.dart';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
import '../../flavors.dart'; import '../../flavors.dart';
@ -43,143 +44,160 @@ class _AboutPageState extends State<AboutPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return GetBuilder<AboutConsole>(
backgroundColor: AppColors.mainBackgroundColor, init: AboutConsole(),
appBar: TitleAppBar( builder: (AboutConsole logic) {
barTitle: TranslationLoader.lanKeys!.about!.tr, return Scaffold(
haveBack: true, backgroundColor: AppColors.mainBackgroundColor,
backgroundColor: AppColors.mainColor), appBar: TitleAppBar(
body: Column( barTitle: TranslationLoader.lanKeys!.about!.tr,
crossAxisAlignment: CrossAxisAlignment.center, haveBack: true,
children: [ backgroundColor: AppColors.mainColor),
SizedBox(height: 150.h), body: Column(
Row(mainAxisAlignment: MainAxisAlignment.center, children: [ crossAxisAlignment: CrossAxisAlignment.center,
Image.asset( children: [
F.sw( Align(
defaultCall: () => "images/icon_main_1024.png", alignment: Alignment.topRight,
xhjCall: () => "images/icon_main_xhj_1024.png"), child: GestureDetector(
width: 160.w, onTap: logic.handleTap,
height: 160.w), child: Container(
]), color: Colors.transparent,
SizedBox(height: 20.h), width: 80.w,
Text( height: 80.h,
"${F.title} $version+$buildNumber", ),
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), ),
), ),
SizedBox(height: 20.h), SizedBox(height: 70.h),
Text( Row(mainAxisAlignment: MainAxisAlignment.center, children: [
F.apiPrefix, Image.asset(
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), F.sw(
), defaultCall: () => "images/icon_main_1024.png",
SizedBox( xhjCall: () => "images/icon_main_xhj_1024.png"),
height: 60.h, width: 160.w,
), height: 160.w),
CommonItem( ]),
leftTitel: TranslationLoader.lanKeys!.introduce!.tr, SizedBox(height: 20.h),
rightTitle: "", Text(
isHaveLine: false, "${F.title} $version+$buildNumber",
isHaveDirection: true, style:
action: () { TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
Navigator.pushNamed(context, Routers.webviewShowPage, ),
arguments: { SizedBox(height: 20.h),
"url": XSConstantMacro.introduceURL, Text(
"title": '介绍'.tr F.apiPrefix,
}); style:
}), TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
Divider( ),
height: 1, SizedBox(
color: AppColors.greyLineColor, height: 60.h,
indent: 20.w, ),
endIndent: 20.w, CommonItem(
), leftTitel: TranslationLoader.lanKeys!.introduce!.tr,
CommonItem( rightTitle: "",
leftTitel: TranslationLoader.lanKeys!.userAgreement!.tr, isHaveLine: false,
rightTitle: "", isHaveDirection: true,
isHaveLine: false, action: () {
isHaveDirection: true, Navigator.pushNamed(context, Routers.webviewShowPage,
action: () { arguments: {
Get.toNamed(Routers.webviewShowPage, arguments: { "url": XSConstantMacro.introduceURL,
"url": XSConstantMacro.userAgreementURL, "title": '介绍'.tr
"title": '用户协议'.tr });
}); }),
}), Divider(
Divider( height: 1,
height: 1, color: AppColors.greyLineColor,
color: AppColors.greyLineColor, indent: 20.w,
indent: 20.w, endIndent: 20.w,
endIndent: 20.w, ),
), CommonItem(
CommonItem( leftTitel: TranslationLoader.lanKeys!.userAgreement!.tr,
leftTitel: TranslationLoader.lanKeys!.privacyPolicy!.tr, rightTitle: "",
rightTitle: "", isHaveLine: false,
isHaveLine: false, isHaveDirection: true,
isHaveDirection: true, action: () {
action: () { Get.toNamed(Routers.webviewShowPage, arguments: {
Navigator.pushNamed(context, Routers.webviewShowPage, "url": XSConstantMacro.userAgreementURL,
arguments: { "title": '用户协议'.tr
"url": XSConstantMacro.privacyPolicyURL, });
"title": '隐私政策'.tr }),
}); Divider(
}), height: 1,
Divider( color: AppColors.greyLineColor,
height: 1, indent: 20.w,
color: AppColors.greyLineColor, endIndent: 20.w,
indent: 20.w, ),
endIndent: 20.w, CommonItem(
), leftTitel: TranslationLoader.lanKeys!.privacyPolicy!.tr,
CommonItem( rightTitle: "",
leftTitel: TranslationLoader isHaveLine: false,
.lanKeys!.personalInformationCollectionList!.tr, isHaveDirection: true,
rightTitle: "", action: () {
isHaveLine: false, Navigator.pushNamed(context, Routers.webviewShowPage,
isHaveDirection: true, arguments: {
action: () { "url": XSConstantMacro.privacyPolicyURL,
Navigator.pushNamed(context, Routers.webviewShowPage, "title": '隐私政策'.tr
arguments: { });
"url": XSConstantMacro.collectionListURL, }),
"title": '个人信息收集清单'.tr Divider(
}); height: 1,
}), color: AppColors.greyLineColor,
Divider( indent: 20.w,
height: 1, endIndent: 20.w,
color: AppColors.greyLineColor, ),
indent: 20.w, CommonItem(
endIndent: 20.w, leftTitel: TranslationLoader
), .lanKeys!.personalInformationCollectionList!.tr,
CommonItem( rightTitle: "",
leftTitel: TranslationLoader isHaveLine: false,
.lanKeys!.applicationPermissionDescription!.tr, isHaveDirection: true,
rightTitle: "", action: () {
isHaveLine: false, Navigator.pushNamed(context, Routers.webviewShowPage,
isHaveDirection: true, arguments: {
action: () { "url": XSConstantMacro.collectionListURL,
Navigator.pushNamed(context, Routers.webviewShowPage, "title": '个人信息收集清单'.tr
arguments: { });
"url": XSConstantMacro.appPermissionDescURL, }),
"title": '应用权限说明'.tr Divider(
}); height: 1,
}), color: AppColors.greyLineColor,
Divider( indent: 20.w,
height: 1, endIndent: 20.w,
color: AppColors.greyLineColor, ),
indent: 20.w, CommonItem(
endIndent: 20.w, leftTitel: TranslationLoader
), .lanKeys!.applicationPermissionDescription!.tr,
CommonItem( rightTitle: "",
leftTitel: TranslationLoader isHaveLine: false,
.lanKeys!.thirdPartyInformationSharingList!.tr, isHaveDirection: true,
rightTitle: "", action: () {
isHaveLine: false, Navigator.pushNamed(context, Routers.webviewShowPage,
isHaveDirection: true, arguments: {
action: () { "url": XSConstantMacro.appPermissionDescURL,
Navigator.pushNamed(context, Routers.webviewShowPage, "title": '应用权限说明'.tr
arguments: { });
"url": XSConstantMacro.thirdPartyInfShareListURL, }),
"title": '第三方信息共享清单'.tr Divider(
}); height: 1,
}), color: AppColors.greyLineColor,
], indent: 20.w,
), endIndent: 20.w,
); ),
CommonItem(
leftTitel: TranslationLoader
.lanKeys!.thirdPartyInformationSharingList!.tr,
rightTitle: "",
isHaveLine: false,
isHaveDirection: true,
action: () {
Navigator.pushNamed(context, Routers.webviewShowPage,
arguments: {
"url": XSConstantMacro.thirdPartyInfShareListURL,
"title": '第三方信息共享清单'.tr
});
}),
],
),
);
});
} }
} }

View File

@ -21,8 +21,9 @@ class _StarLockApplicationState extends State<StarLockApplication> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) async {
if (F.debug) { bool? openDeBug = await Storage.getBool(isOpenDeBug);
if (openDeBug == true) {
DeBug.showFloatWidget(); DeBug.showFloatWidget();
} }
}); });

View File

@ -26,6 +26,7 @@ const saveIsVip = "saveIsVip"; //是否是VIP
const saveUserLoginData = "userLoginData"; const saveUserLoginData = "userLoginData";
const saveLockMainListData = "lockMainListData"; const saveLockMainListData = "lockMainListData";
const isOpenDeBug = "isOpenDeBug";// debug
class Storage { class Storage {
Storage._internal(); Storage._internal();