Merge branch 'mcy_new' into new_main

This commit is contained in:
machuanyu 2024-06-12 14:56:56 +08:00
commit 9421c6e90e
16 changed files with 911 additions and 576 deletions

View File

@ -28,10 +28,6 @@ class UserStore extends GetxController with RequestToolMixin {
// //
RxList<EnumSubject> gradeList = RxList(); RxList<EnumSubject> gradeList = RxList();
RxInt readOver = 0.obs;
RxInt assessType = 0.obs;
UserStore init() { UserStore init() {
token = StorageService.to.read(AppStorageKey.token.value); token = StorageService.to.read(AppStorageKey.token.value);
xToken = StorageService.to.read(AppStorageKey.xToken.value); xToken = StorageService.to.read(AppStorageKey.xToken.value);

View File

@ -47,7 +47,11 @@ class MyApp extends StatelessWidget {
primaryTextTheme: TextTheme( primaryTextTheme: TextTheme(
bodyLarge: TextStyle(fontSize: 14.sp, color: Colors.black87), bodyLarge: TextStyle(fontSize: 14.sp, color: Colors.black87),
), ),
useMaterial3: true, useMaterial3: false,
colorScheme: const ColorScheme.light(
//
primary: Color.fromRGBO(46, 91, 255, 1),
)
), ),
enableLog: true, enableLog: true,
logWriterCallback: (text, {bool isError = false}) { logWriterCallback: (text, {bool isError = false}) {

View File

@ -17,6 +17,7 @@ class AnnotateClassLogic extends GetxController with RequestToolMixin {
state.homeworkId.value = Get.arguments['id'] ?? ''; state.homeworkId.value = Get.arguments['id'] ?? '';
state.name.value = Get.arguments['name'] ?? ''; state.name.value = Get.arguments['name'] ?? '';
state.grade = Get.arguments['grade']; state.grade = Get.arguments['grade'];
state.subject = Get.arguments['subject'];
state.completed.value = Get.arguments['completed'] ?? false; state.completed.value = Get.arguments['completed'] ?? false;
EasyLoading.show(status: 'loading...'); EasyLoading.show(status: 'loading...');
getList(); getList();

View File

@ -11,4 +11,5 @@ class AnnotateClassState {
late RxString homeworkId = ''.obs; late RxString homeworkId = ''.obs;
late RxBool completed = false.obs; late RxBool completed = false.obs;
late int grade; late int grade;
late int subject;
} }

View File

@ -13,76 +13,16 @@ import 'read_over_state.dart';
class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProviderStateMixin { class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProviderStateMixin {
final ReadOverState state = ReadOverState(); final ReadOverState state = ReadOverState();
late TabController tabController; late TabController tabController;
late TabController tabController2;
/* 待阅卷 */
late final EasyRefreshController refreshController1;
late final EasyRefreshController refreshController2;
WorkStudentParams params = WorkStudentParams(
assessType: UserStore.to.assessType.value,
pageSize: 10,
);
WorkStudentParams params2 = WorkStudentParams(
assessType: UserStore.to.assessType.value,
pageSize: 10,
);
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
refreshController1 = EasyRefreshController(); state.tabIndex.value = 0;
refreshController2 = EasyRefreshController();
tabController = TabController( tabController = TabController(
length: 2, length: 2,
vsync: this, vsync: this,
); );
tabController2 = TabController(length: 4, vsync: this);
EasyLoading.show(status: 'loading...');
getList();
}
//
void getList() async {
WorkStudent data = WorkStudent([], 0);
if (state.tabIndex.value == 0) {
params.pageNumber = state.page;
data = await getClient().getUnAnnotateList(params);
} else {
params2.pageNumber = state.page;
data = await getClient().getAnnotatedList(params2);
}
state.workList.value = data.items;
refreshController1.finishRefresh();
refreshController2.finishRefresh();
EasyLoading.dismiss();
print('state.workList.length=${state.workList.length}');
}
///
Future<void> onMyRefresh(EasyRefreshController controller, int tab) async {
/* params.page = RequestConfig.basePage.page;
List<JobTaskItem> lists = await getData(controller, params, isReFresh: true);
try {
tab == 1 ? (markingDatas1 = lists) : (markingDatas2 = lists);
} catch (e) {}
toUpState(setState, () {}, mounted);*/
getList();
}
void getCollect(item) async {
await getClient().getCollect(item.id);
getList();
}
///
Future<void> onMyLoad(EasyRefreshController controller, int tab) async {
/*params.page++;
List<JobTaskItem> lists = await getData(controller, params);
if (lists.isNotEmpty) {
tab == 1 ? markingDatas1.addAll(lists) : markingDatas2.addAll(lists);
toUpState(setState, () {}, mounted);
}*/
} }
/* Future<void> showStudents( /* Future<void> showStudents(
@ -151,8 +91,8 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
void dispose() { void dispose() {
super.dispose(); super.dispose();
tabController.dispose(); tabController.dispose();
tabController2.dispose(); /* tabController2.dispose();
refreshController1.dispose(); refreshController1.dispose();
refreshController2.dispose(); refreshController2.dispose();*/
} }
} }

View File

