1.全部完成后,修改对话内容
This commit is contained in:
@@ -17,8 +17,7 @@ class _DoneStampState extends State<DoneStamp> {
|
||||
return Consumer<PlanDetailStore>(
|
||||
builder: (context, store, _) {
|
||||
//是否全部完成
|
||||
bool allDone = store.planDetail.stepsList.every((item) => item.stepStatus == 2);
|
||||
if (!allDone || store.planDetail.stepsList.isEmpty) {
|
||||
if (!store.isAllDone() ) {
|
||||
return Container();
|
||||
}
|
||||
return Align(
|
||||
|
||||
@@ -46,6 +46,11 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
///计划详情
|
||||
PlanDetailDto planDetail = PlanDetailDto(summary: "Plan Details");
|
||||
|
||||
///是否全部完成
|
||||
bool isAllDone() =>
|
||||
planDetail.stepsList.isNotEmpty &&
|
||||
planDetail.stepsList.every((item) => item.stepStatus == 2);
|
||||
|
||||
///是否正在编辑
|
||||
bool isEdit = false;
|
||||
|
||||
@@ -56,7 +61,7 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
}
|
||||
|
||||
///流请求工具
|
||||
StreamUtils streamUtils = StreamUtils();
|
||||
final StreamUtils _streamUtils = StreamUtils();
|
||||
|
||||
///创建计划
|
||||
void createPlan() async {
|
||||
@@ -65,7 +70,7 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
|
||||
///生成摘要---------------------------
|
||||
String summary = "";
|
||||
streamUtils.sendStream(
|
||||
_streamUtils.sendStream(
|
||||
"/plan/make_summary",
|
||||
data: {"plan_id": planId},
|
||||
onCall: (chunk) {
|
||||
@@ -79,7 +84,7 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
|
||||
/// 生成对白-------------------------------
|
||||
String dialog = "";
|
||||
await streamUtils.sendStream(
|
||||
await _streamUtils.sendStream(
|
||||
"/plan/make_dialog",
|
||||
data: {"plan_id": planId},
|
||||
onCall: (chunk) {
|
||||
@@ -92,7 +97,7 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
);
|
||||
|
||||
/// 生成步骤-------------------------------
|
||||
await streamUtils.sendStream(
|
||||
await _streamUtils.sendStream(
|
||||
"/plan/make_step",
|
||||
data: {"plan_id": planId},
|
||||
onCall: (chunk) {
|
||||
@@ -115,7 +120,7 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
);
|
||||
|
||||
/// 生成步骤解释 -------------------------------
|
||||
await streamUtils.sendStream(
|
||||
await _streamUtils.sendStream(
|
||||
"/plan/make_step_explain",
|
||||
data: {
|
||||
"plan_id": planId,
|
||||
@@ -137,7 +142,7 @@ class PlanDetailStore extends ChangeNotifier {
|
||||
);
|
||||
|
||||
/// 生成建议 ------------------
|
||||
await streamUtils.sendStream(
|
||||
await _streamUtils.sendStream(
|
||||
"/plan/make_suggestion",
|
||||
data: {
|
||||
"plan_id": planId,
|
||||
|
||||
@@ -78,73 +78,78 @@ class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateM
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, 50),
|
||||
child: Column(
|
||||
children: [
|
||||
BothSizeTransition(
|
||||
animation: _animation,
|
||||
offset: Offset(50, 50),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(bottom: 10),
|
||||
child: InkWell(
|
||||
onTap: _toggleShow,
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
border: Border.all(color: Colors.black, width: 1),
|
||||
),
|
||||
child: Text(
|
||||
_dialog,
|
||||
style: TextStyle(fontSize: 12),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
return Selector<PlanDetailStore, bool>(
|
||||
selector: (_, store) => store.isAllDone(),
|
||||
builder: (context, isAllDone, _) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, 50),
|
||||
child: Column(
|
||||
children: [
|
||||
BothSizeTransition(
|
||||
animation: _animation,
|
||||
offset: Offset(50, 50),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(bottom: 10),
|
||||
child: InkWell(
|
||||
onTap: _toggleShow,
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
border: Border.all(color: Colors.black, width: 1),
|
||||
),
|
||||
child: Text(
|
||||
isAllDone ? "🎉 Great — you’ve 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(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: CustomPaint(
|
||||
painter: BubblePainter(),
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user