列表页面完成

This commit is contained in:
1147192855@qq.com 2024-03-08 10:49:16 +08:00
parent e1db8ae9b9
commit ff1b70d39d
4 changed files with 1171 additions and 467 deletions

View File

@ -147,7 +147,7 @@ Widget $completedHomeworkView(BuildContext context,
{required JobTaskItem jobTaskItem, required ShowStudentsCall showStudentsCall}) { {required JobTaskItem jobTaskItem, required ShowStudentsCall showStudentsCall}) {
return Container( return Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 10.w), padding: EdgeInsets.only(top: 20.h),
margin: EdgeInsets.only(bottom: 12.h), margin: EdgeInsets.only(bottom: 12.h),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r), borderRadius: BorderRadius.circular(6.r),
@ -164,109 +164,134 @@ Widget $completedHomeworkView(BuildContext context,
child: Column( child: Column(
children: [ children: [
// //
Row( Padding(
children: [ padding: EdgeInsets.symmetric(horizontal: 10.w),
Container(
width: 32.w,
height: 18.h,
alignment: Alignment.center,
padding: EdgeInsets.only(left: 2.w),
decoration: BoxDecoration(
color: Color.fromRGBO(104, 136, 253, 1),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(18.r),
topRight: Radius.circular(3.r),
bottomLeft: Radius.circular(4.r),
bottomRight: Radius.circular(4.r),
),
),
margin: EdgeInsets.only(right: 4.w),
child: quickText('作业', color: Colors.white, size: 10.sp),
),
quickText(
jobTaskItem.title,
size: 16.sp,
color: Color.fromRGBO(70, 70, 70, 1),
fontWeight: FontWeight.bold,
)
],
),
SizedBox(height: 12.h),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(
jobTaskItem.subjectName,
color: Color.fromRGBO(97, 97, 97, 1),
size: 14.sp,
fontWeight: FontWeight.w600,
),
quickText(' / ', color: Color.fromRGBO(130, 130, 130, 1), size: 12.sp, fontWeight: FontWeight.w500),
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText('题量:', color: Color.fromRGBO(130, 130, 130, 1), size: 13.sp),
quickText(
jobTaskItem.totalCount,
color: Color.fromRGBO(97, 97, 97, 1),
size: 14.sp,
fontWeight: FontWeight.w500,
),
],
),
),
quickText(' / ', color: Color.fromRGBO(130, 130, 130, 1), size: 12.sp, fontWeight: FontWeight.w500),
quickText(
jobTaskItem.createTime.substring(0, 16),
color: Color.fromRGBO(97, 97, 97, 1),
size: 14.sp,
fontWeight: FontWeight.w500,
),
],
),
SizedBox(height: 20.h),
$CompletedHomeworkInfoBox(
segmentation: false,
showStudentsCall: showStudentsCall,
unsubmittedQuantity: jobTaskItem.studentCount - jobTaskItem.commitStudentCount,
submittedQuantity: jobTaskItem.commitStudentCount,
precision: jobTaskItem.precision / 100,
objectivePrecision: jobTaskItem.objectivePrecision / 100,
subjectivePrecision: jobTaskItem.subjectivePrecision / 100,
),
InkWell(
onTap: () {
RouterManager.router.navigateTo(
context,
RouterManager.jobReportPagePath + '?title=${Uri.encodeComponent(jobTaskItem.title)}&id=${jobTaskItem.id}',
transition: getTransition(),
);
},
child: Row( child: Row(
children: [ children: [
Expanded(flex: 1, child: SizedBox()), Container(
Expanded( width: 32.w,
flex: 9, height: 18.h,
child: Container( alignment: Alignment.center,
alignment: Alignment.center, padding: EdgeInsets.only(left: 2.w),
margin: EdgeInsets.only(top: 20.h), decoration: BoxDecoration(
padding: EdgeInsets.symmetric(vertical: 7.h), color: Color.fromRGBO(104, 136, 253, 1),
decoration: BoxDecoration( borderRadius: BorderRadius.only(
borderRadius: BorderRadius.circular(20), topLeft: Radius.circular(18.r),
gradient: LinearGradient( topRight: Radius.circular(3.r),
begin: Alignment.centerLeft, bottomLeft: Radius.circular(4.r),
end: Alignment.centerRight, bottomRight: Radius.circular(4.r),
colors: [Color.fromRGBO(95, 197, 255, 1), Color.fromRGBO(61, 68, 255, 0.82)],
),
), ),
child: quickText('查看报告', color: Colors.white, size: 12.sp),
), ),
margin: EdgeInsets.only(right: 4.w),
child: quickText('作业', color: Colors.white, size: 10.sp),
), ),
Expanded(flex: 1, child: SizedBox()), quickText(
jobTaskItem.title,
size: 16.sp,
color: Color.fromRGBO(70, 70, 70, 1),
fontWeight: FontWeight.bold,
)
], ],
), ),
) ),
SizedBox(height: 12.h),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(
jobTaskItem.createTime.substring(0, 10),
color: Color.fromRGBO(97, 97, 97, 1),
size: 14.sp,
fontWeight: FontWeight.w500,
),
quickText(' / ', color: Color.fromRGBO(76, 199, 147, 1), size: 12.sp, fontWeight: FontWeight.w500),
quickText(
'参与班级:字段待定',
color: Color.fromRGBO(76, 199, 147, 1),
size: 12.sp,
fontWeight: FontWeight.w600,
),
quickText(' / ', color: Color.fromRGBO(116, 145, 253, 1), size: 12.sp, fontWeight: FontWeight.w500),
quickText(
'科目:' + jobTaskItem.subjectName,
color: Color.fromRGBO(116, 145, 253, 1),
size: 12.sp,
fontWeight: FontWeight.w600,
),
],
),
),
SizedBox(height: 20.h),
Container(
padding: EdgeInsets.symmetric(vertical: 8.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), bottomRight: Radius.circular(6.r)),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color.fromRGBO(0, 0, 0, 0.15),
offset: Offset(0, -0.0001), //y轴偏移量
blurRadius: 4, //
spreadRadius: 0, //
)
],
),
child: Row(children: [
Expanded(
child: InkWell(
onTap: () => easyThrottle('go_to_homework_report', () => {}),
child: Container(
alignment: Alignment.center,
child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp),
),
)),
]),
),
// $CompletedHomeworkInfoBox(
// segmentation: false,
// showStudentsCall: showStudentsCall,
// unsubmittedQuantity: jobTaskItem.studentCount - jobTaskItem.commitStudentCount,
// submittedQuantity: jobTaskItem.commitStudentCount,
// precision: jobTaskItem.precision / 100,
// objectivePrecision: jobTaskItem.objectivePrecision / 100,
// subjectivePrecision: jobTaskItem.subjectivePrecision / 100,
// ),
// InkWell(
// onTap: () {
// RouterManager.router.navigateTo(
// context,
// RouterManager.jobReportPagePath + '?title=${Uri.encodeComponent(jobTaskItem.title)}&id=${jobTaskItem.id}',
// transition: getTransition(),
// );
// },
// child: Row(
// children: [
// Expanded(flex: 1, child: SizedBox()),
// Expanded(
// flex: 9,
// child: Container(
// alignment: Alignment.center,
// margin: EdgeInsets.only(top: 20.h),
// padding: EdgeInsets.symmetric(vertical: 7.h),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(20),
// gradient: LinearGradient(
// begin: Alignment.centerLeft,
// end: Alignment.centerRight,
// colors: [Color.fromRGBO(95, 197, 255, 1), Color.fromRGBO(61, 68, 255, 0.82)],
// ),
// ),
// child: quickText('查看报告', color: Colors.white, size: 12.sp),
// ),
// ),
// Expanded(flex: 1, child: SizedBox()),
// ],
// ),
// )
], ],
), ),
); );