@ -1,15 +1,14 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/work_student.dart';
class ReadOverState { class ReadOverState {
ReadOverState() { ReadOverState() {
///Initialize variables ///Initialize variables
} }
int active = 1;
late RxList<Items> workList = RxList();
late RxInt tabIndex = 0.obs; late RxInt tabIndex = 2.obs;
late bool completedToRefresh = true; late bool completedToRefresh = true;
late RxString customTimeStr = '自定义'.obs; late RxString customTimeStr = '自定义'.obs;
late int page = 1;
} }

View File

@ -10,13 +10,13 @@ import 'package:making_school_asignment_app/common/utils/enum_untils.dart';
import 'package:making_school_asignment_app/common/utils/utils.dart'; import 'package:making_school_asignment_app/common/utils/utils.dart';
import 'package:making_school_asignment_app/page/global_widget/MyEmptyWidget.dart'; import 'package:making_school_asignment_app/page/global_widget/MyEmptyWidget.dart';
import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
import 'package:making_school_asignment_app/page/home_page/children/read_over/widget/annotate_list.dart';
import 'package:making_school_asignment_app/page/home_page/children/read_over/widget/task_list_item.dart'; import 'package:making_school_asignment_app/page/home_page/children/read_over/widget/task_list_item.dart';
import 'package:making_school_asignment_app/page/home_page/children/student_work_detail/widget/job_condition_filter.dart'; import 'package:making_school_asignment_app/page/home_page/children/student_work_detail/widget/job_condition_filter.dart';
import 'package:making_school_asignment_app/routes/app_pages.dart'; import 'package:making_school_asignment_app/routes/app_pages.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart'; import 'package:syncfusion_flutter_datepicker/datepicker.dart';
import 'read_over_logic.dart'; import 'read_over_logic.dart';
part 'read_over_view.g.dart';
class ReadOverPage extends StatefulWidget { class ReadOverPage extends StatefulWidget {
const ReadOverPage({Key? key}) : super(key: key); const ReadOverPage({Key? key}) : super(key: key);
@ -27,7 +27,9 @@ class ReadOverPage extends StatefulWidget {
class _ReadOverPageState extends State<ReadOverPage> { class _ReadOverPageState extends State<ReadOverPage> {
final logic = Get.find<ReadOverLogic>(); final logic = Get.find<ReadOverLogic>();
final state = Get.find<ReadOverLogic>().state; final state = Get
.find<ReadOverLogic>()
.state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -48,7 +50,10 @@ class _ReadOverPageState extends State<ReadOverPage> {
children: <Widget>[ children: <Widget>[
Container( Container(
color: Colors.white, 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), padding: EdgeInsets.only(bottom: 9.h, top: 4.h),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -93,7 +98,13 @@ class _ReadOverPageState extends State<ReadOverPage> {
color: const Color.fromRGBO(104, 136, 253, 1), color: const Color.fromRGBO(104, 136, 253, 1),
), ),
// labelColor: const Color.fromRGBO(45, 56, 76, 1), // labelColor: const Color.fromRGBO(45, 56, 76, 1),
indicator: const BoxDecoration(), indicator: const UnderlineTabIndicator(
borderSide: BorderSide(
width: 0, // 0线
color: Colors.transparent
),
),
onTap: (index) { onTap: (index) {
state.tabIndex.value = index; state.tabIndex.value = index;
if (index == 1 && state.completedToRefresh) { if (index == 1 && state.completedToRefresh) {
@ -101,7 +112,6 @@ class _ReadOverPageState extends State<ReadOverPage> {
// _refreshController2.callRefresh(); // _refreshController2.callRefresh();
state.completedToRefresh = false; state.completedToRefresh = false;
} }
logic.getList();
}, },
tabs: <Widget>[ tabs: <Widget>[
Tab( Tab(
@ -112,14 +122,23 @@ class _ReadOverPageState extends State<ReadOverPage> {
width: 140.w, width: 140.w,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: state.tabIndex.value == 0 ? const Color.fromRGBO(255, 255, 255, 1) : null, color: state.tabIndex.value == 0
borderRadius: BorderRadius.all(Radius.circular(8.r)), ? const Color.fromRGBO(
255, 255, 255, 1)
: null,
borderRadius: BorderRadius.all(
Radius.circular(8.r)),
), ),
child: quickText( child: quickText(
'待批阅', '待批阅',
size: 14.sp, 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
fontWeight: state.tabIndex.value == 0 ? FontWeight.bold : null, .of(context)
.primaryColor : const Color.fromRGBO(
80, 94, 110, 1),
fontWeight: state.tabIndex.value == 0
? FontWeight.bold
: null,
), ),
); );
}), }),
@ -132,14 +151,23 @@ class _ReadOverPageState extends State<ReadOverPage> {
width: 140.w, width: 140.w,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: state.tabIndex.value == 1 ? const Color.fromRGBO(255, 255, 255, 1) : null, color: state.tabIndex.value == 1
borderRadius: BorderRadius.all(Radius.circular(8.r)), ? const Color.fromRGBO(
255, 255, 255, 1)
: null,
borderRadius: BorderRadius.all(
Radius.circular(8.r)),
), ),
child: quickText( child: quickText(
'已批阅', '已批阅',
size: 14.sp, 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
fontWeight: state.tabIndex.value == 1 ? FontWeight.bold : null, .of(context)
.primaryColor : const Color.fromRGBO(
80, 94, 110, 1),
fontWeight: state.tabIndex.value == 1
? FontWeight.bold
: null,
), ),
); );
}), }),
@ -152,76 +180,22 @@ class _ReadOverPageState extends State<ReadOverPage> {
flex: 1, flex: 1,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Get.toNamed(Routes.studentHistoryWorkPage, arguments: {'page': 'set'}); Get.toNamed(Routes.studentHistoryWorkPage,
arguments: {'page': 'set'});
}, },
child: Icon(const IconData(0xe63e, fontFamily: "AlibabaIcon"), color: const Color.fromRGBO(44, 48, 63, 1), size: 24.sp), child: Icon(
const IconData(0xe63e, fontFamily: "AlibabaIcon"),
color: const Color.fromRGBO(44, 48, 63, 1),
size: 24.sp),
), ),
), ),
], ],
), ),
), ),
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(() { Expanded(child: Obx(() {
return IndexedStack( return AnnotateList(tabIndex: state.tabIndex.value,assessType: 0,);
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),
],
);
})),
], ],
); );
}, },
@ -236,229 +210,3 @@ class _ReadOverPageState extends State<ReadOverPage> {
super.dispose(); super.dispose();
} }
} }
///
/// 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 List<Items> data,
required int tab,
required int type,
required ReadOverLogic logic,
}) {
bool completed = tab == 2; //
bool isPadFlag = Utils.isPad();
return Obx(() {
return EasyRefresh(
firstRefresh: false,
taskIndependence: true,
/*enableControlFinishLoad: true,
enableControlFinishRefresh: true,*/
emptyWidget: data.isEmpty ? const MyEmptyWidget() : null,
controller: controller,
header: MaterialHeader(),
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, 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,
logic: logic,
);
},
itemCount: data.length,
),
onRefresh: () => onRefresh(controller, tab),
onLoad: () => onLoad(controller, tab),
);
});
}
@swidget
Widget $reviewedItem({
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});
},
child: Container(
padding: EdgeInsets.only(top: 10.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r),
color: Colors.white,
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: [
//
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.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(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: 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),
color: const Color.fromRGBO(97, 97, 97, 1),
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.fromRGBO(76, 199, 147, 1),
size: 9.sp,
),
quickText(
'${jobTaskItem.classCount}',
color: const Color.fromRGBO(76, 199, 147, 1),
size: 10.sp,
),
quickText(' / ', color: const Color.fromRGBO(116, 145, 253, 1), size: 10.sp, fontWeight: FontWeight.w500),
quickText(
'科目:$subjectName',
color: const Color.fromRGBO(116, 145, 253, 1),
size: 9.sp,
),
],
),
),
/*Padding(
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: FavoriteButton(
jobTaskItem.id,
jobTaskItem.title,
margin: EdgeInsets.only(top: 4.h, bottom: 6.h),
),
),*/
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), size: 11.sp),
),
),
),
]),
),
],
),
),
);
}

