更新页面

This commit is contained in:
wyf
2025-04-16 14:27:10 +08:00
parent 146462b467
commit 1765403f21
58 changed files with 7821 additions and 433 deletions

View File

@@ -0,0 +1,33 @@
import 'dart:async';
import 'package:get/get.dart';
class CountdownController extends GetxController {
var countdown = 0.obs;
Timer? timer;
@override
void onInit() {
super.onInit();
}
void startCountdown(int seconds) {
timer?.cancel(); // 取消之前的定时器
countdown.value = seconds;
timer = Timer.periodic(Duration(seconds: 1), (timer) {
int elapsed = timer.tick;
int remaining = seconds - elapsed;
if (remaining > 0) {
countdown.value = remaining;
} else {
countdown.value = 0;
timer.cancel();
}
});
}
@override
void onClose() {
timer?.cancel();
super.onClose();
}
}