View File

@ -308,6 +308,7 @@ Widget $easyRefresh({
required int tab, required int tab,
}) { }) {
bool completed = tab == 2; // bool completed = tab == 2; //
bool isPadFlag = isPad();
return EasyRefresh( return EasyRefresh(
firstRefresh: true, firstRefresh: true,
taskIndependence: true, taskIndependence: true,
@ -317,18 +318,144 @@ Widget $easyRefresh({
controller: controller, controller: controller,
header: MaterialHeader(), header: MaterialHeader(),
footer: TaurusFooter(), footer: TaurusFooter(),
child: ListView.builder( child: completed && isPadFlag
padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 16.w, right: 16.w), ? GridView(
itemBuilder: (context, index) { padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
return HomeworkTasksViewItem( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
completed: completed, crossAxisCount: 2, //widget
jobTaskItem: data[index], mainAxisSpacing: 10.h,
call: () => controller.callRefresh(), crossAxisSpacing: 6.w,
); childAspectRatio: 2.2 //1widget
}, ),
itemCount: data.length, children: data.map((e) {
), return $ReviewedItem(jobTaskItem: e);
}).toList(),
)
: ListView.builder(
padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
itemBuilder: (context, index) {
return HomeworkTasksViewItem(
completed: completed,
jobTaskItem: data[index],
call: () => controller.callRefresh(),
);
},
itemCount: data.length,
),
onRefresh: () => onRefresh(controller, params, tab), onRefresh: () => onRefresh(controller, params, tab),
onLoad: () => onLoad(controller, params, tab), onLoad: () => onLoad(controller, params, tab),
); );
} }
@swidget
Widget $reviewedItem(BuildContext context, {required JobTaskItem jobTaskItem}) {
EdgeInsets padEdg = EdgeInsets.symmetric(horizontal: 10.w);
return Container(
padding: EdgeInsets.only(top: 10.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color.fromRGBO(210, 216, 241, 1),
offset: Offset.zero, //y轴偏移量
blurRadius: 5.8, //
spreadRadius: 0, //
)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
//
Padding(
padding: padEdg,
child: Row(
children: [
Container(
width: 32.w,
height: 18.h,
alignment: Alignment.center,
padding: EdgeInsets.only(left: 2.w),
decoration: BoxDecoration(
color: jobTaskItem.markingTypeEnum.name == '作业'
? const Color.fromRGBO(104, 136, 253, 1)
: const Color.fromRGBO(255, 175, 56, 1),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(18.r),
topRight: Radius.circular(3.r),
bottomLeft: Radius.circular(4.r),
bottomRight: Radius.circular(4.r),
),
),
margin: EdgeInsets.only(right: 4.w),
child: quickText(jobTaskItem.markingTypeEnum.name, color: Colors.white, size: 10.sp),
),
quickText(
jobTaskItem.title,
size: 16.sp,
color: Color.fromRGBO(70, 70, 70, 1),
fontWeight: FontWeight.bold,
)
],
),
),
Padding(
padding: padEdg,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(
jobTaskItem.createTime.substring(0, 10),
color: Color.fromRGBO(97, 97, 97, 1),
size: 10.sp,
fontWeight: FontWeight.w500,
),
quickText(' / ', color: Color.fromRGBO(76, 199, 147, 1), size: 10.sp, fontWeight: FontWeight.w500),
quickText(
'参与班级2',
color: Color.fromRGBO(76, 199, 147, 1),
size: 10.sp,
fontWeight: FontWeight.w600,
),
quickText(' / ', color: Color.fromRGBO(116, 145, 253, 1), size: 10.sp, fontWeight: FontWeight.w500),
quickText(
'科目:' + jobTaskItem.subjectName,
color: Color.fromRGBO(116, 145, 253, 1),
size: 10.sp,
fontWeight: FontWeight.w600,
),
],
),
),
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: [
BoxShadow(
color: const Color.fromRGBO(0, 0, 0, 0.15),
offset: Offset(0, -0.0001), //y轴偏移量
blurRadius: 4, //
spreadRadius: 0, //
)
],
),
child: Row(children: [
Expanded(
child: InkWell(
onTap: () => easyThrottle('go_to_homework_report', () => {}),
child: Container(
alignment: Alignment.center,
child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 11.sp),
),
)),
]),
),
],
),
);
}

View File

@ -21,6 +21,7 @@ import 'dart:math';
import 'package:fluro/fluro.dart'; import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:marking_app/common/config/request_config.dart'; import 'package:marking_app/common/config/request_config.dart';
export "./colorUtils.dart"; export "./colorUtils.dart";
@ -105,6 +106,11 @@ void toPrint({required dynamic val, bool toPrintJson = false}) {
if (printSwitch && val != null) toPrintJson ? printJson(val) : print(val); if (printSwitch && val != null) toPrintJson ? printJson(val) : print(val);
} }
//
bool isPad([double mobilePhoneScale = 1.2]) {
return ScreenUtil().scaleWidth > mobilePhoneScale;
}
class EUMNoScrollBehavior extends ScrollBehavior { class EUMNoScrollBehavior extends ScrollBehavior {
@override @override
Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) { Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {