1
This commit is contained in:
@@ -14,7 +14,7 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
//如果没有id进行初始化
|
||||
if (planId == "0") {
|
||||
createPlan();
|
||||
}else{
|
||||
} else {
|
||||
//获取详情
|
||||
getPlanDetail();
|
||||
}
|
||||
@@ -42,6 +42,15 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
///计划详情
|
||||
PlanDetailDto planDetail = PlanDetailDto(summary: "计划详情");
|
||||
|
||||
///是否正在编辑
|
||||
bool isEdit = false;
|
||||
|
||||
///切换编辑模式
|
||||
void setEdit(bool value) {
|
||||
isEdit = value;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///流请求工具
|
||||
StreamUtils streamUtils = StreamUtils();
|
||||
|
||||
@@ -49,7 +58,6 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
void createPlan() async {
|
||||
var id = await initPlanApi(planContent, 1);
|
||||
planId = id.toString();
|
||||
// planId = "3";
|
||||
|
||||
///生成摘要---------------------------
|
||||
String summary = "";
|
||||
@@ -92,9 +100,12 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
.where((e) => e.contains("[NEXT]"))
|
||||
.map((e) => e.replaceAll("[NEXT]", "").trim())
|
||||
.toList();
|
||||
|
||||
// 直接覆盖 stepsList
|
||||
planDetail.stepsList = sentences.map((s) => PlanStepDto(stepContent: s)).toList();
|
||||
planDetail.stepsList = sentences
|
||||
.asMap()
|
||||
.entries
|
||||
.map((e) => PlanStepDto(id: e.key, stepContent: e.value))
|
||||
.toList();
|
||||
notifyListeners();
|
||||
},
|
||||
);
|
||||
@@ -159,4 +170,10 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
planDetail = await getPlanDetailApi(planId);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///更新计划详情
|
||||
void updatePlanDetail(void Function(PlanDetailDto dto) updater) {
|
||||
updater(planDetail);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user