init
This commit is contained in:
20
lib/pages/login/logic.dart
Normal file
20
lib/pages/login/logic.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'dart:io';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class LoginLogic extends GetxController {
|
||||
final LoginState state = LoginState();
|
||||
|
||||
void isExit(context) {
|
||||
if (state.lastPressedAt == null ||
|
||||
DateTime.now().difference(state.lastPressedAt!) >
|
||||
const Duration(seconds: 1)) {
|
||||
//两次点击间隔超过1秒则重新计时
|
||||
state.lastPressedAt = DateTime.now();
|
||||
BotToast.showText(text:"再按一次退出程序");
|
||||
return;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user