View File

@ -0,0 +1,420 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/work_student_params.dart';
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart';
import 'package:making_school_asignment_app/common/utils/enum_untils.dart';
import 'package:making_school_asignment_app/common/utils/utils.dart';
import 'package:making_school_asignment_app/page/global_widget/MyEmptyWidget.dart';
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
import 'package:making_school_asignment_app/page/home_page/children/read_over/widget/task_list_item.dart';
import 'package:making_school_asignment_app/page/home_page/children/student_work_detail/widget/job_condition_filter.dart';
import 'package:making_school_asignment_app/routes/app_pages.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
import 'package:making_school_asignment_app/common/job/work_student.dart';
part 'annotate_list.g.dart';
class AnnotateList extends StatefulWidget{
final int tabIndex;
final int assessType;
const AnnotateList({Key? key,required this.tabIndex,required this.assessType}) : super(key: key);
@override
State<AnnotateList> createState() => _AnnotateListState();
}
class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, SingleTickerProviderStateMixin{
late RxString customTimeStr = '自定义'.obs;
int active = 1;
late RxList<Items> unAnnotateList = RxList();
late RxList<Items> annotateList = RxList();
late int page = 1;
late TabController tabController2;
/* 待阅卷 */
late final EasyRefreshController refreshController1;
late final EasyRefreshController refreshController2;
WorkStudentParams params = WorkStudentParams(
assessType: 0,
pageSize: 10,
);
WorkStudentParams params2 = WorkStudentParams(
assessType: 0,
pageSize: 10,
);
@override
void initState(){
super.initState();
params.assessType = widget.assessType;
params2.assessType = widget.assessType;
refreshController1 = EasyRefreshController();
refreshController2 = EasyRefreshController();
tabController2 = TabController(length: 4, vsync: this);
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;
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);
annotateList.value = data.items;
refreshController1.finishRefresh();
refreshController2.finishRefresh();
EasyLoading.dismiss();
print('state.annotateList.length=${annotateList.length}');
}
///
Future<void> onMyRefresh(EasyRefreshController controller, int tab) async {
/* params.page = RequestConfig.basePage.page;
List<JobTaskItem> lists = await getData(controller, params, isReFresh: true);
try {
tab == 1 ? (markingDatas1 = lists) : (markingDatas2 = lists);
} catch (e) {}
toUpState(setState, () {}, mounted);*/
if(widget.tabIndex == 0){
getUnAnnotateList();
}else{
getAnnotateList();
}
}
Future<void> getCollect(item) async {
await getClient().getCollect(item.id);
if(widget.tabIndex == 0){
getUnAnnotateList();
}else{
getAnnotateList();
}
}
///
Future<void> onMyLoad(EasyRefreshController controller, int tab) async {
/*params.page++;
List<JobTaskItem> lists = await getData(controller, params);
if (lists.isNotEmpty) {
tab == 1 ? markingDatas1.addAll(lists) : markingDatas2.addAll(lists);
toUpState(setState, () {}, mounted);
}*/
}
@override
Widget build(BuildContext context) {
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)}';
} else {
customTimeStr.value = '${customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}';
}
}
}
}),
Expanded(child: IndexedStack(
index: widget.tabIndex,
children: <Widget>[
$EasyRefresh(
controller: refreshController1,
tab: 1,
type: active,
data: unAnnotateList,
onLoad: onMyLoad,
onRefresh: onMyRefresh,
collectFun: getCollect),
$EasyRefresh(
controller: refreshController2,
tab: 2,
type: active,
data: annotateList,
onLoad: onMyLoad,
onRefresh: onMyRefresh,
collectFun: getCollect),
],
)),
],
);
}
}
///
/// 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 List<Items> data,
required int tab,
required int type,
required Future<void> Function(Items item) collectFun,
}) {
bool completed = tab == 2; //
bool isPadFlag = Utils.isPad();
return Obx(() {
return EasyRefresh(
firstRefresh: false,
taskIndependence: true,
/*enableControlFinishLoad: true,
enableControlFinishRefresh: true,*/
emptyWidget: data.isEmpty ? const MyEmptyWidget() : null,
controller: controller,
header: MaterialHeader(),
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, collectFun: collectFun);
}),
)
: 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,
);
},
itemCount: data.length,
),
onRefresh: () => onRefresh(controller, tab),
onLoad: () => onLoad(controller, tab),
);
});
}
@swidget
Widget $reviewedItem({
required Items jobTaskItem,
required int type,
required String subjectName,
required Future<void> Function(Items item) collectFun,
}) {
EdgeInsets padEdg = EdgeInsets.symmetric(horizontal: 10.w);
return InkWell(
onTap: () {
Get.toNamed(Routes.annotateClassPage,
arguments: {'id': jobTaskItem.id, 'name': jobTaskItem.name, 'grade': jobTaskItem.grade,'subject':jobTaskItem.subject, 'completed': true});
},
child: Container(
padding: EdgeInsets.only(top: 10.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r),
color: Colors.white,
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: [
//
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.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(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: 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),
color: const Color.fromRGBO(97, 97, 97, 1),
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.fromRGBO(76, 199, 147, 1),
size: 9.sp,
),
quickText(
'${jobTaskItem.classCount}',
color: const Color.fromRGBO(76, 199, 147, 1),
size: 10.sp,
),
quickText(' / ', color: const Color.fromRGBO(116, 145, 253, 1), size: 10.sp, fontWeight: FontWeight.w500),
quickText(
'科目:$subjectName',
color: const Color.fromRGBO(116, 145, 253, 1),
size: 9.sp,
),
],
),
),
/*Padding(
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: FavoriteButton(
jobTaskItem.id,
jobTaskItem.title,
margin: EdgeInsets.only(top: 4.h, bottom: 6.h),
),
),*/
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...');
collectFun(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), size: 11.sp),
),
),
),
]),
),
],
),
),
);
}

