From 829ac8fbadfafdf4e9009f17a29acda18617fd54 Mon Sep 17 00:00:00 2001 From: machuanyu <840649825@qq.com> Date: Thu, 13 Mar 2025 14:59:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E6=89=B9=E9=98=85=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../read_over/widget/annotate_list.dart | 260 +++++++++++------- .../widget/job_condition_filter.dart | 6 +- .../widget/personal_detail_topbar.dart | 20 +- 3 files changed, 173 insertions(+), 113 deletions(-) diff --git a/making_school_asignment_app/lib/page/home_page/children/read_over/widget/annotate_list.dart b/making_school_asignment_app/lib/page/home_page/children/read_over/widget/annotate_list.dart index d720c2a..f9298a7 100644 --- a/making_school_asignment_app/lib/page/home_page/children/read_over/widget/annotate_list.dart +++ b/making_school_asignment_app/lib/page/home_page/children/read_over/widget/annotate_list.dart @@ -19,16 +19,20 @@ import 'package:making_school_asignment_app/common/job/work_student.dart'; part 'annotate_list.g.dart'; -class AnnotateList extends StatefulWidget{ +class AnnotateList extends StatefulWidget { final int tabIndex; final int assessType; - const AnnotateList({Key? key,required this.tabIndex,required this.assessType}) : super(key: key); + + const AnnotateList( + {Key? key, required this.tabIndex, required this.assessType}) + : super(key: key); @override State createState() => _AnnotateListState(); } -class _AnnotateListState extends State with RequestToolMixin, SingleTickerProviderStateMixin{ +class _AnnotateListState extends State + with RequestToolMixin, SingleTickerProviderStateMixin { late RxString customTimeStr = '自定义'.obs; int active = 1; late RxList unAnnotateList = RxList(); @@ -47,10 +51,12 @@ class _AnnotateListState extends State with RequestToolMixin, Sing WorkStudentParams params2 = WorkStudentParams( assessType: 0, pageSize: 10, + startDate: Utils.getWeekStartDate().toString().substring(0, 10), + endDate: Utils.getWeekEndDate().toString().substring(0, 10), ); @override - void initState(){ + void initState() { super.initState(); params.assessType = widget.assessType; params2.assessType = widget.assessType; @@ -95,19 +101,18 @@ class _AnnotateListState extends State with RequestToolMixin, Sing tab == 1 ? (markingDatas1 = lists) : (markingDatas2 = lists); } catch (e) {} toUpState(setState, () {}, mounted);*/ - if(widget.tabIndex == 0){ + if (widget.tabIndex == 0) { getUnAnnotateList(); - }else{ + } else { getAnnotateList(); } - } Future getCollect(item) async { await getClient().getCollect(item.id); - if(widget.tabIndex == 0){ + if (widget.tabIndex == 0) { getUnAnnotateList(); - }else{ + } else { getAnnotateList(); } } @@ -128,45 +133,63 @@ class _AnnotateListState extends State with RequestToolMixin, Sing return Column( children: [ if(widget.tabIndex == 1) - JobConditionFilter( - customTimeStr: customTimeStr.value, - controller: tabController2, - hasAll: true, - jobType: 1, - customTime: tabController2.index != 3 || (params2.startDate == null && params2.endDate == null) - ? null - : PickerDateRange( - params2.startDate == null ? null : DateTime.parse(params2.startDate!), - params2.endDate == null ? null : DateTime.parse(params2.endDate!), - ), - onTimeFilter: (String? startTime, String? endTime) { - if (startTime == null && endTime == null && tabController2.index == 3) { - tabController2.animateTo(0); - } - params2.endDate = endTime; - params2.startDate = startTime; - page = 1; - if(widget.tabIndex == 0){ - getUnAnnotateList(); - }else{ - getAnnotateList(); - } - // refreshController2.callRefresh(); - }, - refreshTime: (value) { - if (value != null && value.startDate != null) { - customTimeStr.value = value.startDate?.toString().substring(0, 10) ?? ''; - - if (value.endDate != null) { - if (!Utils.isPad() && value.startDate!.year == value.endDate!.year) { - customTimeStr.value = - '${value.startDate.toString().substring(5, 10)}~${value.endDate.toString().substring(5, 10)}'; + Obx(() { + return JobConditionFilter( + customTimeStr: customTimeStr.value, + controller: tabController2, + hasAll: true, + jobType: 1, + customTime: tabController2.index != 2 || + (params2.startDate == null && params2.endDate == null) + ? null + : PickerDateRange( + params2.startDate == null ? null : DateTime.parse( + params2.startDate!), + params2.endDate == null ? null : DateTime.parse( + params2.endDate!), + ), + onTimeFilter: (String? startTime, String? endTime) { + if (startTime == null && endTime == null && + tabController2.index == 2) { + tabController2.animateTo(0); + params2.endDate = + Utils.getWeekEndDate().toString().substring(0, 10); + params2.startDate = + Utils.getWeekStartDate().toString().substring(0, 10); + customTimeStr.value = '自定义'; } else { - customTimeStr.value = '${customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}'; + params2.endDate = endTime; + params2.startDate = startTime; } - } - } - }), + page = 1; + EasyLoading.show(status: 'loading...'); + if (widget.tabIndex == 0) { + getUnAnnotateList(); + } else { + getAnnotateList(); + } + // refreshController2.callRefresh(); + }, + refreshTime: (value) { + if (value != null && value.startDate != null) { + customTimeStr.value = + value.startDate?.toString().substring(0, 10) ?? ''; + + if (value.endDate != null) { + if (!Utils.isPad() && + value.startDate!.year == value.endDate!.year) { + customTimeStr.value = + '${value.startDate.toString().substring(5, 10)}~${value + .endDate.toString().substring(5, 10)}'; + } else { + customTimeStr.value = + '${customTimeStr.value}~${value.endDate?.toString() + .substring(0, 10)}'; + } + } + } + }); + }), Expanded(child: IndexedStack( index: widget.tabIndex, children: [ @@ -199,8 +222,10 @@ class _AnnotateListState extends State with RequestToolMixin, Sing @swidget Widget $easyRefresh({ required EasyRefreshController controller, - required Future Function(EasyRefreshController controller, int tab) onRefresh, - required Future 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 data, required int tab, required int type, @@ -220,7 +245,8 @@ Widget $easyRefresh({ footer: TaurusFooter(), child: completed && isPadFlag ? GridView( - padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w), + padding: EdgeInsets.only( + top: 11.h, bottom: 10.h, left: 12.w, right: 12.w), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, //横轴三个子widget mainAxisSpacing: 10.h, @@ -230,19 +256,24 @@ Widget $easyRefresh({ children: List.generate(data.length, (index) { Items item = data[index]; String subjectName = EnumUtils.formatSubject(item.subject); - return $reviewedItem(jobTaskItem: item, type: type, subjectName: subjectName, collectFun: collectFun,tabIndex:tab - 1); + return $reviewedItem(jobTaskItem: item, + type: type, + subjectName: subjectName, + collectFun: collectFun, + tabIndex: tab - 1); }), ) : ListView.builder( - padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w), + 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, - collectFun: collectFun, - tabIndex:tab - 1 + completed: completed, + jobTaskItem: item, + type: type, + collectFun: collectFun, + tabIndex: tab - 1 ); }, itemCount: data.length, @@ -266,10 +297,17 @@ Widget $reviewedItem({ return InkWell( onTap: () { Get.toNamed(Routes.annotateClassPage, - arguments: {'id': jobTaskItem.id, 'name': jobTaskItem.name, 'grade': jobTaskItem.grade,'subject':jobTaskItem.subject, 'completed': true,'tabIndex':tabIndex}); + arguments: { + 'id': jobTaskItem.id, + 'name': jobTaskItem.name, + 'grade': jobTaskItem.grade, + 'subject': jobTaskItem.subject, + 'completed': true, + 'tabIndex': tabIndex + }); }, child: Container( - padding: EdgeInsets.only(right: 5.w), + padding: EdgeInsets.only(top: 10.h), decoration: BoxDecoration( borderRadius: BorderRadius.circular(6.r), color: Colors.white, @@ -286,39 +324,47 @@ Widget $reviewedItem({ mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ // 顶部任务名称 - Row( - crossAxisAlignment: CrossAxisAlignment.start, + Padding( + padding: padEdg, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 32.w, - height: 18.h, - alignment: Alignment.center, - padding: EdgeInsets.only(left: 2.w), - decoration: BoxDecoration( - color: type == 1 ? const Color(0xFFB2DA93) : const Color(0xFFEF8714), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(6.r), - topRight: Radius.circular(0.r), - bottomLeft: Radius.circular(0.r), - bottomRight: Radius.circular(12.r), + children: [ + Container( + width: 32.w, + height: 18.h, + alignment: Alignment.center, + padding: EdgeInsets.only(left: 2.w), + decoration: BoxDecoration( + color: type == 1 ? const Color(0xFF4CC793) : 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(top: 3.h, right: 4.w), + child: quickText(type == 1 ? '作业' : '考试', color: Colors.white, + size: 10.sp), ), - margin: EdgeInsets.only(top:0.h,right: 4.w), - child: quickText(type == 1 ? '作业' : '考试', color: Colors.white, size: 10.sp), - ), - Expanded( - child: quickText(jobTaskItem.name, size: 14.sp, color: const Color.fromRGBO(70, 70, 70, 1), maxLines: 2), - ), - if (jobTaskItem.isFixed!) - Padding( - padding: EdgeInsets.only(top: 3.r), - child: Text( - '已订正', - style: TextStyle(fontSize: 10.sp, color: const Color(0xFFF16262)), + Expanded( + child: quickText(jobTaskItem.name, size: 14.sp, + color: const Color.fromRGBO(70, 70, 70, 1), + maxLines: 2), + ), + if (jobTaskItem.isFixed!) + Padding( + padding: EdgeInsets.only(top: 3.r), + child: Text( + '已订正', + style: TextStyle( + fontSize: 10.sp, color: const Color(0xFFF16262)), + ), ), - ), - ], + ], + ), ), Padding( @@ -327,26 +373,31 @@ Widget $reviewedItem({ 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(0xFF8C68FF), size: 10.sp, fontWeight: FontWeight.w500), + quickText(' / ', color: const Color.fromRGBO(76, 199, 147, 1), + size: 10.sp, + fontWeight: FontWeight.w500), quickText( '参与班级:', - color: const Color(0xFF8C68FF), + color: const Color.fromRGBO(76, 199, 147, 1), size: 9.sp, ), quickText( '${jobTaskItem.classCount}', - color: const Color(0xFF8C68FF), + color: const Color.fromRGBO(76, 199, 147, 1), size: 10.sp, ), - quickText(' / ', color: const Color(0xFF8C68FF), size: 10.sp, fontWeight: FontWeight.w500), + quickText(' / ', color: const Color.fromRGBO(116, 145, 253, 1), + size: 10.sp, + fontWeight: FontWeight.w500), quickText( '科目:$subjectName', - color: const Color(0xFF8C68FF), + color: const Color.fromRGBO(116, 145, 253, 1), size: 9.sp, ), ], @@ -363,7 +414,8 @@ Widget $reviewedItem({ Container( padding: EdgeInsets.symmetric(vertical: 6.h), decoration: BoxDecoration( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), bottomRight: Radius.circular(6.r)), + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), + bottomRight: Radius.circular(6.r)), color: Colors.white, boxShadow: const [ BoxShadow( @@ -375,7 +427,7 @@ Widget $reviewedItem({ ], ), child: Row(children: [ - /*if (!jobTaskItem.isFixed!) + if (!jobTaskItem.isFixed!) Expanded( flex: 1, child: GestureDetector( @@ -389,23 +441,31 @@ Widget $reviewedItem({ child: Container( alignment: Alignment.center, decoration: BoxDecoration( - border: Border(right: BorderSide(width: 1.r, color: const Color(0xFFDCDCDC))), + border: Border(right: BorderSide( + width: 1.r, color: const Color(0xFFDCDCDC))), ), - child: quickText('收集订正', color: const Color(0xFF8C68FF), size: 11.sp), + child: quickText( + '收集订正', color: const Color(0xFF4CC793), size: 11.sp), ), ), - ),*/ + ), Expanded( flex: 1, child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Get.toNamed(Routes.jobReportPage, - arguments: {'title': jobTaskItem.name, 'homeworkId': jobTaskItem.id, 'grade': jobTaskItem.grade}); + 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), size: 11.sp), + child: quickText( + '查看报告', color: const Color.fromRGBO(118, 118, 118, 1), + size: 11.sp), ), ), ), diff --git a/making_school_asignment_app/lib/page/home_page/children/student_work_detail/widget/job_condition_filter.dart b/making_school_asignment_app/lib/page/home_page/children/student_work_detail/widget/job_condition_filter.dart index e33210d..fa8de0f 100644 --- a/making_school_asignment_app/lib/page/home_page/children/student_work_detail/widget/job_condition_filter.dart +++ b/making_school_asignment_app/lib/page/home_page/children/student_work_detail/widget/job_condition_filter.dart @@ -70,14 +70,14 @@ class _JobConditionFilterState extends State { customTimeStr: widget.customTimeStr, hasAll: widget.hasAll, onTap: (int val) async { - if (val == 0 && widget.hasAll == true) { + if (val == 3 && widget.hasAll == true) { widget.onTimeFilter(null, null); - } else if ((val == 1 && widget.hasAll == true) || (val == 0 && widget.hasAll == false)) { + } else if ((val == 0 && widget.hasAll == true) || (val == 0 && widget.hasAll == false)) { widget.onTimeFilter( Utils.getWeekStartDate().toString().substring(0, 10), Utils.getWeekEndDate().toString().substring(0, 10), ); - } else if ((val == 2 && widget.hasAll == true) || (val == 1 && widget.hasAll == false)) { + } else if ((val == 1 && widget.hasAll == true) || (val == 1 && widget.hasAll == false)) { widget.onTimeFilter( getMonthStartDate().toString().substring(0, 10), getMonthEndDate().toString().substring(0, 10), diff --git a/making_school_asignment_app/lib/page/home_page/children/student_work_detail/widget/personal_detail_topbar.dart b/making_school_asignment_app/lib/page/home_page/children/student_work_detail/widget/personal_detail_topbar.dart index 3924fd0..2d8459b 100644 --- a/making_school_asignment_app/lib/page/home_page/children/student_work_detail/widget/personal_detail_topbar.dart +++ b/making_school_asignment_app/lib/page/home_page/children/student_work_detail/widget/personal_detail_topbar.dart @@ -13,10 +13,10 @@ class PersonalDetailTopBar extends StatefulWidget { } class _PersonalDetailTopBarState extends State { - @override - void initState(){ - super.initState(); - } + @override + void initState(){ + super.initState(); + } @override Widget build(BuildContext context) { @@ -33,26 +33,26 @@ class _PersonalDetailTopBarState extends State { labelStyle: TextStyle( fontSize: 12.sp, fontWeight: FontWeight.bold, - color: const Color(0xFF8C68FF), + color: const Color(0xFF4CC793), ), isScrollable: true, - labelColor:const Color(0xFF8C68FF), + labelColor: const Color(0xFF4CC793), unselectedLabelColor: const Color(0xFF505E6E), padding: EdgeInsets.symmetric(horizontal: 14.r), // indicatorSize: TabBarIndicatorSize.label, // 设置指示器高度和标签一样高 onTap: widget.onTap, indicator: UnderlineTabIndicator( borderSide: BorderSide( - width: 2.r, - color:const Color(0xFF8C68FF) + width: 2.r, + color:const Color(0xFF4CC793) ), ), tabs: [ - if(widget.hasAll == true) - const Tab(text: '全部'), const Tab(text: '近一周'), const Tab(text: '近一月'), Tab(text: widget.customTimeStr), + if(widget.hasAll == true) + const Tab(text: '全部'), ], ), );