Merge branch 'master_hyx'
This commit is contained in:
commit
0cd65157b7
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,13 +18,9 @@ FutureOr<void> main() async {
|
|||||||
// 设置国际化信息
|
// 设置国际化信息
|
||||||
await _initTranslation();
|
await _initTranslation();
|
||||||
|
|
||||||
if(F.debug){
|
|
||||||
DebugConsole.listen(() {
|
DebugConsole.listen(() {
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
});
|
});
|
||||||
}else{
|
|
||||||
runApp(const MyApp());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AppPlatform.isAndroid) {
|
if (AppPlatform.isAndroid) {
|
||||||
SystemUiOverlayStyle systemUiOverlayStyle =
|
SystemUiOverlayStyle systemUiOverlayStyle =
|
||||||
|
|||||||
39
star_lock/lib/mine/about/about_console.dart
Normal file
39
star_lock/lib/mine/about/about_console.dart
Normal 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), () {
|
||||||
|
// 3秒内没有点击到15次,则重置
|
||||||
|
_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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,6 +44,9 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
return GetBuilder<AboutConsole>(
|
||||||
|
init: AboutConsole(),
|
||||||
|
builder: (AboutConsole logic) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
@ -52,7 +56,18 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
body: Column(
|
body: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(height: 150.h),
|
Align(
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: logic.handleTap,
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
width: 80.w,
|
||||||
|
height: 80.h,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 70.h),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
F.sw(
|
F.sw(
|
||||||
@ -64,12 +79,14 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Text(
|
Text(
|
||||||
"${F.title} $version+$buildNumber",
|
"${F.title} $version+$buildNumber",
|
||||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
style:
|
||||||
|
TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20.h),
|
SizedBox(height: 20.h),
|
||||||
Text(
|
Text(
|
||||||
F.apiPrefix,
|
F.apiPrefix,
|
||||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
style:
|
||||||
|
TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 60.h,
|
height: 60.h,
|
||||||
@ -181,5 +198,6 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user