View File

@ -16,9 +16,9 @@ class TaskListItem extends StatefulWidget {
final bool completed; final bool completed;
final Items jobTaskItem; final Items jobTaskItem;
final int type; final int type;
final ReadOverLogic logic; final Function(Items item) collectFun;
const TaskListItem({Key? key, required this.completed, required this.jobTaskItem, required this.type, required this.logic}) : super(key: key); const TaskListItem({Key? key, required this.completed, required this.jobTaskItem, required this.type, required this.collectFun}) : super(key: key);
@override @override
State<TaskListItem> createState() => _TaskListItemState(); State<TaskListItem> createState() => _TaskListItemState();
@ -31,7 +31,7 @@ class _TaskListItemState extends State<TaskListItem> {
? InkWell( ? InkWell(
onTap: () { onTap: () {
Get.toNamed(Routes.annotateClassPage, Get.toNamed(Routes.annotateClassPage,
arguments: {'id': widget.jobTaskItem.id, 'name': widget.jobTaskItem.name, 'grade': widget.jobTaskItem.grade, 'completed': true}); arguments: {'id': widget.jobTaskItem.id, 'name': widget.jobTaskItem.name, 'grade': widget.jobTaskItem.grade,'subject': widget.jobTaskItem.subject, 'completed': true});
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
@ -157,7 +157,7 @@ class _TaskListItemState extends State<TaskListItem> {
: InkWell( : InkWell(
onTap: () { onTap: () {
Get.toNamed(Routes.annotateClassPage, Get.toNamed(Routes.annotateClassPage,
arguments: {'id': widget.jobTaskItem.id, 'name': widget.jobTaskItem.name, 'grade': widget.jobTaskItem.grade}); arguments: {'id': widget.jobTaskItem.id, 'name': widget.jobTaskItem.name, 'grade': widget.jobTaskItem.grade,'subject':widget.jobTaskItem.subject,});
}, },
child: Stack( child: Stack(
alignment: const FractionalOffset(0.95, 0), alignment: const FractionalOffset(0.95, 0),
@ -247,7 +247,7 @@ class _TaskListItemState extends State<TaskListItem> {
onTap: () { onTap: () {
if (!widget.jobTaskItem.isFixed!) { if (!widget.jobTaskItem.isFixed!) {
EasyLoading.show(status: 'loading...'); EasyLoading.show(status: 'loading...');
widget.logic.getCollect(widget.jobTaskItem); widget.collectFun(widget.jobTaskItem);
} }
}, },
child: Container( child: Container(

View File

@ -41,6 +41,12 @@ class _PersonalDetailTopBarState extends State<PersonalDetailTopBar> {
padding: EdgeInsets.symmetric(horizontal: 14.r), padding: EdgeInsets.symmetric(horizontal: 14.r),
// indicatorSize: TabBarIndicatorSize.label, // // indicatorSize: TabBarIndicatorSize.label, //
onTap: widget.onTap, onTap: widget.onTap,
indicator: UnderlineTabIndicator(
borderSide: BorderSide(
width: 2.r,
color:const Color(0xFF7491FD)
),
),
tabs: <Widget>[ tabs: <Widget>[
if(widget.hasAll == true) if(widget.hasAll == true)
const Tab(text: '全部'), const Tab(text: '全部'),

View File

@ -23,7 +23,7 @@ class HomeLogic extends GetxController with RequestToolMixin, GetTickerProviderS
assessType: 0, assessType: 0,
); );
WorkStudent data = await getClient().getUnAnnotateList(params); WorkStudent data = await getClient().getUnAnnotateList(params);
UserStore.to.readOver.value = data.items.length; state.readOver.value = data.items.length;
state.workList.value = data.items; state.workList.value = data.items;
refreshController.finishRefresh(); refreshController.finishRefresh();
} }

View File

@ -9,7 +9,7 @@ class HomeState {
} }
late Rx<UserInfo?> userInfo; late Rx<UserInfo?> userInfo;
late RxInt readOver = UserStore.to.readOver; late RxInt readOver = 0.obs;
late RxList<Items> workList = RxList(); late RxList<Items> workList = RxList();
late int type = 1; late int type = 1;
} }

View File

@ -24,9 +24,12 @@ class HomePage extends StatefulWidget {
State<HomePage> createState() => _HomePageState(); State<HomePage> createState() => _HomePageState();
} }
class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin { class _HomePageState extends State<HomePage>
with AutomaticKeepAliveClientMixin {
final logic = Get.find<HomeLogic>(); final logic = Get.find<HomeLogic>();
final state = Get.find<HomeLogic>().state; final state = Get
.find<HomeLogic>()
.state;
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
@ -44,9 +47,15 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
statusBarIconBrightness: Brightness.dark, statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light, statusBarBrightness: Brightness.light,
), ),
child: EasyRefresh(
firstRefresh: false,
taskIndependence: true,
controller: logic.refreshController,
header: MaterialHeader(),
footer: TaurusFooter(),
child: Column( child: Column(
children: [ children: [
Container( /* Container(
height: 200.h, height: 200.h,
width: double.infinity, width: double.infinity,
decoration: const BoxDecoration( decoration: const BoxDecoration(
@ -55,23 +64,29 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
fit: BoxFit.fill, // fit: BoxFit.fill, //
), ),
), ),
), ),*/
SizedBox(height: 30.h), SizedBox(height: 30.h),
Obx(() { Obx(() {
return $TermRow([ return $TermRow([
EntranceModel(title: '作业批阅', image: 'assets/images/job_home_marking.png', navigationUrl: Routes.readOverPage), EntranceModel(title: '作业批阅',
image: 'assets/images/job_home_marking.png',
navigationUrl: Routes.readOverPage),
EntranceModel( EntranceModel(
title: '学生历史作业', title: '学生历史作业',
image: 'assets/images/job_home_history.png', image: 'assets/images/job_home_history.png',
navigationUrl: Routes.studentHistoryWorkPage, navigationUrl: Routes.studentHistoryWorkPage,
page: 'history', page: 'history',
), ),
EntranceModel(title: '知识点点掌握', image: 'assets/images/job_home_knowledge.png', navigationUrl: Routes.knowledgePointsGraspPage) EntranceModel(title: '知识点点掌握',
image: 'assets/images/job_home_knowledge.png',
navigationUrl: Routes.knowledgePointsGraspPage)
], state.readOver.value); ], state.readOver.value);
}), }),
spaceWidth, spaceWidth,
$TermRow([ $TermRow([
EntranceModel(title: '答题轨迹', image: 'assets/images/job_home_answer_record.png', navigationUrl: Routes.answerTrajectoryPage), EntranceModel(title: '答题轨迹',
image: 'assets/images/job_home_answer_record.png',
navigationUrl: Routes.answerTrajectoryPage),
EntranceModel( EntranceModel(
title: '优先批阅设定', title: '优先批阅设定',
image: 'assets/images/job_home_youxian.png', image: 'assets/images/job_home_youxian.png',
@ -89,28 +104,30 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
navigationUrl: '') navigationUrl: '')
], ],
0),*/ 0),*/
Expanded(child: Obx(() { SizedBox(height: 16.h),
return EasyRefresh( Obx(() {
firstRefresh: false, return Container(
taskIndependence: true, padding: EdgeInsets.symmetric(horizontal: 12.w),
controller: logic.refreshController, child: Column(
header: MaterialHeader(), children: List.generate(state.workList.length, (index) {
footer: TaurusFooter(),
child: ListView.builder(
padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
itemBuilder: (context, index) {
Items item = state.workList[index]; Items item = state.workList[index];
return InkWell( return InkWell(
onTap: () { onTap: () {
Get.toNamed(Routes.annotateClassPage, arguments: {'id': item.id, 'name': item.name, 'grade': item.grade}); Get.toNamed(Routes.annotateClassPage, arguments: {
'id': item.id,
'name': item.name,
'grade': item.grade,
'subject':item.subject,
});
}, },
child: Container( child: Container(
margin: EdgeInsets.only(bottom: 16.h), margin: EdgeInsets.only(bottom: 16.h),
child: Column( child: Column(
children: [ children: [
SizedBox(height: 30.h), SizedBox(height: 4.h),
Container( Container(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 10.w), padding: EdgeInsets.symmetric(
vertical: 16.h, horizontal: 10.w),
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r), borderRadius: BorderRadius.circular(6.r),
@ -125,18 +142,25 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
], ],
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment
.spaceBetween,
children: [ children: [
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment
.start,
children: [ children: [
Container( Container(
width: Utils.isPad() ? 32.w : 38.w, width: Utils.isPad() ? 32.w : 38.w,
height: 18.h, height: 18.h,
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.only(left: Utils.isPad() ? 2.w : 3.w), padding: EdgeInsets.only(
left: Utils.isPad() ? 2.w : 3.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: state.type == 1 ? const Color.fromRGBO(104, 136, 253, 1) : const Color.fromRGBO(255, 175, 56, 1), color: state.type == 1
? const Color.fromRGBO(
104, 136, 253, 1)
: const Color.fromRGBO(
255, 175, 56, 1),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(14.r), topLeft: Radius.circular(14.r),
topRight: Radius.circular(3.r), topRight: Radius.circular(3.r),
@ -145,14 +169,17 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
), ),
), ),
margin: EdgeInsets.only(right: 4.w), margin: EdgeInsets.only(right: 4.w),
child: quickText(state.type == 1 ? '作业' : '考试', color: Colors.white, size: 10.sp), child: quickText(
state.type == 1 ? '作业' : '考试',
color: Colors.white, size: 10.sp),
), ),
Expanded( Expanded(
child: quickText( child: quickText(
item.name, item.name,
maxLines: 2, maxLines: 2,
size: Utils.isPad() ? 14.sp : 16.sp, size: Utils.isPad() ? 14.sp : 16.sp,
color: const Color.fromRGBO(70, 70, 70, 1), color: const Color.fromRGBO(
70, 70, 70, 1),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
) )
@ -164,26 +191,41 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
children: [ children: [
quickText( quickText(
EnumUtils.formatSubject(item.subject), EnumUtils.formatSubject(item.subject),
color: const Color.fromRGBO(97, 97, 97, 1), color: const Color.fromRGBO(
97, 97, 97, 1),
size: 12.sp, size: 12.sp,
), ),
quickText(' / ', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500), quickText(' / ',
Container( color: const Color.fromRGBO(
child: Row( 130, 130, 130, 1),
crossAxisAlignment: CrossAxisAlignment.end, size: 11.sp,
fontWeight: FontWeight.w500),
Row(
crossAxisAlignment: CrossAxisAlignment
.end,
children: [ children: [
quickText('题量:', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp), quickText('题量:',
color: const Color.fromRGBO(
130, 130, 130, 1),
size: 11.sp),
quickText( quickText(
'10', '10',
color: const Color.fromRGBO(97, 97, 97, 1), color: const Color.fromRGBO(
97, 97, 97, 1),
size: 13.sp, size: 13.sp,
), ),
], ],
), ),
), quickText(' / ',
quickText(' / ', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500), color: const Color.fromRGBO(
quickText(DateTime.parse(item.publishTime).toString().substring(0, 10), 130, 130, 130, 1),
color: const Color.fromRGBO(97, 97, 97, 1), size: 12.sp), size: 11.sp,
fontWeight: FontWeight.w500),
quickText(DateTime.parse(item.publishTime)
.toString()
.substring(0, 10),
color: const Color.fromRGBO(
97, 97, 97, 1), size: 12.sp),
], ],
), ),
SizedBox(height: 10.h), SizedBox(height: 10.h),
@ -192,16 +234,21 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
Expanded( Expanded(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r), borderRadius: BorderRadius.circular(
10.r),
), ),
child: LinearPercentIndicator( child: LinearPercentIndicator(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
animation: true, animation: true,
lineHeight: 8.h, lineHeight: 8.h,
animationDuration: 2500, animationDuration: 2500,
percent: item.annotateRate == null ? 0 : item.annotateRate! / 100, percent: item.annotateRate == null
progressColor: const Color(0xFF6888FD), ? 0
backgroundColor: const Color(0xFFE8E8E8), : item.annotateRate! / 100,
progressColor: const Color(
0xFF6888FD),
backgroundColor: const Color(
0xFFE8E8E8),
barRadius: Radius.circular(10.r), barRadius: Radius.circular(10.r),
), ),
), ),
@ -209,7 +256,10 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
SizedBox( SizedBox(
width: 10.r, width: 10.r,
), ),
quickText('${item.annotateRate!.toStringAsFixed(0)}%', size: 10.sp, color: const Color(0xFF464646)), quickText(
'${item.annotateRate!.toStringAsFixed(
0)}%', size: 10.sp,
color: const Color(0xFF464646)),
], ],
), ),
// FavoriteButton(jobTaskItem.id, jobTaskItem.title), // FavoriteButton(jobTaskItem.id, jobTaskItem.title),
@ -220,13 +270,13 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
), ),
), ),
); );
}, }),
itemCount: state.workList.length,
), ),
); );
})), }),
], ],
), ),
),
); );
} }
@ -243,7 +293,8 @@ class EntranceModel extends Object {
String navigationUrl; String navigationUrl;
String? page; String? page;
EntranceModel({required this.title, required this.image, required this.navigationUrl, this.page}); EntranceModel(
{required this.title, required this.image, required this.navigationUrl, this.page});
} }
@swidget @swidget
@ -252,7 +303,8 @@ Widget $termRow(BuildContext context, List<EntranceModel> items, int? data) {
Widget childWidget; Widget childWidget;
switch (leng) { switch (leng) {
case 1: case 1:
childWidget = Row(children: [Expanded(child: $TermItem(items[0], data!))]); childWidget =
Row(children: [Expanded(child: $TermItem(items[0], data!))]);
break; break;
case 2: case 2:
childWidget = Row(children: [ childWidget = Row(children: [
@ -286,11 +338,13 @@ Widget $termRow(BuildContext context, List<EntranceModel> items, int? data) {
childWidget = Container(); childWidget = Container();
} }
return Container(padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget); return Container(
padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget);
} }
@swidget @swidget
Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHeight}) { Widget $termItem(BuildContext context, EntranceModel e, int data,
{double? theHeight}) {
bool isJob = e.title == '作业批阅'; bool isJob = e.title == '作业批阅';
return Material( return Material(
@ -319,10 +373,13 @@ Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHe
badgeStyle: badges.BadgeStyle( badgeStyle: badges.BadgeStyle(
badgeColor: const Color.fromRGBO(255, 105, 105, 1), badgeColor: const Color.fromRGBO(255, 105, 105, 1),
shape: badges.BadgeShape.square, shape: badges.BadgeShape.square,
borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r), topRight: Radius.circular(8.5.r), bottomRight: Radius.circular(8.5.r)), borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r),
topRight: Radius.circular(8.5.r),
bottomRight: Radius.circular(8.5.r)),
// borderSide: BorderSide(color: Colors.white, width: 2), // borderSide: BorderSide(color: Colors.white, width: 2),
elevation: 1, elevation: 1,
padding: EdgeInsets.symmetric(horizontal: Utils.isPad() ? 11.w : 16.w, vertical: 2.h), padding: EdgeInsets.symmetric(
horizontal: Utils.isPad() ? 11.w : 16.w, vertical: 2.h),
), ),
position: badges.BadgePosition.topEnd(top: 10.r, end: 10.r), position: badges.BadgePosition.topEnd(top: 10.r, end: 10.r),
child: Container( child: Container(
@ -345,17 +402,23 @@ Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHe
? Column( ? Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover), Image.asset(
e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
SizedBox(height: 6.r), SizedBox(height: 6.r),
quickText(e.title, size: 12.sp, color: const Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500), quickText(e.title, size: 12.sp,
color: const Color.fromRGBO(79, 79, 79, 1),
fontWeight: FontWeight.w500),
], ],
) )
: Row( : Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover), Image.asset(
e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
SizedBox(width: 6.r), SizedBox(width: 6.r),
quickText(e.title, size: 12.sp, color: const Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500), quickText(e.title, size: 12.sp,
color: const Color.fromRGBO(79, 79, 79, 1),
fontWeight: FontWeight.w500),
], ],
), ),
), ),

