app-starlock/lib/mine/about/about_console.dart
2024-05-18 09:37:50 +08:00

40 lines
927 B
Dart
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
}
}