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 f9298a7..cdf1d1a 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 @@ -37,20 +37,23 @@ class _AnnotateListState extends State int active = 1; late RxList unAnnotateList = RxList(); late RxList annotateList = RxList(); - late int page = 1; + // late int page = 1; late TabController tabController2; + /* 待阅卷 */ late final EasyRefreshController refreshController1; late final EasyRefreshController refreshController2; WorkStudentParams params = WorkStudentParams( assessType: 0, pageSize: 10, + pageNumber: 1, ); WorkStudentParams params2 = WorkStudentParams( assessType: 0, pageSize: 10, + pageNumber: 1, startDate: Utils.getWeekStartDate().toString().substring(0, 10), endDate: Utils.getWeekEndDate().toString().substring(0, 10), ); @@ -67,32 +70,41 @@ class _AnnotateListState extends State EasyLoading.show(status: 'loading...'); getUnAnnotateList(); getAnnotateList(); - } //待批阅列表 void getUnAnnotateList() async { WorkStudent data = WorkStudent([], 0); - params.pageNumber = page; data = await getClient().getUnAnnotateList(params); - unAnnotateList.value = data.items; + if (params.pageNumber == 1) { + unAnnotateList.value = data.items; + } else { + List list = unAnnotateList.value; + unAnnotateList.value = [...list,...data.items]; + } refreshController1.finishRefresh(); refreshController2.finishRefresh(); EasyLoading.dismiss(); print('state.unAnnotateList.length=${unAnnotateList.length}'); } + //已批阅列表 void getAnnotateList() async { WorkStudent data = WorkStudent([], 0); - params2.pageNumber = page; data = await getClient().getAnnotatedList(params2); + if (params2.pageNumber == 1) { + annotateList.value = data.items; + } else { + List list = annotateList.value; + annotateList.value = [...list,...data.items]; + } - annotateList.value = data.items; refreshController1.finishRefresh(); refreshController2.finishRefresh(); EasyLoading.dismiss(); print('state.annotateList.length=${annotateList.length}'); } + /// 刷新方法 Future onMyRefresh(EasyRefreshController controller, int tab) async { /* params.page = RequestConfig.basePage.page; @@ -102,8 +114,10 @@ class _AnnotateListState extends State } catch (e) {} toUpState(setState, () {}, mounted);*/ if (widget.tabIndex == 0) { + params.pageNumber = 1; getUnAnnotateList(); } else { + params2.pageNumber = 1; getAnnotateList(); } } @@ -125,14 +139,20 @@ class _AnnotateListState extends State tab == 1 ? markingDatas1.addAll(lists) : markingDatas2.addAll(lists); toUpState(setState, () {}, mounted); }*/ + if (widget.tabIndex == 0) { + params.pageNumber++; + getUnAnnotateList(); + } else { + params2.pageNumber++; + getAnnotateList(); + } } - @override Widget build(BuildContext context) { return Column( children: [ - if(widget.tabIndex == 1) + if (widget.tabIndex == 1) Obx(() { return JobConditionFilter( customTimeStr: customTimeStr.value, @@ -140,16 +160,19 @@ class _AnnotateListState extends State hasAll: true, jobType: 1, customTime: tabController2.index != 2 || - (params2.startDate == null && params2.endDate == null) + (params2.startDate == null && params2.endDate == null) ? null : PickerDateRange( - params2.startDate == null ? null : DateTime.parse( - params2.startDate!), - params2.endDate == null ? null : DateTime.parse( - params2.endDate!), - ), + 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 && + if (startTime == null && + endTime == null && tabController2.index == 2) { tabController2.animateTo(0); params2.endDate = @@ -161,7 +184,7 @@ class _AnnotateListState extends State params2.endDate = endTime; params2.startDate = startTime; } - page = 1; + params2.pageNumber = 1; EasyLoading.show(status: 'loading...'); if (widget.tabIndex == 0) { getUnAnnotateList(); @@ -179,18 +202,17 @@ class _AnnotateListState extends State if (!Utils.isPad() && value.startDate!.year == value.endDate!.year) { customTimeStr.value = - '${value.startDate.toString().substring(5, 10)}~${value - .endDate.toString().substring(5, 10)}'; + '${value.startDate.toString().substring(5, 10)}~${value.endDate.toString().substring(5, 10)}'; } else { customTimeStr.value = - '${customTimeStr.value}~${value.endDate?.toString() - .substring(0, 10)}'; + '${customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}'; } } } }); }), - Expanded(child: IndexedStack( + Expanded( + child: IndexedStack( index: widget.tabIndex, children: [ $EasyRefresh( @@ -222,10 +244,10 @@ class _AnnotateListState extends State @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 Function(EasyRefreshController controller, int tab) + onRefresh, + required Future Function(EasyRefreshController controller, int tab) + onLoad, required List data, required int tab, required int type, @@ -245,39 +267,39 @@ 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 //宽高比为1时,子widget - ), - 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); - }), - ) + 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 //宽高比为1时,子widget + ), + 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); + }), + ) : 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, - collectFun: collectFun, - tabIndex: tab - 1 - ); - }, - 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, + collectFun: collectFun, + tabIndex: tab - 1); + }, + itemCount: data.length, + ), onRefresh: () => onRefresh(controller, tab), onLoad: () => onLoad(controller, tab), ); @@ -296,15 +318,14 @@ 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 - }); + Get.toNamed(Routes.annotateClassPage, arguments: { + 'id': jobTaskItem.id, + 'name': jobTaskItem.name, + 'grade': jobTaskItem.grade, + 'subject': jobTaskItem.subject, + 'completed': true, + 'tabIndex': tabIndex + }); }, child: Container( padding: EdgeInsets.only(top: 10.h), @@ -328,7 +349,6 @@ Widget $reviewedItem({ padding: padEdg, child: Row( crossAxisAlignment: CrossAxisAlignment.start, - children: [ Container( width: 32.w, @@ -336,8 +356,9 @@ Widget $reviewedItem({ alignment: Alignment.center, padding: EdgeInsets.only(left: 2.w), decoration: BoxDecoration( - color: type == 1 ? const Color(0xFF4CC793) : const Color - .fromRGBO(255, 175, 56, 1), + 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), @@ -346,11 +367,12 @@ Widget $reviewedItem({ ), ), margin: EdgeInsets.only(top: 3.h, 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), ), @@ -373,13 +395,15 @@ 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.fromRGBO(76, 199, 147, 1), + quickText(' / ', + color: const Color.fromRGBO(76, 199, 147, 1), size: 10.sp, fontWeight: FontWeight.w500), quickText( @@ -392,7 +416,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( @@ -414,7 +439,8 @@ Widget $reviewedItem({ Container( padding: EdgeInsets.symmetric(vertical: 6.h), decoration: BoxDecoration( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(6.r), bottomRight: Radius.circular(6.r)), color: Colors.white, boxShadow: const [ @@ -441,11 +467,12 @@ 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(0xFF4CC793), size: 11.sp), + child: quickText('收集订正', + color: const Color(0xFF4CC793), size: 11.sp), ), ), ), @@ -454,17 +481,16 @@ Widget $reviewedItem({ child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - Get.toNamed(Routes.jobReportPage, - arguments: { - 'title': jobTaskItem.name, - 'homeworkId': jobTaskItem.id, - 'grade': jobTaskItem.grade - }); + 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), ), ), diff --git a/making_school_asignment_app/macos/Flutter/GeneratedPluginRegistrant.swift b/making_school_asignment_app/macos/Flutter/GeneratedPluginRegistrant.swift index fda7e50..043340e 100644 --- a/making_school_asignment_app/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/making_school_asignment_app/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,7 +5,6 @@ import FlutterMacOS import Foundation -import app_settings import auto_updater_macos import connectivity_plus import device_info_plus @@ -15,7 +14,6 @@ import sqflite import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - AppSettingsPlugin.register(with: registry.registrar(forPlugin: "AppSettingsPlugin")) AutoUpdaterMacosPlugin.register(with: registry.registrar(forPlugin: "AutoUpdaterMacosPlugin")) ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))