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,73 +78,78 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Selector<PlanDetailStore, bool>(
padding: const EdgeInsets.symmetric(horizontal: 30), selector: (_, store) => store.isAllDone(),
child: Transform.translate( builder: (context, isAllDone, _) {
offset: Offset(0, 50), return Padding(
child: Column( padding: const EdgeInsets.symmetric(horizontal: 30),
children: [ child: Transform.translate(
BothSizeTransition( offset: Offset(0, 50),
animation: _animation, child: Column(
offset: Offset(50, 50), children: [
child: Container( BothSizeTransition(
padding: EdgeInsets.only(bottom: 10), animation: _animation,
child: InkWell( offset: Offset(50, 50),
onTap: _toggleShow, child: Container(
child: Stack( padding: EdgeInsets.only(bottom: 10),
children: [ child: InkWell(
Container( onTap: _toggleShow,
width: double.infinity, child: Stack(
padding: EdgeInsets.all(4), children: [
decoration: BoxDecoration( Container(
borderRadius: BorderRadius.circular(3), width: double.infinity,
border: Border.all(color: Colors.black, width: 1), padding: EdgeInsets.all(4),
), decoration: BoxDecoration(
child: Text( borderRadius: BorderRadius.circular(3),
_dialog, border: Border.all(color: Colors.black, width: 1),
style: TextStyle(fontSize: 12), ),
textAlign: TextAlign.center, child: Text(
), isAllDone ? "🎉 Great — youve completed everything! 🎉" : _dialog,
style: TextStyle(fontSize: 12),
textAlign: TextAlign.center,
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: CustomPaint(
painter: BubblePainter(),
),
),
],
), ),
),
),
),
SizedBox(
width: double.infinity,
child: Stack(
alignment: Alignment.bottomCenter,
children: [
Image.asset("assets/image/kbn.png", height: 100),
Positioned( Positioned(
bottom: 0, top: 20,
left: 0, child: Transform.translate(
right: 0, offset: Offset(40, -10),
child: CustomPaint( child: GestureDetector(
painter: BubblePainter(), onTap: _toggleShow,
child: BothSizeTransition(
animation: ReverseAnimation(_animation),
offset: Offset(-50, -50),
child: Icon(RemixIcons.message_2_line),
),
),
), ),
), ),
], ],
), ),
), ),
), ],
), ),
SizedBox( ),
width: double.infinity, );
child: Stack( },
alignment: Alignment.bottomCenter,
children: [
Image.asset("assets/image/kbn.png", height: 100),
Positioned(
top: 20,
child: Transform.translate(
offset: Offset(40, -10),
child: GestureDetector(
onTap: _toggleShow,
child: BothSizeTransition(
animation: ReverseAnimation(_animation),
offset: Offset(-50, -50),
child: Icon(RemixIcons.message_2_line),
),
),
),
),
],
),
),
],
),
),
); );
} }
} }