You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
5.3 KiB
164 lines
5.3 KiB
import 'package:dating_touchme_app/controller/discover/room_controller.dart';
|
|
import 'package:dating_touchme_app/extension/ex_widget.dart';
|
|
import 'package:dating_touchme_app/model/discover/task_data.dart';
|
|
import 'package:dating_touchme_app/pages/discover/task_detail.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
|
|
|
class TodayTaskDialog extends StatefulWidget {
|
|
const TodayTaskDialog({super.key});
|
|
|
|
@override
|
|
State<TodayTaskDialog> createState() => _TodayTaskDialogState();
|
|
}
|
|
|
|
class _TodayTaskDialogState extends State<TodayTaskDialog> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
final roomController = Get.find<RoomController>();
|
|
return ClipRRect(
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(9.w)),
|
|
child: Material(
|
|
color: Colors.white,
|
|
child: Container(
|
|
width: 375.w,
|
|
height: 336.w,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
Color.fromRGBO(236, 224, 255, 1), // 0%
|
|
Color.fromRGBO(247, 247, 247, 1), // 100%
|
|
],
|
|
),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
SizedBox(
|
|
height: 77.w,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Container(
|
|
width: 68.w,
|
|
padding: EdgeInsets.only(left: 15.w),
|
|
alignment: Alignment.centerLeft,
|
|
child: Icon(
|
|
Icons.keyboard_arrow_left,
|
|
size: 26.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1),
|
|
),
|
|
),
|
|
Text(
|
|
"今日任务",
|
|
style: TextStyle(
|
|
fontSize: 21.w,
|
|
fontWeight: FontWeight.w700
|
|
),
|
|
),
|
|
Container(
|
|
width: 68.w,
|
|
height: 22.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.horizontal(left: Radius.circular(22.w)),
|
|
color: Colors.white
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"任务详情",
|
|
style: TextStyle(
|
|
fontSize: 12.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1)
|
|
),
|
|
),
|
|
),
|
|
).onTap(() async {
|
|
// 隐藏键盘
|
|
FocusScope.of(context).unfocus();
|
|
// 隐藏 overlay
|
|
await roomController.getTaskTemplateData();
|
|
await SmartDialog.dismiss();
|
|
Get.to(() => TaskDetail());
|
|
})
|
|
],
|
|
),
|
|
),
|
|
SingleChildScrollView(
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w),
|
|
child: Column(
|
|
children: [
|
|
...roomController.taskData.value.subList!.map((e){
|
|
return TaskItem(item: e,);
|
|
})
|
|
],
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
class TaskItem extends StatefulWidget {
|
|
final SubList item;
|
|
const TaskItem({super.key, required this.item});
|
|
|
|
@override
|
|
State<TaskItem> createState() => _TaskItemState();
|
|
}
|
|
|
|
class _TaskItemState extends State<TaskItem> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: 350.w,
|
|
margin: EdgeInsets.only(bottom: 10.w),
|
|
padding: EdgeInsets.only(
|
|
top: 15.w,
|
|
right: 10.w,
|
|
bottom: 21.w,
|
|
left: 12.w
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
widget.item.subTaskDesc ?? "",
|
|
style: TextStyle(
|
|
fontSize: 14.w
|
|
),
|
|
),
|
|
Text(
|
|
"${widget.item.completeCount ?? ""}/${widget.item.requiredCount ?? ""}${widget.item.sort == 1 ? "分钟" : widget.item.sort == 2 ? "对" : "人"}",
|
|
style: TextStyle(
|
|
fontSize: 12.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1)
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(height: 10.w,),
|
|
TDProgress(
|
|
type: TDProgressType.linear,
|
|
value: ((widget.item.completeCount ?? 0) / (widget.item.requiredCount ?? 0)),
|
|
strokeWidth: 6,
|
|
progressLabelPosition: TDProgressLabelPosition.inside,
|
|
showLabel: false,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|