优化定时器 弹窗
This commit is contained in:
@@ -35,6 +35,9 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
final TextEditingController broadcastContentController = TextEditingController();
|
final TextEditingController broadcastContentController = TextEditingController();
|
||||||
final RxInt selectedTabIndex = 0.obs;
|
final RxInt selectedTabIndex = 0.obs;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get listenLifecycleEvent => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -45,11 +48,17 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
startAutoRefresh();
|
startAutoRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onPaused() {
|
||||||
|
stopAutoRefresh();
|
||||||
|
super.onPaused();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
|
stopAutoRefresh();
|
||||||
broadcastTitleController.dispose();
|
broadcastTitleController.dispose();
|
||||||
broadcastContentController.dispose();
|
broadcastContentController.dispose();
|
||||||
stopAutoRefresh();
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get listenLifecycleEvent => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -145,6 +148,12 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
startAutoRefresh();
|
startAutoRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onPaused() {
|
||||||
|
stopAutoRefresh();
|
||||||
|
super.onPaused();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
stopAutoRefresh();
|
stopAutoRefresh();
|
||||||
@@ -162,7 +171,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 【6. 新增】停止定时器的方法
|
///停止定时器的方法
|
||||||
void stopAutoRefresh() {
|
void stopAutoRefresh() {
|
||||||
// 如果定时器存在并且是激活状态,就取消它
|
// 如果定时器存在并且是激活状态,就取消它
|
||||||
_refreshTimer?.cancel();
|
_refreshTimer?.cancel();
|
||||||
@@ -278,7 +287,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
child: TextField(
|
child: TextField(
|
||||||
controller: amountController,
|
controller: amountController,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
FilteringTextInputFormatter.digitsOnly, // 只允许数字输入
|
FilteringTextInputFormatter.digitsOnly, // 只允许数字输入
|
||||||
],
|
],
|
||||||
@@ -580,7 +589,6 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
} finally {
|
} finally {
|
||||||
|
|
||||||
//加载列表数据
|
//加载列表数据
|
||||||
fetchReservationData();
|
fetchReservationData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class CarInfoController extends GetxController with BaseControllerMixin {
|
|||||||
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
||||||
if (!StorageService.to.hasShownBindVehicleDialog &&
|
if (!StorageService.to.hasShownBindVehicleDialog &&
|
||||||
StorageService.to.isLoggedIn &&
|
StorageService.to.isLoggedIn &&
|
||||||
|
StorageService.to.loginChannel == LoginChannel.driver &&
|
||||||
!StorageService.to.hasVehicleInfo) {
|
!StorageService.to.hasVehicleInfo) {
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
DialogX.to.showConfirmDialog(
|
DialogX.to.showConfirmDialog(
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class MineController extends GetxController with BaseControllerMixin {
|
|||||||
if (result.code == 0 && result.data != null) {
|
if (result.code == 0 && result.data != null) {
|
||||||
String total = result.data["total"].toString();
|
String total = result.data["total"].toString();
|
||||||
isNotice = int.parse(total) > 0;
|
isNotice = int.parse(total) > 0;
|
||||||
|
updateUi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -557,10 +557,9 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void onPaused() {
|
||||||
_sheetWorker?.dispose();
|
|
||||||
stopAutoRefresh();
|
stopAutoRefresh();
|
||||||
super.dispose();
|
super.onPaused();
|
||||||
}
|
}
|
||||||
|
|
||||||
void startAutoRefresh() {
|
void startAutoRefresh() {
|
||||||
@@ -757,6 +756,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
||||||
if (!StorageService.to.hasShownBindVehicleDialog &&
|
if (!StorageService.to.hasShownBindVehicleDialog &&
|
||||||
StorageService.to.isLoggedIn &&
|
StorageService.to.isLoggedIn &&
|
||||||
|
StorageService.to.loginChannel == LoginChannel.driver &&
|
||||||
!StorageService.to.hasVehicleInfo) {
|
!StorageService.to.hasVehicleInfo) {
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
DialogX.to.showConfirmDialog(
|
DialogX.to.showConfirmDialog(
|
||||||
@@ -787,6 +787,8 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
if (_debounce != null) {
|
if (_debounce != null) {
|
||||||
_debounce?.cancel();
|
_debounce?.cancel();
|
||||||
}
|
}
|
||||||
|
_sheetWorker?.dispose();
|
||||||
|
stopAutoRefresh();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user