1.全部完成后,修改对话内容

This commit is contained in:
zhutao
2025-09-24 11:34:55 +08:00
parent ca376d9393
commit 70479542a5
3 changed files with 76 additions and 67 deletions

View File

@@ -17,8 +17,7 @@ class _DoneStampState extends State<DoneStamp> {
return Consumer<PlanDetailStore>( return Consumer<PlanDetailStore>(
builder: (context, store, _) { builder: (context, store, _) {
//是否全部完成 //是否全部完成
bool allDone = store.planDetail.stepsList.every((item) => item.stepStatus == 2); if (!store.isAllDone() ) {
if (!allDone || store.planDetail.stepsList.isEmpty) {
return Container(); return Container();
} }
return Align( return Align(

View File

@@ -46,6 +46,11 @@ class PlanDetailStore extends ChangeNotifier {
///计划详情 ///计划详情
PlanDetailDto planDetail = PlanDetailDto(summary: "Plan Details"); PlanDetailDto planDetail = PlanDetailDto(summary: "Plan Details");
///是否全部完成
bool isAllDone() =>
planDetail.stepsList.isNotEmpty &&
planDetail.stepsList.every((item) => item.stepStatus == 2);
///是否正在编辑 ///是否正在编辑
bool isEdit = false; bool isEdit = false;
@@ -56,7 +61,7 @@ class PlanDetailStore extends ChangeNotifier {
} }
///流请求工具 ///流请求工具
StreamUtils streamUtils = StreamUtils(); final StreamUtils _streamUtils = StreamUtils();
///创建计划 ///创建计划
void createPlan() async { void createPlan() async {
@@ -65,7 +70,7 @@ class PlanDetailStore extends ChangeNotifier {
///生成摘要--------------------------- ///生成摘要---------------------------
String summary = ""; String summary = "";
streamUtils.sendStream( _streamUtils.sendStream(
"/plan/make_summary", "/plan/make_summary",
data: {"plan_id": planId}, data: {"plan_id": planId},
onCall: (chunk) { onCall: (chunk) {
@@ -79,7 +84,7 @@ class PlanDetailStore extends ChangeNotifier {
/// 生成对白------------------------------- /// 生成对白-------------------------------
String dialog = ""; String dialog = "";
await streamUtils.sendStream( await _streamUtils.sendStream(
"/plan/make_dialog", "/plan/make_dialog",
data: {"plan_id": planId}, data: {"plan_id": planId},
onCall: (chunk) { onCall: (chunk) {
@@ -92,7 +97,7 @@ class PlanDetailStore extends ChangeNotifier {
); );
/// 生成步骤------------------------------- /// 生成步骤-------------------------------
await streamUtils.sendStream( await _streamUtils.sendStream(
"/plan/make_step", "/plan/make_step",
data: {"plan_id": planId}, data: {"plan_id": planId},
onCall: (chunk) { onCall: (chunk) {
@@ -115,7 +120,7 @@ class PlanDetailStore extends ChangeNotifier {
); );
/// 生成步骤解释 ------------------------------- /// 生成步骤解释 -------------------------------
await streamUtils.sendStream( await _streamUtils.sendStream(
"/plan/make_step_explain", "/plan/make_step_explain",
data: { data: {
"plan_id": planId, "plan_id": planId,
@@ -137,7 +142,7 @@ class PlanDetailStore extends ChangeNotifier {
); );
/// 生成建议 ------------------ /// 生成建议 ------------------
await streamUtils.sendStream( await _streamUtils.sendStream(
"/plan/make_suggestion", "/plan/make_suggestion",
data: { data: {
"plan_id": planId, "plan_id": planId,

View File

@@ -78,6 +78,9 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Selector<PlanDetailStore, bool>(
selector: (_, store) => store.isAllDone(),
builder: (context, isAllDone, _) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30), padding: const EdgeInsets.symmetric(horizontal: 30),
child: Transform.translate( child: Transform.translate(
@@ -101,7 +104,7 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
border: Border.all(color: Colors.black, width: 1), border: Border.all(color: Colors.black, width: 1),
), ),
child: Text( child: Text(
_dialog, isAllDone ? "🎉 Great — youve completed everything! 🎉" : _dialog,
style: TextStyle(fontSize: 12), style: TextStyle(fontSize: 12),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@@ -146,6 +149,8 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
), ),
), ),
); );
},
);
} }
} }