This commit is contained in:
zhutao
2025-09-09 14:07:38 +08:00
parent 71aa4a6790
commit 900dc025d7
24 changed files with 383 additions and 91 deletions

View File

@@ -36,13 +36,11 @@ class _PlanHistoryPageState extends State<PlanHistoryPage> {
});
}
///确认删除
void _confirmDelete(int id) {
setState(() {
_record.removeWhere((element) => element.id == id);
});
}
@override
@@ -50,7 +48,7 @@ class _PlanHistoryPageState extends State<PlanHistoryPage> {
return CupertinoPageScaffold(
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
navigationBar: CupertinoNavigationBar(
middle: const Text("计划历史"),
middle: const Text("Plan History"),
),
child: SafeArea(
child: CustomScrollView(
@@ -77,6 +75,7 @@ class _PlanHistoryPageState extends State<PlanHistoryPage> {
item: _record[index],
showDelete: _isDelete,
onDelete: _confirmDelete,
onInit: _onRefresh,
);
},
separatorBuilder: (BuildContext context, int index) {

View File

@@ -5,7 +5,6 @@ import 'package:plan/api/dto/plan_item_dto.dart';
import 'package:plan/api/endpoints/plan_api.dart';
import 'package:plan/router/config/route_paths.dart';
import 'package:plan/utils/format.dart';
import 'package:plan/widgets/business/delete_row_item.dart';
import 'package:remixicon/remixicon.dart';
import '../../widgets/edit_desc_dialog.dart';
@@ -14,12 +13,14 @@ class HistoryItem extends StatefulWidget {
final PlanItemDto item;
final bool showDelete;
final Function(int) onDelete;
final Function() onInit;
const HistoryItem({
super.key,
required this.item,
this.showDelete = false,
required this.onDelete,
required this.onInit,
});
@override
@@ -46,8 +47,9 @@ class _HistoryItemState extends State<HistoryItem> {
}
///跳转详情
void _goDetail() {
context.push(RoutePaths.planDetail(_data.id));
void _goDetail() async{
await context.push(RoutePaths.planDetail(_data.id));
widget.onInit();
}
///编辑摘要
@@ -75,6 +77,7 @@ class _HistoryItemState extends State<HistoryItem> {
@override
Widget build(BuildContext context) {
return CupertinoContextMenu(
enableHapticFeedback: true,
actions: [
// 编辑摘要
CupertinoContextMenuAction(