From ff1b70d39d4cbeac3ce71794f82a08e23044dd3d Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Fri, 8 Mar 2024 10:49:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homework_tasks_view_item.dart | 219 +-- .../lib/pages/homework_correction/index.dart | 149 +- .../pages/job_list_participate_in_class.dart | 1264 ++++++++++++----- marking_app/lib/utils/index.dart | 6 + 4 files changed, 1171 insertions(+), 467 deletions(-) diff --git a/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart b/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart index a72a37e..d757d83 100644 --- a/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart +++ b/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart @@ -147,7 +147,7 @@ Widget $completedHomeworkView(BuildContext context, {required JobTaskItem jobTaskItem, required ShowStudentsCall showStudentsCall}) { return Container( width: double.infinity, - padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 10.w), + padding: EdgeInsets.only(top: 20.h), margin: EdgeInsets.only(bottom: 12.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(6.r), @@ -164,109 +164,134 @@ Widget $completedHomeworkView(BuildContext context, child: Column( children: [ // 顶部任务名称 - Row( - children: [ - 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(), - ); - }, + Padding( + padding: EdgeInsets.symmetric(horizontal: 10.w), 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)], - ), + 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), ), - 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()), + // ], + // ), + // ) ], ), ); diff --git a/marking_app/lib/pages/homework_correction/index.dart b/marking_app/lib/pages/homework_correction/index.dart index 84b6783..2c45474 100644 --- a/marking_app/lib/pages/homework_correction/index.dart +++ b/marking_app/lib/pages/homework_correction/index.dart @@ -308,6 +308,7 @@ Widget $easyRefresh({ required int tab, }) { bool completed = tab == 2; // 是否是待批阅 + bool isPadFlag = isPad(); return EasyRefresh( firstRefresh: true, taskIndependence: true, @@ -317,18 +318,144 @@ Widget $easyRefresh({ controller: controller, header: MaterialHeader(), footer: TaurusFooter(), - child: ListView.builder( - padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 16.w, right: 16.w), - itemBuilder: (context, index) { - return HomeworkTasksViewItem( - completed: completed, - jobTaskItem: data[index], - call: () => controller.callRefresh(), - ); - }, - itemCount: data.length, - ), + 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: 2.2 //宽高比为1时,子widget + ), + 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), 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), + ), + )), + ]), + ), + ], + ), + ); +} diff --git a/marking_app/lib/pages/homework_correction/pages/job_list_participate_in_class.dart b/marking_app/lib/pages/homework_correction/pages/job_list_participate_in_class.dart index 38a3970..429bb86 100644 --- a/marking_app/lib/pages/homework_correction/pages/job_list_participate_in_class.dart +++ b/marking_app/lib/pages/homework_correction/pages/job_list_participate_in_class.dart @@ -1,16 +1,18 @@ import 'package:achievement_view/achievement_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:functional_widget_annotation/functional_widget_annotation.dart'; import 'package:marking_app/common/mixin/common.dart'; import 'package:marking_app/common/model/common/base_structure_result.dart'; import 'package:marking_app/common/model/job/job_task_item.dart'; import 'package:marking_app/routes/RouterManager.dart'; import 'package:marking_app/utils/index.dart'; -import 'package:marking_app/utils/my_future_builder.dart'; import 'package:marking_app/utils/my_text.dart'; import 'package:marking_app/utils/request/rest_client.dart'; import 'package:percent_indicator/linear_percent_indicator.dart'; +part 'job_list_participate_in_class.g.dart'; + class JobListParticipateInClass extends StatefulWidget { final int jobId; final String jobName; @@ -31,6 +33,10 @@ class _JobListParticipateInClassState extends State w // TODO: implement initState super.initState(); _future = getData(); + Future.delayed(Duration.zero, () { + print(ScreenUtil().scaleWidth); + print(MediaQuery.of(context).devicePixelRatio); + }); } @override @@ -45,21 +51,60 @@ class _JobListParticipateInClassState extends State w return _result.data; } - // 结束批阅方法 - Future endReview(List markingTasks) async { - try { - ToastUtils.showLoading(); - RestClient client = await getClient(); - BaseStructureResult res = await client.toEndReviewJob(markingTasks.map((e) => e.id).toList()); - if (!res.success) ToastUtils.showError('结束失败,请重试'); - return res.success; - } catch (e) { - ToastUtils.showError('结束失败,请重试'); - return false; - } - } - + // 一键批阅 void oneClickReview(int taskId) async { + var continueFlag = await showDialog( + context: context, + builder: (BuildContext context1) { + return Center( + child: Container( + padding: EdgeInsets.symmetric(vertical: 25.h, horizontal: 18.w), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadiusDirectional.circular(12.r)), + height: 150.h, + width: 280.w, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Expanded( + child: quickText('一键批阅后,默认学生答题结果全部正确,是否进行此操作?', + maxLines: 3, size: 14.sp, color: Color.fromRGBO(80, 94, 110, 1))) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + InkWell( + onTap: () { + Navigator.of(context1).pop(false); + }, + child: Container( + padding: EdgeInsetsDirectional.symmetric(horizontal: 36.w, vertical: 7.h), + decoration: BoxDecoration( + color: Color.fromRGBO(244, 244, 244, 1), borderRadius: BorderRadius.circular(20.r)), + child: quickText('取消', size: 14.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + InkWell( + onTap: () { + Navigator.of(context1).pop(true); + }, + child: Container( + padding: EdgeInsetsDirectional.symmetric(horizontal: 36.w, vertical: 7.h), + decoration: BoxDecoration( + color: Theme.of(context).primaryColor, borderRadius: BorderRadius.circular(20.r)), + child: quickText('确认', size: 14.sp, color: Color.fromRGBO(255, 255, 255, 1)), + ), + ), + ], + ) + ], + ), + )); + }, + ); + if (continueFlag == null || !continueFlag) return; try { ToastUtils.showLoading(); RestClient _client = await getClient(); @@ -77,6 +122,138 @@ class _JobListParticipateInClassState extends State w } } + /// 前往批阅 + void goToReview(MarkingTasks task) { + if (task.totalCount <= 0) { + return ToastUtils.showInfo('没有找到可以批阅的任务'); + } + + if (!task.canMarking) { + return AchievementView( + elevation: 0.5, + duration: Duration(seconds: 1), + title: "提示", + subTitle: "此账号无法批阅该任务", + color: Theme.of(context).primaryColor, + ).show(context); + } + + if (task.isFinish) { + return AchievementView( + elevation: 0.5, + duration: Duration(seconds: 1), + title: "提示", + subTitle: "此批阅任务已完成", + color: Theme.of(context).primaryColor, + ).show(context); + } + + String url = + '${RouterManager.markingHomeworkDoPath}?taskId=${task.id}&jobId=${widget.jobId}&taskName=${Uri.encodeComponent(widget.jobName)}&className=${Uri.encodeComponent(widget.genderName + task.className)}'; + RouterManager.router.navigateTo(context, url, transition: getTransition()).then((value) { + if (value == true) { + isRefresh = true; + _future = getData(); + toUpState(setState, () {}, mounted); + } + }); + } + + // 结束批阅请求方法 + Future endReviewInitialRequest(List markingTasks) async { + try { + ToastUtils.showLoading(); + RestClient client = await getClient(); + BaseStructureResult res = await client.toEndReviewJob(markingTasks.map((e) => e.id).toList()); + if (!res.success) ToastUtils.showError('结束失败,请重试'); + return res.success; + } catch (e) { + ToastUtils.showError('结束失败,请重试'); + return false; + } + } + + void endReview(MarkingTasks task) async { + /// 结束批阅逻辑 + if (!task.canMarking) return ToastUtils.showInfo('此任务非该账号任务'); + if (task.isFinish) return ToastUtils.showInfo('此任务已经结束'); + + // 未完成批阅任务提示 + if (task.finishCount < task.totalCount) { + var continueFlag = await showDialog( + context: context, + builder: (BuildContext context1) { + return AlertDialog( + title: Text('未完成批阅提示'), + content: Text('当前批阅任务未完成,请确认需要结束此任务?'), + actions: [ + TextButton( + child: Text('否'), + onPressed: () { + // 在这里处理删除操作 + Navigator.of(context1).pop(false); + }, + ), + TextButton( + child: Text('是'), + onPressed: () { + Navigator.of(context1).pop(true); + }, + ), + ], + ); + }, + ); + if (continueFlag == null || !continueFlag) { + return; + } + } + + showDialog( + context: context, + builder: (BuildContext context1) { + return AlertDialog( + title: Text('提示'), + content: Text('确认完成当前${task.className}批阅任务?'), + actions: [ + TextButton( + child: Text('否'), + onPressed: () { + // 在这里处理删除操作 + Navigator.of(context1).pop(); + }, + ), + TextButton( + child: Text('确定'), + onPressed: () async { + try { + bool result = await endReviewInitialRequest([task]); + if (result) { + isRefresh = true; + _future = getData(); + toUpState(setState, () {}, mounted); + } + } catch (e) { + } finally { + ToastUtils.dismiss(); + Navigator.of(context1).pop(); + } + }, + ), + ], + ); + }, + ); + } + + // 收藏夹 + void bookmarks(MarkingTasks task) {} + + // 数据快查 + void quickDataCheck(MarkingTasks task) {} + + // 查看作业报告 + void jobViewReport(MarkingTasks task) {} @override Widget build(BuildContext context) { return Scaffold( @@ -95,353 +272,722 @@ class _JobListParticipateInClassState extends State w body: MyFutureBuilder.buildFutureBuilderOfSingleInstance?>(context, _future, (value) { if (value == null) return Container(); - return ListView( - padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.w), - children: value.map((e) { - return Container( - padding: EdgeInsets.only(top: 11.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadiusDirectional.circular(10.r), - boxShadow: [ - BoxShadow( - color: Color.fromRGBO(0, 0, 0, 0.15), - blurRadius: 10, - ), - ], - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Padding( - padding: EdgeInsets.only(left: 10.w, right: 10.w), - child: Row( - children: [ - quickText(widget.genderName + e.className, color: Color.fromRGBO(0, 0, 0, 1), size: 14.sp), - Expanded(child: SizedBox()), - quickText('已交:${e.commitStudentCount}', color: Color.fromRGBO(104, 136, 253, 1), size: 12.sp), - SizedBox(width: 16.w), - quickText('未交:${e.studentCount - e.commitStudentCount}', - color: Color.fromRGBO(255, 86, 86, 1), size: 12.sp), - ], - ), - ), - SizedBox(height: 13.h), - Padding( - padding: EdgeInsets.only(left: 10.w, right: 10.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 3, - child: Material( - color: Color.fromRGBO(104, 136, 253, 1), - borderRadius: BorderRadius.circular(16.r), - child: InkWell( - onTap: () => easyThrottle('OneClickReview', () async { - var continueFlag = await showDialog( - context: context, - builder: (BuildContext context1) { - return Center( - child: Container( - padding: EdgeInsets.symmetric(vertical: 25.h, horizontal: 18.w), - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadiusDirectional.circular(12.r)), - height: 150.h, - width: 280.w, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Expanded( - child: quickText('一键批阅后,默认学生答题结果全部正确,是否进行此操作?', - maxLines: 3, - size: 14.sp, - color: Color.fromRGBO(80, 94, 110, 1))) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - InkWell( - onTap: () { - Navigator.of(context1).pop(false); - }, - child: Container( - padding: EdgeInsetsDirectional.symmetric( - horizontal: 36.w, vertical: 7.h), - decoration: BoxDecoration( - color: Color.fromRGBO(244, 244, 244, 1), - borderRadius: BorderRadius.circular(20.r)), - child: quickText('取消', - size: 14.sp, color: Color.fromRGBO(102, 102, 102, 1)), - ), - ), - InkWell( - onTap: () { - Navigator.of(context1).pop(true); - }, - child: Container( - padding: EdgeInsetsDirectional.symmetric( - horizontal: 36.w, vertical: 7.h), - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.circular(20.r)), - child: quickText('确认', - size: 14.sp, color: Color.fromRGBO(255, 255, 255, 1)), - ), - ), - ], - ) - ], - ), - )); - }, - ); - if (continueFlag == null || !continueFlag) return; - oneClickReview(e.id); - }), - borderRadius: BorderRadius.circular(8.r), - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 5.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20.r), - ), - child: quickText('一键批阅', size: 10.sp, color: Colors.white), - ), - ), - ), - ), - Expanded(flex: 1, child: SizedBox()), - Expanded( - flex: 3, - child: Material( - color: Color.fromRGBO(244, 244, 244, 1), - borderRadius: BorderRadius.circular(20.r), - child: InkWell( - onTap: () async {}, - borderRadius: BorderRadius.circular(8.r), - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 5.h), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), - child: quickText('数据快查', size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)), - ), - ), - ), - ), - Expanded(flex: 1, child: SizedBox()), - Expanded( - flex: 3, - child: Material( - color: Color.fromRGBO(244, 244, 244, 1), - borderRadius: BorderRadius.circular(20.r), - child: InkWell( - onTap: () async {}, - borderRadius: BorderRadius.circular(8.r), - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 5.h), - decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), - child: quickText('收藏夹(2)', size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)), - ), - ), - )), - ], - ), - ), - SizedBox(height: 13.h), - Padding( - padding: EdgeInsets.only(left: 10.w, right: 10.w), - child: Row( - children: [ - Expanded( - child: LinearPercentIndicator( - padding: EdgeInsets.zero, - animation: true, - lineHeight: 6.h, - animationDuration: 2500, + if (isPad()) + return TabletEnd( + data: value, + genderName: widget.genderName, + bookmarks: bookmarks, + endReview: endReview, + goToReview: goToReview, + jobViewReport: jobViewReport, + quickDataCheck: quickDataCheck, + oneClickReview: oneClickReview, + ); - percent: e.progressPercentage / 100, - // center: Text( - // '${getDoubleRemoveZero(jobTaskClassItem.progressPercentage)}%', - // style: TextStyle(color: Colors.white, fontSize: 8.sp), - // ), - linearGradient: LinearGradient( - tileMode: TileMode.mirror, - stops: [0.0, 1.0], - colors: e.progressPercentage / 100 != 1 - ? [Theme.of(context).primaryColor.withOpacity(0.1), Theme.of(context).primaryColor] - : [ - Color.fromRGBO(144, 224, 190, 1).withOpacity(0.1), - Color.fromRGBO(144, 224, 190, 1), - ], - ), - // linearStrokeCap: LinearStrokeCap.butt, - // progressColor: Theme.of(context).primaryColor, - backgroundColor: Color.fromRGBO(232, 232, 232, 1), - barRadius: Radius.circular(10.r), - ), - ), - SizedBox(width: 7.w), - quickText('${getDoubleRemoveZero(e.progressPercentage)}%', - size: 10.sp, color: Color.fromRGBO(70, 70, 70, 1)) - ], - ), - ), - SizedBox(height: 13.h), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(10.r), - bottomRight: Radius.circular(10.r), - ), - color: Colors.white, - boxShadow: [ - BoxShadow( - color: const Color.fromRGBO(0, 0, 0, 0.15), - offset: Offset(0, -0.0001), //阴影y轴偏移量 - blurRadius: 5, //阴影模糊程度 - spreadRadius: 0, //阴影扩散程度 - ) - ], - ), - child: Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - if (e.totalCount <= 0) { - return ToastUtils.showInfo('没有找到可以批阅的任务'); - } - - if (!e.canMarking) { - return AchievementView( - elevation: 0.5, - duration: Duration(seconds: 1), - title: "提示", - subTitle: "此账号无法批阅该任务", - color: Theme.of(context).primaryColor, - ).show(context); - } - - if (e.isFinish) { - return AchievementView( - elevation: 0.5, - duration: Duration(seconds: 1), - title: "提示", - subTitle: "此批阅任务已完成", - color: Theme.of(context).primaryColor, - ).show(context); - } - - String url = - '${RouterManager.markingHomeworkDoPath}?taskId=${e.id}&jobId=${widget.jobId}&taskName=${Uri.encodeComponent(widget.jobName)}&className=${Uri.encodeComponent(widget.genderName + e.className)}'; - RouterManager.router - .navigateTo(context, url, transition: getTransition()) - .then((value) { - if (value == true) { - isRefresh = true; - _future = getData(); - toUpState(setState, () {}, mounted); - } - }); - }, - child: Container( - alignment: Alignment.center, - child: quickText('批阅', color: Color.fromRGBO(79, 79, 79, 1), size: 13.sp), - ), - ), - ), - Container(width: 1.w, height: 32.h, color: Color.fromRGBO(221, 221, 221, 1)), - Expanded( - child: InkWell( - onTap: () async { - if (!e.canMarking) return ToastUtils.showInfo('此任务非该账号任务'); - if (e.isFinish) return ToastUtils.showInfo('此任务已经结束'); - - // 未完成批阅任务提示 - if (e.finishCount < e.totalCount) { - var continueFlag = await showDialog( - context: context, - builder: (BuildContext context1) { - return AlertDialog( - title: Text('未完成批阅提示'), - content: Text('当前批阅任务未完成,请确认需要结束此任务?'), - actions: [ - TextButton( - child: Text('否'), - onPressed: () { - // 在这里处理删除操作 - Navigator.of(context1).pop(false); - }, - ), - TextButton( - child: Text('是'), - onPressed: () { - Navigator.of(context1).pop(true); - }, - ), - ], - ); - }, - ); - if (continueFlag == null || !continueFlag) { - return; - } - } - - showDialog( - context: context, - builder: (BuildContext context1) { - return AlertDialog( - title: Text('提示'), - content: Text('确认完成当前${e.className}批阅任务?'), - actions: [ - TextButton( - child: Text('否'), - onPressed: () { - // 在这里处理删除操作 - Navigator.of(context1).pop(); - }, - ), - TextButton( - child: Text('确定'), - onPressed: () async { - try { - bool result = await endReview([e]); - if (result) { - isRefresh = true; - _future = getData(); - toUpState(setState, () {}, mounted); - } - } catch (e) { - } finally { - ToastUtils.dismiss(); - Navigator.of(context1).pop(); - } - }, - ), - ], - ); - }, - ); - }, - child: Container( - alignment: Alignment.center, - child: quickText('结束批阅', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp), - ), - )), - ], - ), - ), - ], - )); - }).toList(), + return MobileEnd( + data: value, + genderName: widget.genderName, + bookmarks: bookmarks, + endReview: endReview, + goToReview: goToReview, + jobViewReport: jobViewReport, + quickDataCheck: quickDataCheck, + oneClickReview: oneClickReview, ); }), ); } } + +/// 平板电脑端 +class TabletEnd extends StatelessWidget { + final String genderName; + final List data; + + final EndReview endReview; // 结束批阅 + final Bookmarks bookmarks; // 收藏夹 + final GoToReview goToReview; // 前往批阅 + final JobViewReport jobViewReport; + final OneClickReview oneClickReview; // 一键批阅 + final QuickDataCheck quickDataCheck; // 数据快查 + const TabletEnd({ + required this.genderName, + required this.data, + + /// 方法 + required this.endReview, + required this.bookmarks, + required this.goToReview, + required this.jobViewReport, + required this.oneClickReview, + required this.quickDataCheck, + super.key, + }); + + @override + Widget build(BuildContext context) { + return Container( + width: ScreenUtil().screenWidth, + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 16.h), + child: Wrap( + spacing: 8.0.w, // 子元素之间的间距 + runSpacing: 10.h, // 主轴方向上不同行之间的间距 + children: [...data, ...data, ...data] + .map((e) => $ItemDataViewOfPad( + task: e, + bookmarks: bookmarks, + endReview: endReview, + genderName: genderName, + goToReview: goToReview, + jobViewReport: jobViewReport, + quickDataCheck: quickDataCheck, + oneClickReview: oneClickReview, + )) + .toList(), + ), + ); + } +} + +/// 移动端 +class MobileEnd extends StatelessWidget { + final String genderName; + final List data; + + final EndReview endReview; // 结束批阅 + final Bookmarks bookmarks; // 收藏夹 + final GoToReview goToReview; // 前往批阅 + final JobViewReport jobViewReport; + final OneClickReview oneClickReview; // 一键批阅 + final QuickDataCheck quickDataCheck; // 数据快查 + + const MobileEnd({ + required this.genderName, + required this.data, + + /// 方法 + required this.endReview, + required this.bookmarks, + required this.goToReview, + required this.jobViewReport, + required this.oneClickReview, + required this.quickDataCheck, + super.key, + }); + + @override + Widget build(BuildContext context) { + return ListView( + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 16.h), + children: data.map((e) { + return $ItemDataView( + task: e, + bookmarks: bookmarks, + endReview: endReview, + genderName: genderName, + goToReview: goToReview, + jobViewReport: jobViewReport, + quickDataCheck: quickDataCheck, + oneClickReview: oneClickReview, + ); + }).toList(), + ); + } +} + +/// pad item view +@swidget +Widget $itemDataViewOfPad( + BuildContext context, { + required MarkingTasks task, + required String genderName, + + /// 方法 + required EndReview endReview, + required Bookmarks bookmarks, + required GoToReview goToReview, + required JobViewReport jobViewReport, + required OneClickReview oneClickReview, + required QuickDataCheck quickDataCheck, +}) { + EdgeInsets edgins = EdgeInsets.only(left: 8.w, right: 8.w); + return Container( + width: ScreenUtil().screenWidth / 2 - (12.w + 4.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadiusDirectional.circular(4.r), + boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.15), blurRadius: 10)], + ), + padding: EdgeInsets.only(top: 10.h), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: edgins, + child: Row( + children: [ + quickText(genderName + task.className, color: Color.fromRGBO(0, 0, 0, 1), size: 10.sp), + Expanded(child: SizedBox()), + quickText('已交:${task.commitStudentCount}', color: Color.fromRGBO(104, 136, 253, 1), size: 8.sp), + SizedBox(width: 10.w), + quickText('未交:${task.studentCount - task.commitStudentCount}', + color: Color.fromRGBO(255, 86, 86, 1), size: 8.sp), + ], + ), + ), + SizedBox(height: 10.h), + Padding( + padding: edgins, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: task.isFinish + ? [ + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 3.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('收藏夹(2)', size: 8.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + )), + Expanded(flex: 1, child: SizedBox()), + Expanded(flex: 3, child: SizedBox()), + Expanded(flex: 1, child: SizedBox()), + Expanded(flex: 3, child: SizedBox()), + ] + : [ + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(104, 136, 253, 1), + borderRadius: BorderRadius.circular(16.r), + child: InkWell( + onTap: () => easyThrottle('OneClickReview', () => oneClickReview(task.id)), + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 3.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20.r), + ), + child: quickText('一键批阅', size: 8.sp, color: Colors.white), + ), + ), + ), + ), + Expanded(flex: 1, child: SizedBox()), + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 3.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('数据快查', size: 8.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + ), + ), + Expanded(flex: 1, child: SizedBox()), + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 3.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('收藏夹(2)', size: 8.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + )), + ], + ), + ), + SizedBox(height: 8.h), + Padding( + padding: EdgeInsets.only(left: 10.w, right: 10.w), + child: Row( + children: [ + Expanded( + child: LinearPercentIndicator( + padding: EdgeInsets.zero, + animation: true, + lineHeight: 5.h, + animationDuration: 2500, + percent: task.progressPercentage / 100, + linearGradient: LinearGradient( + tileMode: TileMode.mirror, + stops: [0.0, 1.0], + colors: task.progressPercentage / 100 != 1 + ? [Theme.of(context).primaryColor.withOpacity(0.1), Theme.of(context).primaryColor] + : [ + Color.fromRGBO(144, 224, 190, 1).withOpacity(0.1), + Color.fromRGBO(144, 224, 190, 1), + ], + ), + backgroundColor: Color.fromRGBO(232, 232, 232, 1), + barRadius: Radius.circular(10.r), + ), + ), + SizedBox(width: 7.w), + quickText('${getDoubleRemoveZero(task.progressPercentage)}%', + size: 8.sp, color: Color.fromRGBO(70, 70, 70, 1)) + ], + ), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + fontSize: 8.sp, + lineHeight: 6.h, + color: Color.fromRGBO(76, 199, 147, 1), + percent: task.objectivePrecision, + title: '客观题正确率:', + padingEdg: edgins, + marginEdg: EdgeInsets.only(top: 8.h), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + fontSize: 8.sp, + lineHeight: 6.h, + color: Color.fromRGBO(255, 190, 91, 1), + percent: task.subjectivePrecision, + title: '主观题正确率:', + padingEdg: edgins, + marginEdg: EdgeInsets.only(top: 8.h), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + fontSize: 8.sp, + lineHeight: 6.h, + color: Color.fromRGBO(166, 139, 242, 1), + percent: task.precision, + title: '总正确率:', + padingEdg: edgins, + marginEdg: EdgeInsets.only(top: 8.h), + ), + SizedBox(height: 8.h), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(4.r), bottomRight: Radius.circular(4.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: task.isFinish + ? [ + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_review_homework', () => quickDataCheck(task)), + child: Container( + alignment: Alignment.center, + child: quickText('数据快查', color: Color.fromRGBO(79, 79, 79, 1), size: 13.sp), + ), + ), + ), + Container(width: 1.w, height: 32.h, color: Color.fromRGBO(221, 221, 221, 1)), + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_end_review_homework', () => jobViewReport(task)), + child: Container( + alignment: Alignment.center, + child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp), + ), + )), + ] + : [ + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_review_homework', () => goToReview(task)), + child: Container( + alignment: Alignment.center, + child: quickText('批阅', color: Color.fromRGBO(79, 79, 79, 1), size: 11.sp), + ), + ), + ), + Container(width: 0.3.w, height: 24.h, color: Color.fromRGBO(221, 221, 221, 1)), + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_end_review_homework', () => endReview(task)), + child: Container( + alignment: Alignment.center, + child: quickText('结束批阅', color: Color.fromRGBO(118, 118, 118, 1), size: 10.sp), + ), + )), + ], + ), + ), + ], + ), + ); +} + +/// item view +@swidget +Widget $itemDataView( + BuildContext context, { + required MarkingTasks task, + required String genderName, + + /// 方法 + required EndReview endReview, + required Bookmarks bookmarks, + required GoToReview goToReview, + required OneClickReview oneClickReview, + required QuickDataCheck quickDataCheck, + required JobViewReport jobViewReport, +}) { + var padingEdg = EdgeInsets.only(left: 10.w, right: 10.w); + return Container( + padding: EdgeInsets.only(top: 11.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadiusDirectional.circular(10.r), + boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.15), blurRadius: 10)], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: padingEdg, + child: Row( + children: [ + quickText(genderName + task.className, color: Color.fromRGBO(0, 0, 0, 1), size: 14.sp), + Expanded(child: SizedBox()), + quickText('已交:${task.commitStudentCount}', color: Color.fromRGBO(104, 136, 253, 1), size: 12.sp), + SizedBox(width: 16.w), + quickText('未交:${task.studentCount - task.commitStudentCount}', + color: Color.fromRGBO(255, 86, 86, 1), size: 12.sp), + ], + ), + ), + SizedBox(height: 13.h), + Padding( + padding: padingEdg, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: task.isFinish + ? [ + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('收藏夹(2)', size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + )), + Expanded(flex: 1, child: SizedBox()), + Expanded(flex: 3, child: SizedBox()), + Expanded(flex: 1, child: SizedBox()), + Expanded(flex: 3, child: SizedBox()), + ] + : [ + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(104, 136, 253, 1), + borderRadius: BorderRadius.circular(16.r), + child: InkWell( + onTap: () => easyThrottle('OneClickReview', () => oneClickReview(task.id)), + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20.r), + ), + child: quickText('一键批阅', size: 10.sp, color: Colors.white), + ), + ), + ), + ), + Expanded(flex: 1, child: SizedBox()), + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('数据快查', size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + ), + ), + Expanded(flex: 1, child: SizedBox()), + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('收藏夹(2)', size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + )), + ], + ), + ), + SizedBox(height: 13.h), + Padding( + padding: padingEdg, + child: Row( + children: [ + Expanded( + child: LinearPercentIndicator( + padding: EdgeInsets.zero, + animation: true, + lineHeight: 8.h, + animationDuration: 2500, + + percent: task.progressPercentage / 100, + // center: Text( + // '${getDoubleRemoveZero(jobTaskClassItem.progressPercentage)}%', + // style: TextStyle(color: Colors.white, fontSize: 8.sp), + // ), + linearGradient: LinearGradient( + tileMode: TileMode.mirror, + stops: [0.0, 1.0], + colors: task.progressPercentage / 100 != 1 + ? [Theme.of(context).primaryColor.withOpacity(0.1), Theme.of(context).primaryColor] + : [ + Color.fromRGBO(144, 224, 190, 1).withOpacity(0.1), + Color.fromRGBO(144, 224, 190, 1), + ], + ), + // linearStrokeCap: LinearStrokeCap.butt, + // progressColor: Theme.of(context).primaryColor, + backgroundColor: Color.fromRGBO(232, 232, 232, 1), + barRadius: Radius.circular(10.r), + ), + ), + SizedBox(width: 7.w), + quickText('${getDoubleRemoveZero(task.progressPercentage)}%', + size: 10.sp, color: Color.fromRGBO(70, 70, 70, 1)) + ], + ), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(76, 199, 147, 1), + percent: task.objectivePrecision, + title: '客观题正确率:', + padingEdg: padingEdg, + marginEdg: EdgeInsets.only(top: 8.h), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(255, 190, 91, 1), + percent: task.subjectivePrecision, + title: '主观题正确率:', + padingEdg: padingEdg, + marginEdg: EdgeInsets.only(top: 8.h), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(166, 139, 242, 1), + percent: task.precision, + title: '总正确率:', + padingEdg: padingEdg, + marginEdg: EdgeInsets.only(top: 8.h), + ), + SizedBox(height: 13.h), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(10.r), + bottomRight: Radius.circular(10.r), + ), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: const Color.fromRGBO(0, 0, 0, 0.15), + offset: Offset(0, -0.0001), //阴影y轴偏移量 + blurRadius: 5, //阴影模糊程度 + spreadRadius: 0, //阴影扩散程度 + ) + ], + ), + child: Row( + children: task.isFinish + ? [ + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_review_homework', () => quickDataCheck(task)), + child: Container( + alignment: Alignment.center, + child: quickText('数据快查', color: Color.fromRGBO(79, 79, 79, 1), size: 13.sp), + ), + ), + ), + Container(width: 1.w, height: 32.h, color: Color.fromRGBO(221, 221, 221, 1)), + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_end_review_homework', () => jobViewReport(task)), + child: Container( + alignment: Alignment.center, + child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp), + ), + )), + ] + : [ + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_review_homework', () => goToReview(task)), + child: Container( + alignment: Alignment.center, + child: quickText('批阅', color: Color.fromRGBO(79, 79, 79, 1), size: 13.sp), + ), + ), + ), + Container(width: 1.w, height: 32.h, color: Color.fromRGBO(221, 221, 221, 1)), + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_end_review_homework', () => endReview(task)), + child: Container( + alignment: Alignment.center, + child: quickText('结束批阅', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp), + ), + )), + ], + ), + ), + ], + )); +} + +@swidget +Widget $completedHomeworkProgressBar( + BuildContext context, { + double? fontSize, + double? lineHeight, + required String title, + required Color color, + required double percent, + required EdgeInsets padingEdg, + required EdgeInsets marginEdg, +}) { + var percentStr = '${doubleToStringAsFixed(percent * 100)}%'; + print(fontSize); + fontSize ??= 10.sp; + lineHeight ??= 8.h; + return Container( + margin: marginEdg, + padding: padingEdg, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (title == '总正确率:') quickText('确率', color: Colors.transparent, size: fontSize), + quickText(title, color: Color.fromRGBO(139, 139, 139, 1), size: fontSize), + Expanded( + flex: 1, + child: Container( + child: Row( + children: [ + Expanded( + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.r), + boxShadow: [ + BoxShadow( + color: color, + spreadRadius: 0.6, + blurRadius: 3, + offset: Offset(0, 0), + ), + ], + ), + child: LinearPercentIndicator( + padding: EdgeInsets.zero, + animation: true, + lineHeight: lineHeight, + animationDuration: 2500, + percent: percent, + center: Text( + percentStr, + style: TextStyle(color: Colors.white, fontSize: 8.sp), + ), + // linearStrokeCap: LinearStrokeCap.butt, + progressColor: color, + backgroundColor: Colors.white, + barRadius: Radius.circular(10.r), + // linearGradient: LinearGradient( + // tileMode: TileMode.mirror, + // stops: [0.0, 1.0], + // colors: [color.withOpacity(0.1), color], + // ), + ), + ), + ), + SizedBox(width: 4.w), + quickText(percentStr, size: fontSize, color: color) + ], + ), + ), + ), + ], + ), + ); +} + +/// 一键批阅 +typedef OneClickReview = void Function(int); + +/// 前往批阅 +typedef GoToReview = void Function(MarkingTasks); + +/// 结束批阅 +typedef EndReview = void Function(MarkingTasks); + +/// 数据快查 +typedef QuickDataCheck = void Function(MarkingTasks); + +/// 收藏夹 +typedef Bookmarks = void Function(MarkingTasks); + +/// 查看作业报告 +typedef JobViewReport = void Function(MarkingTasks); diff --git a/marking_app/lib/utils/index.dart b/marking_app/lib/utils/index.dart index 6b9db0c..7a2354e 100644 --- a/marking_app/lib/utils/index.dart +++ b/marking_app/lib/utils/index.dart @@ -21,6 +21,7 @@ import 'dart:math'; import 'package:fluro/fluro.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:marking_app/common/config/request_config.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); } +// 是否是平板 +bool isPad([double mobilePhoneScale = 1.2]) { + return ScreenUtil().scaleWidth > mobilePhoneScale; +} + class EUMNoScrollBehavior extends ScrollBehavior { @override Widget buildViewportChrome(BuildContext context, Widget child, AxisDirection axisDirection) {