收集订正

This commit is contained in:
machuanyu 2024-05-28 16:17:32 +08:00
parent 3dcbf121aa
commit 8874d64281
6 changed files with 482 additions and 387 deletions

View File

@ -92,4 +92,10 @@ abstract class RetrofitClient {
@GET("/api/hms/HmsReport/GetQuestionStudentState")
Future<List<Students>> getQuestionStudentState(@Query('HomeworkId') String homeworkId,@Query('TemplateId') int templateId,@Query('QuestionNo') int questionNo);
//
@POST("/api/hms/Homework/Collect")
Future getCollect(@Field() String homeworkId);
}

View File

@ -69,6 +69,8 @@ class Items extends Object {
@JsonKey(name: 'classCount')
int? classCount;
@JsonKey(name: 'isFixed')
bool? isFixed;
Items(this.id,this.assessType,this.name,this.grade,this.subject,this.publishTime,this.state,this.collectRate,this.questionCount,this.annotateCount,this.annotateRate,this.classes,this.creatorName,this.creationTime,this.classCount);

View File

@ -24,7 +24,9 @@ class KnowledgePointsGraspDetailPage extends StatefulWidget {
class _KnowledgePointsGraspDetailPageState
extends State<KnowledgePointsGraspDetailPage> {
final logic = Get.find<KnowledgePointsGraspDetailLogic>();
final state = Get.find<KnowledgePointsGraspDetailLogic>().state;
final state = Get
.find<KnowledgePointsGraspDetailLogic>()
.state;
@override
Widget build(BuildContext context) {
@ -35,12 +37,15 @@ class _KnowledgePointsGraspDetailPageState
builder: (BuildContext context) {
return AlertDialog(
insetPadding:
EdgeInsets.symmetric(vertical: 55.r, horizontal: 45.r),
EdgeInsets.symmetric(vertical: 55.r, horizontal: 45.r),
contentPadding: EdgeInsets.all(0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15.r))),
content: Container(
width: MediaQuery.of(context).size.width,
width: MediaQuery
.of(context)
.size
.width,
// height: MediaQuery.of(context).size.height,
child: Image.network(imgUrl),
),
@ -54,13 +59,17 @@ class _KnowledgePointsGraspDetailPageState
EasyLoading.dismiss();
}
void showStudent(homeworkId,templateId,questionNo, title) async {
await logic.getStudents(homeworkId,templateId,questionNo);
void showStudent(homeworkId, templateId, questionNo, title) async {
logic.getStudents(homeworkId, templateId, questionNo);
showDialog(
context: context,
builder: (BuildContext context) {
return ShowStudentList(title:title,studentList:state.studentList.value,homeworkId: homeworkId,);
return Obx(() {
return ShowStudentList(title: title,
studentList: state.studentList.value,
homeworkId: homeworkId,);
});
},
);
EasyLoading.dismiss();
@ -101,160 +110,162 @@ class _KnowledgePointsGraspDetailPageState
},
child: state.dataList.isNotEmpty
? ListView.builder(
itemCount: state.dataList.length,
itemBuilder: (context, index) {
KnowledgeReportDetail item = state.dataList[index];
return InkWell(
onTap: () {
/* RouterManager.router.navigateTo(
itemCount: state.dataList.length,
itemBuilder: (context, index) {
KnowledgeReportDetail item = state.dataList[index];
return InkWell(
onTap: () {
/* RouterManager.router.navigateTo(
context,
RouterManager.quickCheckPersonalPath +
'?jobId=${item.jobName}&studentId=$studentId',
transition: getTransition(),
);*/
},
child: Container(
margin: EdgeInsets.symmetric(
vertical: 5.r, horizontal: 14.r),
padding: EdgeInsets.symmetric(
vertical: 14.r, horizontal: 10.r),
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(10.r)),
color: Colors.white),
child: Column(
},
child: Container(
margin: EdgeInsets.symmetric(
vertical: 5.r, horizontal: 14.r),
padding: EdgeInsets.symmetric(
vertical: 14.r, horizontal: 10.r),
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(10.r)),
color: Colors.white),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
item.publishTime.substring(0, 10),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF505050)),
),
SizedBox(
width: 10.r,
),
Expanded(
child: Text(
Text(
item.publishTime.substring(0, 10),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF505050)),
),
SizedBox(
width: 10.r,
),
Expanded(
child: Text(
item.homeworkName,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF505050)),
)),
InkWell(
onTap: () {
EasyLoading.show(status: 'loading...');
showImg(item.questionPicture, context);
},
child: Container(
width: 49.r,
height: 22.r,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(20.r)),
border: Border.all(
width: 1.r,
color: Color(0xFF8B8B8B)),
),
child: Center(
child: Text(
'${item.questionNo}',
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF8B8B8B)),
),
),
InkWell(
onTap: () {
EasyLoading.show(status: 'loading...');
showImg(item.questionPicture, context);
},
child: Container(
width: 49.r,
height: 22.r,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(20.r)),
border: Border.all(
width: 1.r,
color: Color(0xFF8B8B8B)),
),
child: Center(
child: Text(
'${item.questionNo}',
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF8B8B8B)),
),
),
],
),
SizedBox(
height: 10.r,
),
Container(
margin: EdgeInsets.only(top: 8.h),
padding: EdgeInsets.zero,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
InkWell(
onTap: () {
EasyLoading.show(status: 'loading...');
showStudent(
item.homeworkId, item.templateId,item.questionNo,item.homeworkName);
},
child: Container(
margin: EdgeInsets.only(right: 6.r),
width: 56.r,
height: 20.r,
decoration: BoxDecoration(
color: Color(0xFFD4FFED),
borderRadius:
BorderRadius.circular(20.r),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
quickText('正确率',
color: Color(0xFF4CC793),
size: 10.sp),
Image.asset(
'assets/images/icon_back_green.png',
width: 8.r,
height: 8.r,
)
],
)),
),
Expanded(
flex: 1,
child: Container(
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
10.r),
),
child: LinearPercentIndicator(
padding: EdgeInsets.zero,
animation: true,
lineHeight: 8.h,
animationDuration: 2500,
percent:
item.correctRate / 100,
progressColor:
Color(0xFF90E0BE),
backgroundColor:
Color(0xFFE8E8E8),
barRadius:
Radius.circular(10.r),
),
),
),
SizedBox(width: 4.w),
quickText(
'${item.correctRate.toStringAsFixed(0)}%',
size: 10.sp,
color: Color(0xFF606060))
],
),
),
),
],
),
),
/* progressBar(context,
],
),
SizedBox(
height: 10.r,
),
Container(
margin: EdgeInsets.only(top: 8.h),
padding: EdgeInsets.zero,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
InkWell(
onTap: () {
EasyLoading.show(status: 'loading...');
showStudent(
item.homeworkId, item.templateId,
item.questionNo, item.homeworkName);
},
child: Container(
margin: EdgeInsets.only(right: 6.r),
width: 56.r,
height: 20.r,
decoration: BoxDecoration(
color: Color(0xFFD4FFED),
borderRadius:
BorderRadius.circular(20.r),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
quickText('正确率',
color: Color(0xFF4CC793),
size: 10.sp),
Image.asset(
'assets/images/icon_back_green.png',
width: 8.r,
height: 8.r,
)
],
)),
),
Expanded(
flex: 1,
child: Container(
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
10.r),
),
child: LinearPercentIndicator(
padding: EdgeInsets.zero,
animation: true,
lineHeight: 8.h,
animationDuration: 2500,
percent:
item.correctRate / 100,
progressColor:
Color(0xFF90E0BE),
backgroundColor:
Color(0xFFE8E8E8),
barRadius:
Radius.circular(10.r),
),
),
),
SizedBox(width: 4.w),
quickText(
'${item.correctRate.toStringAsFixed(
0)}%',
size: 10.sp,
color: Color(0xFF606060))
],
),
),
),
],
),
),
/* progressBar(context,
title: '正确率 >',
color: Color(0xFF90E0BE),
percent: item.correctRate / 100,
@ -262,11 +273,11 @@ class _KnowledgePointsGraspDetailPageState
marginEdg: EdgeInsets.only(top: 8.h),
studentCall:showStudent(item.questionId,item.jobName),
),*/
],
),
),
);
})
],
),
),
);
})
: const MyEmptyWidget(),
);
}),

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:school_asignment_app/common/job/enum_subject.dart';
@ -36,6 +37,7 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
vsync: this,
);
tabController2 = TabController(length: 4, vsync: this);
EasyLoading.show(status:'loading...');
getList();
}
//
@ -52,6 +54,7 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
state.workList.value = data.items;
refreshController1.finishRefresh();
refreshController2.finishRefresh();
EasyLoading.dismiss();
print('state.workList.length=${state.workList.length}');
}
///
@ -65,6 +68,11 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
getList();
}
void getCollect(item) async{
await getClient().getCollect(item.id);
getList();
}
///
Future<void> onMyLoad(EasyRefreshController controller, int tab) async {
/*params.page++;

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
@ -25,9 +26,7 @@ class ReadOverPage extends StatefulWidget {
class _ReadOverPageState extends State<ReadOverPage> {
final logic = Get.find<ReadOverLogic>();
final state = Get
.find<ReadOverLogic>()
.state;
final state = Get.find<ReadOverLogic>().state;
@override
Widget build(BuildContext context) {
@ -48,10 +47,8 @@ class _ReadOverPageState extends State<ReadOverPage> {
children: <Widget>[
Container(
color: Colors.white,
margin: EdgeInsets.only(top: MediaQuery
.of(context)
.padding
.top),
margin:
EdgeInsets.only(top: MediaQuery.of(context).padding.top),
padding: EdgeInsets.only(bottom: 9.h, top: 4.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -116,7 +113,7 @@ class _ReadOverPageState extends State<ReadOverPage> {
decoration: BoxDecoration(
color: state.tabIndex.value == 0
? const Color.fromRGBO(
255, 255, 255, 1)
255, 255, 255, 1)
: null,
borderRadius: BorderRadius.all(
Radius.circular(8.r)),
@ -124,10 +121,10 @@ class _ReadOverPageState extends State<ReadOverPage> {
child: quickText(
'待批阅',
size: 14.sp,
color: state.tabIndex.value == 0 ? Theme
.of(context)
.primaryColor : const Color.fromRGBO(
80, 94, 110, 1),
color: state.tabIndex.value == 0
? Theme.of(context).primaryColor
: const Color.fromRGBO(
80, 94, 110, 1),
fontWeight: state.tabIndex.value == 0
? FontWeight.bold
: null,
@ -145,7 +142,7 @@ class _ReadOverPageState extends State<ReadOverPage> {
decoration: BoxDecoration(
color: state.tabIndex.value == 1
? const Color.fromRGBO(
255, 255, 255, 1)
255, 255, 255, 1)
: null,
borderRadius: BorderRadius.all(
Radius.circular(8.r)),
@ -153,10 +150,10 @@ class _ReadOverPageState extends State<ReadOverPage> {
child: quickText(
'已批阅',
size: 14.sp,
color: state.tabIndex.value == 1 ? Theme
.of(context)
.primaryColor : const Color.fromRGBO(
80, 94, 110, 1),
color: state.tabIndex.value == 1
? Theme.of(context).primaryColor
: const Color.fromRGBO(
80, 94, 110, 1),
fontWeight: state.tabIndex.value == 1
? FontWeight.bold
: null,
@ -172,10 +169,8 @@ class _ReadOverPageState extends State<ReadOverPage> {
flex: 1,
child: InkWell(
onTap: () {
/* RouterManager.router
.navigateTo(
context, RouterManager.jobStudentGroupPath,
transition: getTransition());*/
Get.toNamed(Routes.studentHistoryWorkPage,
arguments: {'page': 'set'});
},
child: Icon(
const IconData(0xe63e, fontFamily: "AlibabaIcon"),
@ -186,79 +181,83 @@ class _ReadOverPageState extends State<ReadOverPage> {
],
),
),
Obx(() {
return state.tabIndex.value == 1?
JobConditionFilter(
customTimeStr: state.customTimeStr.value,
controller: logic.tabController2,
hasAll:true,
jobType: 1,
customTime: logic.tabController2.index != 3 ||
(logic.params2.startDate == null && logic.params2.endDate == null)
? null
: PickerDateRange(
logic.params2.startDate == null ? null : DateTime.parse(
logic.params2.startDate!),
logic.params2.endDate == null ? null : DateTime.parse(logic.params2.endDate!),
),
onTimeFilter: (String? startTime, String? endTime) {
if (startTime == null && endTime == null &&
logic.tabController2.index == 3) {
logic.tabController2.animateTo(0);
}
logic.params2.endDate = endTime;
logic.params2.startDate = startTime;
state.page = 1;
logic.getList();
// logic.refreshController2.callRefresh();
},
refreshTime: (value) {
if (value != null && value.startDate != null) {
state.customTimeStr.value =
value.startDate?.toString().substring(0, 10) ?? '';
Obx(() {
return state.tabIndex.value == 1
? JobConditionFilter(
customTimeStr: state.customTimeStr.value,
controller: logic.tabController2,
hasAll: true,
jobType: 1,
customTime: logic.tabController2.index != 3 ||
(logic.params2.startDate == null &&
logic.params2.endDate == null)
? null
: PickerDateRange(
logic.params2.startDate == null
? null
: DateTime.parse(
logic.params2.startDate!),
logic.params2.endDate == null
? null
: DateTime.parse(logic.params2.endDate!),
),
onTimeFilter: (String? startTime, String? endTime) {
if (startTime == null &&
endTime == null &&
logic.tabController2.index == 3) {
logic.tabController2.animateTo(0);
}
logic.params2.endDate = endTime;
logic.params2.startDate = startTime;
state.page = 1;
logic.getList();
// logic.refreshController2.callRefresh();
},
refreshTime: (value) {
if (value != null && value.startDate != null) {
state.customTimeStr.value = value.startDate
?.toString()
.substring(0, 10) ??
'';
if (value.endDate != null) {
if (!Utils.isPad() &&
value.startDate!.year == value.endDate!.year) {
state.customTimeStr.value =
'${value.startDate.toString().substring(5, 10)}~${value
.endDate.toString().substring(5, 10)}';
} else {
state.customTimeStr.value =
'${state.customTimeStr.value}~${value.endDate
?.toString()
.substring(
0, 10)}';
}
}
}
}
):Container();
}),
Expanded(
child: Obx(() {
return IndexedStack(
index: state.tabIndex.value,
children: <Widget>[
$easyRefresh(
controller: logic.refreshController1,
tab: 1,
type: state.active,
data: state.workList,
onLoad: logic.onMyLoad,
onRefresh: logic.onMyRefresh,
logic: logic),
$easyRefresh(
controller: logic.refreshController2,
tab: 2,
type: state.active,
data: state.workList,
onLoad: logic.onMyLoad,
onRefresh: logic.onMyRefresh,
logic: logic),
],
);
})),
if (value.endDate != null) {
if (!Utils.isPad() &&
value.startDate!.year ==
value.endDate!.year) {
state.customTimeStr.value =
'${value.startDate.toString().substring(5, 10)}~${value.endDate.toString().substring(5, 10)}';
} else {
state.customTimeStr.value =
'${state.customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}';
}
}
}
})
: Container();
}),
Expanded(child: Obx(() {
return IndexedStack(
index: state.tabIndex.value,
children: <Widget>[
$easyRefresh(
controller: logic.refreshController1,
tab: 1,
type: state.active,
data: state.workList,
onLoad: logic.onMyLoad,
onRefresh: logic.onMyRefresh,
logic: logic),
$easyRefresh(
controller: logic.refreshController2,
tab: 2,
type: state.active,
data: state.workList,
onLoad: logic.onMyLoad,
onRefresh: logic.onMyRefresh,
logic: logic),
],
);
})),
],
);
},
@ -274,17 +273,16 @@ class _ReadOverPageState extends State<ReadOverPage> {
}
}
///
/// OnRefreshCallback? onRefresh
///
@swidget
Widget $easyRefresh({
required EasyRefreshController controller,
required Future<
void> Function(EasyRefreshController controller, int tab) onRefresh,
required Future<
void> Function(EasyRefreshController controller, int tab) onLoad,
required Future<void> Function(EasyRefreshController controller, int tab)
onRefresh,
required Future<void> Function(EasyRefreshController controller, int tab)
onLoad,
required List<Items> data,
required int tab,
required int type,
@ -304,34 +302,35 @@ Widget $easyRefresh({
footer: TaurusFooter(),
child: completed && isPadFlag
? GridView(
padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, //widget
mainAxisSpacing: 10.h,
crossAxisSpacing: 6.w,
childAspectRatio: 1.81 //1widget
),
children: List.generate(data.length, (index) {
Items item = data[index];
String subjectName = EnumUtils.formatSubject(item.subject);
return $reviewedItem(
jobTaskItem: item, type: type, subjectName: subjectName);
}),
)
padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, //widget
mainAxisSpacing: 10.h,
crossAxisSpacing: 6.w,
childAspectRatio: 1.81 //1widget
),
children: List.generate(data.length, (index) {
Items item = data[index];
String subjectName = EnumUtils.formatSubject(item.subject);
return $reviewedItem(
jobTaskItem: item, type: type, subjectName: subjectName,logic: logic);
}),
)
: ListView.builder(
padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
itemBuilder: (context, index) {
Items item = data[index];
return TaskListItem(
completed: completed,
jobTaskItem: item,
type: type,
);
},
itemCount: data.length,
),
padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
itemBuilder: (context, index) {
Items item = data[index];
return TaskListItem(
completed: completed,
jobTaskItem: item,
type: type,
logic: logic,
);
},
itemCount: data.length,
),
onRefresh: () => onRefresh(controller, tab),
onLoad: () => onLoad(controller, tab),
);
@ -340,12 +339,20 @@ Widget $easyRefresh({
@swidget
Widget $reviewedItem(
{required Items jobTaskItem, required int type, required String subjectName}) {
{required Items jobTaskItem,
required int type,
required String subjectName,
required ReadOverLogic logic,}) {
EdgeInsets padEdg = EdgeInsets.symmetric(horizontal: 10.w);
return InkWell(
onTap: () {
Get.toNamed(Routes.annotateClassPage,arguments: {'id':jobTaskItem.id,'name':jobTaskItem.name,'grade':jobTaskItem.grade,'completed':true});
Get.toNamed(Routes.annotateClassPage, arguments: {
'id': jobTaskItem.id,
'name': jobTaskItem.name,
'grade': jobTaskItem.grade,
'completed': true
});
},
child: Container(
padding: EdgeInsets.only(top: 10.h),
@ -387,31 +394,47 @@ Widget $reviewedItem(
),
),
margin: EdgeInsets.only(right: 4.w),
child: quickText(type == 1 ? '作业' : '考试', color: Colors.white,
size: 10.sp),
child: quickText(type == 1 ? '作业' : '考试',
color: Colors.white, size: 10.sp),
),
Expanded(
child: quickText(jobTaskItem.name, size: 14.sp,
child: quickText(jobTaskItem.name,
size: 14.sp,
color: const Color.fromRGBO(70, 70, 70, 1),
maxLines: 2),
)
],
),
),
if(jobTaskItem.isFixed!)
Padding(
padding: padEdg,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
'已订正',
style: TextStyle(
fontSize: 10.sp, color: const Color(0xFFF16262)),
),
],
),
),
Padding(
padding: padEdg,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(
DateTime.parse(jobTaskItem.publishTime).toString().substring(
0, 10),
DateTime.parse(jobTaskItem.publishTime)
.toString()
.substring(0, 10),
color: const Color.fromRGBO(97, 97, 97, 1),
size: 10.sp,
fontWeight: FontWeight.w500,
),
quickText(' / ', color: const Color.fromRGBO(76, 199, 147, 1),
quickText(' / ',
color: const Color.fromRGBO(76, 199, 147, 1),
size: 10.sp,
fontWeight: FontWeight.w500),
quickText(
@ -424,7 +447,8 @@ Widget $reviewedItem(
color: const Color.fromRGBO(76, 199, 147, 1),
size: 10.sp,
),
quickText(' / ', color: const Color.fromRGBO(116, 145, 253, 1),
quickText(' / ',
color: const Color.fromRGBO(116, 145, 253, 1),
size: 10.sp,
fontWeight: FontWeight.w500),
quickText(
@ -443,37 +467,64 @@ Widget $reviewedItem(
margin: EdgeInsets.only(top: 4.h, bottom: 6.h),
),
),*/
GestureDetector(
onTap: () {
Get.toNamed(Routes.jobReportPage,arguments: {'title':jobTaskItem.name,'homeworkId':jobTaskItem.id,'grade':jobTaskItem.grade});
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(6.r),
bottomRight: Radius.circular(6.r)),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.15),
offset: Offset(0, -0.0001), //y轴偏移量
blurRadius: 4, //
spreadRadius: 0, //
)
],
),
child: Row(children: [
Container(
padding: EdgeInsets.symmetric(vertical: 6.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(6.r),
bottomRight: Radius.circular(6.r)),
color: Colors.white,
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.15),
offset: Offset(0, -0.0001), //y轴偏移量
blurRadius: 4, //
spreadRadius: 0, //
)
],
),
child: Row(children: [
if (!jobTaskItem.isFixed!)
Expanded(
flex: 1,
child: InkWell(
onTap: (){
if(!jobTaskItem.isFixed!){
EasyLoading.show(status:'loading...');
logic.getCollect(jobTaskItem);
}
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
right: BorderSide(
width: 1.r, color: const Color(0xFFDCDCDC))),
),
child: quickText('收集订正',
color: const Color(0xFF4CC793), size: 11.sp),
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Get.toNamed(Routes.jobReportPage, arguments: {
'title': jobTaskItem.name,
'homeworkId': jobTaskItem.id,
'grade': jobTaskItem.grade
});
},
child: Container(
alignment: Alignment.center,
child: quickText(
'查看报告', color: const Color.fromRGBO(118, 118, 118, 1),
child: quickText('查看报告',
color: const Color.fromRGBO(118, 118, 118, 1),
size: 11.sp),
),
),
]),
),
),
]),
),
],
),

View File

@ -1,26 +1,30 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:percent_indicator/percent_indicator.dart';
import 'package:school_asignment_app/common/job/work_student.dart';
import 'package:school_asignment_app/common/mixins/request_tool_mixin.dart';
import 'package:school_asignment_app/common/utils/enum_untils.dart';
import 'package:school_asignment_app/common/utils/toast_utils.dart';
import 'package:school_asignment_app/page/global_widget/my_text.dart';
import 'package:school_asignment_app/common/utils/utils.dart';
import 'package:school_asignment_app/page/home_page/children/read_over/read_over_logic.dart';
import 'package:school_asignment_app/routes/app_pages.dart';
class TaskListItem extends StatefulWidget {
final bool completed;
final Items jobTaskItem;
final int type;
final ReadOverLogic logic;
const TaskListItem({Key? key,required this.completed,required this.jobTaskItem,required this.type}) : super(key: key);
const TaskListItem({Key? key,required this.completed,required this.jobTaskItem,required this.type,required this.logic}) : super(key: key);
@override
State<TaskListItem> createState() => _TaskListItemState();
}
class _TaskListItemState extends State<TaskListItem> {
class _TaskListItemState extends State<TaskListItem>{
@override
Widget build(BuildContext context) {
@ -159,94 +163,107 @@ class _TaskListItemState extends State<TaskListItem> {
children: [
Container(
margin: EdgeInsets.only(bottom: 16.h),
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 10.w),
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r),
color: const Color.fromRGBO(255, 255, 255, 1),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(210, 216, 241, 1),
offset: Offset.zero, //y轴偏移量
blurRadius: 5.8, //
spreadRadius: 0, //
)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 30.h),
Container(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 10.w),
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r),
color: const Color.fromRGBO(255, 255, 255, 1),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(210, 216, 241, 1),
offset: Offset.zero, //y轴偏移量
blurRadius: 5.8, //
spreadRadius: 0, //
)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: Utils.isPad() ? 32.w : 38.w,
height: 18.h,
alignment: Alignment.center,
padding: EdgeInsets.only(left: Utils.isPad() ? 2.w : 3.w),
decoration: BoxDecoration(
color: widget.type == 1
? const Color.fromRGBO(104, 136, 253, 1)
: const Color.fromRGBO(255, 175, 56, 1),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(14.r),
topRight: Radius.circular(3.r),
bottomLeft: Radius.circular(4.r),
bottomRight: Radius.circular(4.r),
),
),
margin: EdgeInsets.only(right: 4.w),
child: quickText(widget.type == 1?'作业':'考试', color: Colors.white, size: 10.sp),
),
Expanded(
child: quickText(
widget.jobTaskItem.name,
maxLines: 2,
size: Utils.isPad() ? 14.sp : 16.sp,
color: const Color.fromRGBO(70, 70, 70, 1),
fontWeight: FontWeight.bold,
),
)
],
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: Utils.isPad() ? 32.w : 38.w,
height: 18.h,
alignment: Alignment.center,
padding: EdgeInsets.only(left: Utils.isPad() ? 2.w : 3.w),
decoration: BoxDecoration(
color: widget.type == 1
? const Color.fromRGBO(104, 136, 253, 1)
: const Color.fromRGBO(255, 175, 56, 1),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(14.r),
topRight: Radius.circular(3.r),
bottomLeft: Radius.circular(4.r),
bottomRight: Radius.circular(4.r),
),
),
SizedBox(height: 10.h),
Row(
margin: EdgeInsets.only(right: 4.w),
child: quickText(widget.type == 1?'作业':'考试', color: Colors.white, size: 10.sp),
),
Expanded(
child: quickText(
widget.jobTaskItem.name,
maxLines: 2,
size: Utils.isPad() ? 14.sp : 16.sp,
color: const Color.fromRGBO(70, 70, 70, 1),
fontWeight: FontWeight.bold,
),
)
],
),
SizedBox(height: 10.h),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(
EnumUtils.formatSubject(widget.jobTaskItem.subject),
color: const Color.fromRGBO(97, 97, 97, 1),
size: 12.sp,
),
quickText(' / ',
color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText('题量:', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp),
quickText(
EnumUtils.formatSubject(widget.jobTaskItem.subject),
'10',
color: const Color.fromRGBO(97, 97, 97, 1),
size: 12.sp,
size: 13.sp,
),
quickText(' / ',
color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText('题量:', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp),
quickText(
'10',
color: const Color.fromRGBO(97, 97, 97, 1),
size: 13.sp,
),
],
),
),
quickText(' / ',
color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
quickText(DateTime.parse(widget.jobTaskItem.publishTime).toString().substring(0,10),
color: const Color.fromRGBO(97, 97, 97, 1), size: 12.sp),
],
),
// FavoriteButton(jobTaskItem.id, jobTaskItem.title),
],
),
quickText(' / ',
color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
quickText(DateTime.parse(widget.jobTaskItem.publishTime).toString().substring(0,10),
color: const Color.fromRGBO(97, 97, 97, 1), size: 12.sp),
],
),
SizedBox(height: 10.h),
InkWell(
onTap: (){
if(!widget.jobTaskItem.isFixed!){
EasyLoading.show(status:'loading...');
widget.logic.getCollect(widget.jobTaskItem);
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 4.r,horizontal: 20.r),
decoration: BoxDecoration(
color: widget.jobTaskItem.isFixed!?Color(0xFFF4F4F4):Color(0xFFF2FFFA),
border: Border.all(width: 1.r,color:widget.jobTaskItem.isFixed!?Colors.transparent:Color(0xFF4CC793)),
borderRadius: BorderRadius.all(Radius.circular(20.r)),
),
child: Text(widget.jobTaskItem.isFixed!?'已订正':'收集订正',style: TextStyle(fontSize: 10.sp,color: const Color(0xFF4CC793)),),
),
),
// FavoriteButton(jobTaskItem.id, jobTaskItem.title),
],
),
),