This commit is contained in:
zhutao
2025-09-09 17:57:02 +08:00
parent ccb7d5bb24
commit 3df6e3d49e
22 changed files with 63 additions and 44 deletions

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:plan/page/plan/detail/viewmodel/plan_detail_store.dart';
import 'package:provider/provider.dart';
class DoneStamp extends StatefulWidget {
const DoneStamp({super.key});
@@ -10,30 +12,39 @@ class DoneStamp extends StatefulWidget {
class _DoneStampState extends State<DoneStamp> {
@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment(0.7, -0.3),
child: Transform.rotate(
angle: -0.4,
child: Container(
padding: EdgeInsets.symmetric(vertical: 3, horizontal: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(color: Colors.red, width: 5),
),
child: DefaultTextStyle(
style: TextStyle(color: Colors.red),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Completed",
style: TextStyle(fontWeight: FontWeight.w700),
return Consumer<PlanDetailStore>(
builder: (context, store, _) {
//是否全部完成
bool allDone = store.planDetail.stepsList.every((item) => item.stepStatus == 2);
if (!allDone || store.planDetail.stepsList.isEmpty) {
return Container();
}
return Align(
alignment: Alignment(0.7, -0.3),
child: Transform.rotate(
angle: -0.4,
child: Container(
padding: EdgeInsets.symmetric(vertical: 3, horizontal: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
border: Border.all(color: Colors.red, width: 5),
),
child: DefaultTextStyle(
style: TextStyle(color: Colors.red),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Completed",
style: TextStyle(fontWeight: FontWeight.w700),
),
],
),
],
),
),
),
),
),
);
},
);
}
}

View File

@@ -162,6 +162,7 @@ class PlanDetailStore extends ChangeNotifier {
steps: planDetail.stepsList,
suggestions: planDetail.suggestionsList,
);
planContent = "";
await getPlanDetail();
EasyLoading.showToast("Plan created!");
}

View File

@@ -12,24 +12,28 @@ class CoachMessage extends StatefulWidget {
class _CoachMessageState extends State<CoachMessage> {
@override
Widget build(BuildContext context) {
var store = context.read<PlanDetailStore>();
if (store.planContent.isEmpty) {
return SizedBox();
}
return Container(
padding: EdgeInsets.all(20),
child: Column(
children: [
Text(
"Organizing your plan…",
style: Theme.of(context).textTheme.bodyMedium,
return Selector<PlanDetailStore, String>(
selector: (_, store) => store.planContent,
builder: (context, planContent, _) {
if (planContent.isEmpty) {
return SizedBox();
}
return Container(
padding: EdgeInsets.all(20),
child: Column(
children: [
Text(
"Organizing your plan…",
style: Theme.of(context).textTheme.bodyMedium,
),
Text(
'"$planContent"',
style: Theme.of(context).textTheme.titleMedium,
),
],
),
Text(
'"${store.planContent}"',
style: Theme.of(context).textTheme.titleMedium,
),
],
),
);
},
);
}
}