40 lines
927 B
Dart
Executable File
40 lines
927 B
Dart
Executable File
import 'dart:async';
|
||
|
||
import 'package:get/get.dart';
|
||
import 'package:star_lock/mine/about/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;
|
||
}
|
||
}
|