View File

@ -1,7 +1,26 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart';
import 'work_state.dart'; import 'work_state.dart';
class WorkLogic extends GetxController { class WorkLogic extends GetxController with RequestToolMixin, GetTickerProviderStateMixin {
final WorkState state = WorkState(); final WorkState state = WorkState();
late TabController tabController;
@override
void onInit() {
super.onInit();
state.tabIndex.value = 0;
tabController = TabController(
length: 2,
vsync: this,
);
}
@override
void dispose() {
super.dispose();
tabController.dispose();
}
} }

View File

@ -1,5 +1,14 @@
import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/work_student.dart';
class WorkState { class WorkState {
WorkState() { WorkState() {
///Initialize variables ///Initialize variables
} }
int active = 1;
late RxList<Items> workList = RxList();
late RxInt tabIndex = 0.obs;
late bool completedToRefresh = true;
late RxString customTimeStr = '自定义'.obs;
late int page = 1;
} }

View File

@ -1,6 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/utils/utils.dart';
import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
import 'package:making_school_asignment_app/page/home_page/children/read_over/read_over_logic.dart';
import 'package:making_school_asignment_app/page/home_page/children/read_over/read_over_view.dart';
import 'package:making_school_asignment_app/page/home_page/children/read_over/widget/annotate_list.dart';
import 'package:making_school_asignment_app/page/home_page/children/student_work_detail/widget/job_condition_filter.dart';
import 'package:making_school_asignment_app/routes/app_pages.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
import 'work_logic.dart'; import 'work_logic.dart';
@ -20,11 +29,131 @@ class _WorkPageState extends State<WorkPage> with AutomaticKeepAliveClientMixin
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); return AnnotatedRegion(
return Scaffold( value: const SystemUiOverlayStyle(
body: Container( systemNavigationBarColor: Color(0xFF000000),
systemNavigationBarDividerColor: null,
statusBarColor: Colors.white,
systemNavigationBarIconBrightness: Brightness.light,
statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light,
),
child: Scaffold(
backgroundColor: const Color.fromRGBO(244, 244, 244, 1),
body: OrientationBuilder(
builder: (BuildContext context, Orientation orientation) {
return Column(
children: <Widget>[
Container(
color: Colors.white,
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
padding: EdgeInsets.only(bottom: 9.h, top: 4.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 10.w),
)),
Expanded(
flex: 4,
child: Container(
padding: EdgeInsets.symmetric(vertical: 2.h),
alignment: Alignment.center, alignment: Alignment.center,
child: quickText('考试页面'), decoration: BoxDecoration(
color: const Color.fromRGBO(243, 243, 243, 1),
borderRadius: BorderRadius.circular(8.r),
),
child: TabBar(
padding: EdgeInsets.zero,
indicatorPadding: EdgeInsets.zero,
indicatorWeight: 0,
labelPadding: EdgeInsets.symmetric(horizontal: 2.w),
controller: logic.tabController,
unselectedLabelStyle: TextStyle(
fontSize: 14.sp,
color: const Color.fromRGBO(69, 83, 100, 1),
),
labelStyle: TextStyle(
fontSize: 14.sp,
color: const Color.fromRGBO(104, 136, 253, 1),
),
// labelColor: const Color.fromRGBO(45, 56, 76, 1),
indicator: const BoxDecoration(),
onTap: (index) {
state.tabIndex.value = index;
if (index == 1 && state.completedToRefresh) {
//
// _refreshController2.callRefresh();
state.completedToRefresh = false;
}
},
tabs: <Widget>[
Tab(
iconMargin: EdgeInsets.zero,
height: 34.h,
child: Obx(() {
return Container(
width: 140.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: state.tabIndex.value == 0 ? const Color.fromRGBO(255, 255, 255, 1) : null,
borderRadius: BorderRadius.all(Radius.circular(8.r)),
),
child: quickText(
'待批阅',
size: 14.sp,
color: state.tabIndex.value == 0 ? Theme.of(context).primaryColor : const Color.fromRGBO(80, 94, 110, 1),
fontWeight: state.tabIndex.value == 0 ? FontWeight.bold : null,
),
);
}),
),
Tab(
iconMargin: EdgeInsets.zero,
height: 34.h,
child: Obx(() {
return Container(
width: 140.w,
alignment: Alignment.center,
decoration: BoxDecoration(
color: state.tabIndex.value == 1 ? const Color.fromRGBO(255, 255, 255, 1) : null,
borderRadius: BorderRadius.all(Radius.circular(8.r)),
),
child: quickText(
'已批阅',
size: 14.sp,
color: state.tabIndex.value == 1 ? Theme.of(context).primaryColor : const Color.fromRGBO(80, 94, 110, 1),
fontWeight: state.tabIndex.value == 1 ? FontWeight.bold : null,
),
);
}),
),
],
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Get.toNamed(Routes.studentHistoryWorkPage, arguments: {'page': 'set'});
},
child: Icon(const IconData(0xe63e, fontFamily: "AlibabaIcon"), color: const Color.fromRGBO(44, 48, 63, 1), size: 24.sp),
),
),
],
),
),
Expanded(child: Obx(() {
return AnnotateList(tabIndex: state.tabIndex.value,assessType: 1,);
}),),
],
);
},
),
), ),
); );
} }