feat:增加删除闪灵功能
This commit is contained in:
@@ -43,7 +43,7 @@ class FlispPageState extends State<FlispPage> {
|
||||
return buildBody(
|
||||
child: Column(
|
||||
children: [
|
||||
// 选项卡
|
||||
buildStatsCard(_activeFlisps),
|
||||
buildTabs(
|
||||
currentTab: _currentTab,
|
||||
onTabChanged: (value) {
|
||||
@@ -63,10 +63,14 @@ class FlispPageState extends State<FlispPage> {
|
||||
return _activeFlisps.isEmpty
|
||||
? buildEmptyState()
|
||||
: buildFlispList(
|
||||
context: context,
|
||||
flisps: _activeFlisps,
|
||||
onEdit: (flisp) {
|
||||
_showDialog(true, flisp);
|
||||
},
|
||||
onDelete: (flisp) {
|
||||
_deleteFlisp(flisp);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -99,7 +103,6 @@ class FlispPageState extends State<FlispPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 保存待办事项
|
||||
void _saveFlisp(bool isEditing, Flisp flisp) async {
|
||||
late bool isSuccess;
|
||||
if (isEditing) {
|
||||
@@ -118,4 +121,18 @@ class FlispPageState extends State<FlispPage> {
|
||||
showErrorDialog(context, isEditing ? '更新失败' : '添加失败');
|
||||
}
|
||||
}
|
||||
|
||||
void _deleteFlisp(Flisp flisp) async {
|
||||
bool isSuccess = await flispService.deleteFlisp(flisp);
|
||||
|
||||
setState(() {
|
||||
_flisps = flispService.getAllFlisps();
|
||||
});
|
||||
|
||||
if (isSuccess) {
|
||||
showSuccessDialog(context, '删除成功');
|
||||
} else {
|
||||
showErrorDialog(context, '删除失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,7 @@ class TodoPageState extends State<TodoPage> {
|
||||
return buildBody(
|
||||
child: Column(
|
||||
children: [
|
||||
// 统计信息卡片
|
||||
buildStatsCard(_todos),
|
||||
// 选项卡
|
||||
buildTabs(
|
||||
currentTab: _currentTab,
|
||||
onTabChanged: (value) {
|
||||
|
||||
Reference in New Issue
Block a user