feat:预约操作按钮
This commit is contained in:
1 parent
2d53ed5622
commit
45c2ea384d
3 files changed
+52
-4
No files matched your search
@@ -11,6 +11,9 @@ abstract class BroadcastDao {
|
||||
@insert
|
||||
Future<void> batchSave(List<BroadcastEntity> entitys);
|
||||
|
||||
@update
|
||||
Future<void> edit(BroadcastEntity entity);
|
||||
|
||||
@Query("""
|
||||
SELECT * FROM broadcast
|
||||
WHERE
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:forui/forui.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -87,4 +88,30 @@ class CanteenReserveController extends GetxController {
|
||||
totalPage.value = total ?? 0;
|
||||
reserveList.value = list;
|
||||
}
|
||||
|
||||
// 切换播报状态
|
||||
Future<void> toggle(BroadcastEntity v) async {
|
||||
EasyLoading.show(
|
||||
status: '切换中...',
|
||||
maskType: EasyLoadingMaskType.black,
|
||||
);
|
||||
final broadcastDao = appC.dataBase.getBroadcastDao;
|
||||
v.enable = !v.enable;
|
||||
await broadcastDao.edit(v);
|
||||
await _getReservePage();
|
||||
EasyLoading.dismiss();
|
||||
}
|
||||
|
||||
// 重置播报次数
|
||||
Future<void> reset(BroadcastEntity v) async {
|
||||
EasyLoading.show(
|
||||
status: '重置中...',
|
||||
maskType: EasyLoadingMaskType.black,
|
||||
);
|
||||
final broadcastDao = appC.dataBase.getBroadcastDao;
|
||||
v.broadcastCount = 0;
|
||||
await broadcastDao.edit(v);
|
||||
await _getReservePage();
|
||||
EasyLoading.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -145,10 +145,28 @@ class CanteenReservePage extends GetView<CanteenReserveController> {
|
||||
).center(),
|
||||
),
|
||||
DataCell(
|
||||
Text(
|
||||
DateUtil.formatDate(v.createTime),
|
||||
textAlign: TextAlign.center,
|
||||
).center(),
|
||||
<Widget>[
|
||||
FButton(
|
||||
label: Text(
|
||||
v.enable ? "关闭播报" : '开启播报',
|
||||
style: theme.typography.sm.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
style: FButtonStyle.outline,
|
||||
onPress: () => controller.toggle(v),
|
||||
),
|
||||
FButton(
|
||||
label: Text(
|
||||
'充值播报次数',
|
||||
style: theme.typography.sm.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
style: FButtonStyle.outline,
|
||||
onPress: () => controller.reset(v),
|
||||
),
|
||||
].toRow(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user