文案ok
This commit is contained in:
@@ -8,11 +8,11 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
///构造函数
|
||||
PlanDetailStore({
|
||||
this.planContent = "",
|
||||
this.planId = "",
|
||||
required this.planId,
|
||||
required this.scrollController,
|
||||
}) {
|
||||
//如果没有id进行初始化
|
||||
if (planId == "0") {
|
||||
if (planId == 0) {
|
||||
createPlan();
|
||||
} else {
|
||||
//获取详情
|
||||
@@ -37,10 +37,10 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
String planContent = "";
|
||||
|
||||
///计划id
|
||||
String planId = "";
|
||||
int planId;
|
||||
|
||||
///计划详情
|
||||
PlanDetailDto planDetail = PlanDetailDto(summary: "计划详情");
|
||||
PlanDetailDto planDetail = PlanDetailDto(summary: "Plan Details");
|
||||
|
||||
///是否正在编辑
|
||||
bool isEdit = false;
|
||||
@@ -57,7 +57,7 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
///创建计划
|
||||
void createPlan() async {
|
||||
var id = await initPlanApi(planContent, 1);
|
||||
planId = id.toString();
|
||||
planId = id;
|
||||
|
||||
///生成摘要---------------------------
|
||||
String summary = "";
|
||||
@@ -162,7 +162,8 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
steps: planDetail.stepsList,
|
||||
suggestions: planDetail.suggestionsList,
|
||||
);
|
||||
EasyLoading.showToast("计划创建成功");
|
||||
await getPlanDetail();
|
||||
EasyLoading.showToast("Plan created!");
|
||||
}
|
||||
|
||||
///获取详情
|
||||
@@ -176,4 +177,13 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
updater(planDetail);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
///更新步骤
|
||||
void updateStep(PlanStepDto newStep) {
|
||||
final int index = planDetail.stepsList.indexWhere((e) => e.id == newStep.id);
|
||||
if (index != -1) {
|
||||
planDetail.stepsList[index] = newStep; // 引用变了 → 框架感知
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user