no message

This commit is contained in:
1147192855@qq.com 2024-06-18 18:14:58 +08:00
parent 63658cf6e1
commit 47eb2ad17c
6 changed files with 303 additions and 224 deletions

View File

@ -18,7 +18,7 @@ class DoPaperDetailsResult extends Object {
@JsonKey(name: 'templateIdKeyMap') @JsonKey(name: 'templateIdKeyMap')
Map<int, int>? templateIdKeyMap; Map<int, int>? templateIdKeyMap;
@JsonKey(name: 'students') @JsonKey(name: 'submitStudents') //
List<PaperStudents> students; List<PaperStudents> students;
@JsonKey(name: 'templateId') @JsonKey(name: 'templateId')
@ -59,8 +59,9 @@ class DoPaperDetailsResult extends Object {
@JsonKey(name: 'studentQuestions') @JsonKey(name: 'studentQuestions')
List<StudentQuestions> studentQuestions; List<StudentQuestions> studentQuestions;
//
@JsonKey(name: 'unSubmitStudents') @JsonKey(name: 'unSubmitStudents')
Object unSubmitStudents; List<PaperStudents> unSubmitStudents;
@JsonKey(name: 'lastPage') @JsonKey(name: 'lastPage')
LastPage? lastPage; LastPage? lastPage;
@ -68,7 +69,12 @@ class DoPaperDetailsResult extends Object {
@JsonKey(name: 'nextPage') @JsonKey(name: 'nextPage')
NextPage? nextPage; NextPage? nextPage;
//
@JsonKey(name: 'totalUnAnnotateCount')
int totalUnAnnotateCount;
DoPaperDetailsResult( DoPaperDetailsResult(
this.totalUnAnnotateCount,
this.templateIds, this.templateIds,
this.students, this.students,
this.templateId, this.templateId,
@ -111,8 +117,8 @@ class DoPaperDetailsResult extends Object {
if (annotateTime != null) showZgtAnnotate = '${showZgtAnnotate!}?$annotateTime'; if (annotateTime != null) showZgtAnnotate = '${showZgtAnnotate!}?$annotateTime';
} }
print('学生作答图片:${zgtAnswer}'); // print('学生作答图片:${annotatedCount}');
print('老师批注图片${showZgtAnnotate}'); // print('老师批注图片提交数量:${submitCount}');
} }
factory DoPaperDetailsResult.fromJson(Map<String, dynamic> srcJson) => _$DoPaperDetailsResultFromJson(srcJson); factory DoPaperDetailsResult.fromJson(Map<String, dynamic> srcJson) => _$DoPaperDetailsResultFromJson(srcJson);
@ -128,6 +134,7 @@ class PaperStudents extends Object {
@JsonKey(name: 'name') @JsonKey(name: 'name')
String name; String name;
//
@JsonKey(name: 'isPriority') @JsonKey(name: 'isPriority')
bool isPriority; bool isPriority;

View File

@ -35,24 +35,24 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ScreenUtilInit( return ScreenUtilInit(
designSize: const Size(AppConfig.UI_WIDTH, AppConfig.UI_HEIGHT), designSize: const Size(AppConfig.UI_WIDTH, AppConfig.UI_HEIGHT),
/* minTextAdapt: true, /* minTextAdapt: true,
splitScreenMode: true,*/ splitScreenMode: true,*/
builder: () => GetMaterialApp( builder: () => GetMaterialApp(
title: '作业', title: '作业',
debugShowCheckedModeBanner: false,
theme: ThemeData( theme: ThemeData(
brightness: Brightness.light, brightness: Brightness.light,
primarySwatch: createMaterialColor(const Color.fromRGBO(46, 91, 255, 1)), primarySwatch: createMaterialColor(const Color.fromRGBO(46, 91, 255, 1)),
primaryColor: const Color.fromRGBO(46, 91, 255, 1), primaryColor: const Color.fromRGBO(46, 91, 255, 1),
// textTheme: Typography.englishLike2018.apply(fontSizeFactor: 1.sp,), // textTheme: Typography.englishLike2018.apply(fontSizeFactor: 1.sp,),
primaryTextTheme: TextTheme( primaryTextTheme: TextTheme(
bodyLarge: TextStyle(fontSize: 14.sp, color: Colors.black87), bodyLarge: TextStyle(fontSize: 14.sp, color: Colors.black87),
), ),
useMaterial3: false, useMaterial3: false,
colorScheme: const ColorScheme.light( colorScheme: const ColorScheme.light(
// //
primary: Color.fromRGBO(46, 91, 255, 1), primary: Color.fromRGBO(46, 91, 255, 1),
) )),
),
enableLog: true, enableLog: true,
logWriterCallback: (text, {bool isError = false}) { logWriterCallback: (text, {bool isError = false}) {
// isError ? LoggerUtils.e(text) : LoggerUtils.i(text); // isError ? LoggerUtils.e(text) : LoggerUtils.i(text);

View File

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
@ -36,76 +37,180 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Stack(
children: [ children: [
// Row(
Expanded( children: [
flex: 7, //
child: LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) { Expanded(
var maxWidth = constraints.maxWidth; flex: 7,
var maxHeight = constraints.maxHeight; child: LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
return Stack( var maxWidth = constraints.maxWidth;
children: [ var maxHeight = constraints.maxHeight;
// return Stack(
QuestionImageView(maxWidth, maxHeight, sateData, annotationState, logic), children: [
// //
Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)), QuestionImageView(maxWidth, maxHeight, sateData, annotationState, logic),
// //
Positioned( Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
left: 2.w, //
top: (maxHeight / 2) - 20.h, Positioned(
child: Obx(() { left: 2.w,
LastPage? lastPageVal = sateData.data.value?.lastPage; top: (maxHeight / 2) - 20.h,
if (lastPageVal == null) return const SizedBox(); child: Obx(() {
return FloatingActionButton( LastPage? lastPageVal = sateData.data.value?.lastPage;
heroTag: '点击前往上一题', if (lastPageVal == null) return const SizedBox();
tooltip: '点击前往上一题', return FloatingActionButton(
focusColor: Theme.of(context).primaryColor, heroTag: '点击前往上一题',
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05), tooltip: '点击前往上一题',
elevation: 10.r, focusColor: Theme.of(context).primaryColor,
onPressed: () => easyThrottle('TestQuestionSwitch', () { backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
var param = sateData.param.value; elevation: 10.r,
param.studentId = lastPageVal.studentId; onPressed: () => easyThrottle('TestQuestionSwitch', () {
param.templateId = lastPageVal.templateId; var param = sateData.param.value;
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson()); param.studentId = lastPageVal.studentId;
param.templateId = lastPageVal.templateId;
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
}),
child: Icon(Icons.arrow_back_ios, color: Colors.white, size: 22.sp),
);
}), }),
child: Icon(Icons.arrow_back_ios, color: Colors.white, size: 22.sp), ),
); //
}), Positioned(
), right: 2.w,
// top: (maxHeight / 2) - 20.h,
Positioned( child: Obx(() {
right: 2.w, NextPage? nextPageVal = sateData.data.value?.nextPage;
top: (maxHeight / 2) - 20.h, if (nextPageVal == null) return const SizedBox();
child: Obx(() { return FloatingActionButton(
NextPage? nextPageVal = sateData.data.value?.nextPage; heroTag: '点击前往下一题',
if (nextPageVal == null) return const SizedBox(); tooltip: '点击前往下一题',
return FloatingActionButton( elevation: 10.r,
heroTag: '点击前往下一题', backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
tooltip: '点击前往下一题', onPressed: () => easyThrottle('TestQuestionSwitch', () {
elevation: 10.r, var param = sateData.param.value;
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05), param.studentId = nextPageVal.studentId;
onPressed: () => easyThrottle('TestQuestionSwitch', () { param.templateId = nextPageVal.templateId;
var param = sateData.param.value; sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
param.studentId = nextPageVal.studentId; }),
param.templateId = nextPageVal.templateId; child: Icon(Icons.arrow_forward_ios, color: Colors.white, size: 22.sp),
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson()); );
}), }),
child: Icon(Icons.arrow_forward_ios, color: Colors.white, size: 22.sp), ),
); //
}), $TotalSubmitCountView(sateData)
), ],
], );
); }),
}), ),
//
Expanded(flex: 2, child: $QuestionNumberView(sateData)),
],
), ),
// Obx(() {
Expanded(flex: 2, child: $QuestionNumberView(sateData)), if (!sateData.getDataError.value) return const SizedBox();
return Center(
child: CupertinoButton(
color: Colors.grey[300],
onPressed: () => easyThrottle('home_work_reload_data', () {
sateData.param.value = DoPaperDetailsParam.fromJson(sateData.param.value.toJson());
}),
child: quickText('重新请求', color: Colors.black38),
),
);
}),
], ],
); );
} }
} }
@swidget
Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData) {
return Obx(() {
var data = sateData.data.value;
if (data == null) return Container();
return Positioned(
bottom: 10.h,
right: 8.w,
child: InkWell(
onTap: () async {
// List<JobConcernedWithStudent>? students = await getStudents();
// if (students == null) return;
// students = students..sort((e, e1) => e.studentName.compareTo(e1.studentName));
// showModalBottomSheet(
// context: context,
// elevation: 10,
// backgroundColor: Colors.white,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.only(
// topLeft: Radius.circular(10.r),
// topRight: Radius.circular(10.r),
// ),
// ),
// builder: (BuildContext context) {
// return Padding(
// padding: EdgeInsets.symmetric(horizontal: 2.w),
// child: Column(
// children: [
// Container(
// margin: EdgeInsets.only(top: 14.h),
// child: quickText(
// '当前页未提交学生名单',
// size: 15.sp,
// fontWeight: FontWeight.bold,
// color: Color.fromRGBO(60, 60, 60, 1),
// ),
// ),
// SizedBox(height: 10.h),
// Expanded(
// child: ListView(
// padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 4.w),
// children: [
// Wrap(
// spacing: 6.0, // ()
// runSpacing: 4.0, //
// alignment: WrapAlignment.spaceAround, //沿
// children: students!.map((e) {
// return Chip(
// labelPadding: EdgeInsets.symmetric(vertical: 1.5.h, horizontal: 5.w),
// backgroundColor: Color.fromRGBO(239, 242, 255, 1),
// // avatar: CircleAvatar(
// // backgroundColor: Colors.white,
// // child: quickText(e.studentName.substring(0, 1),
// // size: 12.sp, color: Theme.of(context).primaryColor),
// // ),
// label: quickText(e.studentName, color: Color.fromRGBO(80, 94, 110, 1), size: 12.sp),
// );
// }).toList(),
// ),
// ],
// ),
// )
// ],
// ),
// );
// },
// );
},
child: Container(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText('已阅', color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
quickText(data.annotatedCount, color: const Color.fromRGBO(76, 199, 147, 1), size: 12.sp, fontWeight: FontWeight.bold),
quickText('/', color: const Color.fromRGBO(117, 117, 117, 1), size: 12.sp),
quickText(data.submitCount - data.annotatedCount, color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
],
),
),
),
);
});
}
// //
@hwidget @hwidget
Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) { Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {

View File

@ -16,6 +16,7 @@ import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dar
import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
import 'package:making_school_asignment_app/common/utils/upload_oss_img_utils.dart'; import 'package:making_school_asignment_app/common/utils/upload_oss_img_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/job_report/widget/personnel_data_overview.dart';
// //
class HomeworkReviewState { class HomeworkReviewState {
@ -30,6 +31,9 @@ class HomeworkReviewState {
late bool? panQuestView; late bool? panQuestView;
late Rx<TestQuestionsImageInfo?> imageScale; late Rx<TestQuestionsImageInfo?> imageScale;
List<dynamic> handwritings = []; List<dynamic> handwritings = [];
bool needRefresh = false;
bool lastQuestionPrompt = false; //
Rx<bool> getDataError = false.obs; //
// late String dateEnd = ''; // late String dateEnd = '';
// late int knowledgeId = 0; // late int knowledgeId = 0;
@ -99,9 +103,14 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
// item.topHeight = itemPre.height; // item.topHeight = itemPre.height;
// } // }
state.getDataError.value = false;
state.data.value = data; state.data.value = data;
state.handwritings = []; state.handwritings = [];
state.studentQuestions.value = data.studentQuestions; state.studentQuestions.value = data.studentQuestions;
} catch (e) {
print('获取数据报错了:$e');
ToastUtils.showError('获取试题数据出错,请重试');
state.getDataError.value = true;
} finally { } finally {
if (timerControl.isActive) timerControl.cancel(); if (timerControl.isActive) timerControl.cancel();
@ -187,8 +196,6 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
options: Options(contentType: null, headers: {Headers.contentLengthHeader: bytes.length}), options: Options(contentType: null, headers: {Headers.contentLengthHeader: bytes.length}),
); );
// var res = await getClient().uploadImag(resUrl, file);
return imgKey; return imgKey;
} catch (e) { } catch (e) {
print('图片上传失败'); print('图片上传失败');
@ -235,20 +242,28 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
); );
}).toList())) }).toList()))
.then((e) async { .then((e) async {
var annotatedCount = data.annotatedCount + 1; // state.needRefresh = true;
var submitCount = data.submitCount; // var totalUnAnnotateCount = data.totalUnAnnotateCount;
if (annotatedCount == submitCount) { if (data.annotateTime == null) totalUnAnnotateCount -= 1;
if (totalUnAnnotateCount <= 0 && !state.lastQuestionPrompt) {
// //
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context1) { builder: (BuildContext context1) {
return AlertDialog( return AlertDialog(
title: quickText('完成批阅提示'), title: quickText('批阅已完成'),
content: const Text('暂无更多待批阅项,是否返回主页?'), content: const Text('暂无更多待批阅项'),
actions: <Widget>[ actions: <Widget>[
TextButton(child: const Text(''), onPressed: () => Navigator.of(context1).pop()),
TextButton( TextButton(
child: const Text(''), child: const Text('继续'),
onPressed: () {
state.lastQuestionPrompt = true;
Navigator.of(context1).pop();
},
),
TextButton(
child: const Text('退出批阅'),
onPressed: () { onPressed: () {
Navigator.of(context1).pop(); Navigator.of(context1).pop();
Get.back(); Get.back();
@ -260,8 +275,11 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
return; return;
} }
var newParams = DoPaperDetailsParam.fromJson(state.param.value.toJson()); var newParams = DoPaperDetailsParam.fromJson(state.param.value.toJson());
newParams.templateId = null; if (totalUnAnnotateCount > 0) {
newParams.studentId = null; //
newParams.templateId = null;
newParams.studentId = null;
}
state.param.value = newParams; state.param.value = newParams;
}); });
} }

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.dart'; import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.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/annotate_class/annotate_class_logic.dart';
import 'components/bottom_operation_bar.dart'; import 'components/bottom_operation_bar.dart';
import 'components/button_floating_action.dart'; import 'components/button_floating_action.dart';
@ -22,6 +23,7 @@ class HomeworkReview extends StatefulWidget {
class _HomeworkReviewState extends State<HomeworkReview> { class _HomeworkReviewState extends State<HomeworkReview> {
final logic = Get.find<HomeworkReviewLogic>(); final logic = Get.find<HomeworkReviewLogic>();
final sateData = Get.find<HomeworkReviewLogic>().state; final sateData = Get.find<HomeworkReviewLogic>().state;
final AnnotateClassLogic _controller = Get.find<AnnotateClassLogic>();
@override @override
void initState() { void initState() {
@ -37,33 +39,38 @@ class _HomeworkReviewState extends State<HomeworkReview> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return PopScope(
appBar: AppBar( canPop: false,
// titleSpacing: 0, onPopInvoked: (e) {
leading: IconButton(icon: const Icon(Icons.arrow_back_ios), onPressed: () => Get.back()), if (e && sateData.needRefresh) _controller.getList();
iconTheme: const IconThemeData(color: Colors.black), },
title: quickText(sateData.param.value.homeworkName), child: SafeArea(
backgroundColor: Colors.white, child: Scaffold(
elevation: 0, appBar: AppBar(
actions: [ // titleSpacing: 0,
const FavoriteWidget(), leading: IconButton(icon: const Icon(Icons.arrow_back_ios), onPressed: () => Get.back()),
SizedBox(width: 5.w), iconTheme: const IconThemeData(color: Colors.black),
const ReturnToHomepage(), title: quickText(sateData.param.value.homeworkName),
], backgroundColor: Colors.white,
), elevation: 0,
body: SafeArea( actions: [const FavoriteWidget(), SizedBox(width: 5.w), const ReturnToHomepage()],
child: Column( ),
children: [ body: SafeArea(
// child: Column(
const DropdownSwitchStudentsType(), children: [
SizedBox(height: 1.h), //
const Expanded(child: QuestionPaperView()), const DropdownSwitchStudentsType(),
const BottomAnnotationSwitch(), SizedBox(height: 1.h),
], const Expanded(child: QuestionPaperView()),
const BottomAnnotationSwitch()
],
),
),
// floatingActionButton: const ButtonFloatingAction(),
// floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
), ),
), ),
floatingActionButton: const ButtonFloatingAction(),
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
); );
} }
} }

View File

@ -24,12 +24,9 @@ class HomePage extends StatefulWidget {
State<HomePage> createState() => _HomePageState(); State<HomePage> createState() => _HomePageState();
} }
class _HomePageState extends State<HomePage> class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
with AutomaticKeepAliveClientMixin {
final logic = Get.find<HomeLogic>(); final logic = Get.find<HomeLogic>();
final state = Get final state = Get.find<HomeLogic>().state;
.find<HomeLogic>()
.state;
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
@ -38,7 +35,8 @@ class _HomePageState extends State<HomePage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
var spaceWidth = SizedBox(height: ScreenUtil().screenWidth / 19); var spaceWidth = SizedBox(height: ScreenUtil().screenWidth / 19);
return AnnotatedRegion( return SafeArea(
child: AnnotatedRegion(
value: const SystemUiOverlayStyle( value: const SystemUiOverlayStyle(
systemNavigationBarColor: Color(0xFF000000), systemNavigationBarColor: Color(0xFF000000),
systemNavigationBarDividerColor: null, systemNavigationBarDividerColor: null,
@ -53,13 +51,13 @@ class _HomePageState extends State<HomePage>
controller: logic.refreshController, controller: logic.refreshController,
header: MaterialHeader(), header: MaterialHeader(),
footer: TaurusFooter(), footer: TaurusFooter(),
onRefresh: () async{ onRefresh: () async {
state.pageNumber = 1; state.pageNumber = 1;
return logic.getList(); return logic.getList();
}, },
onLoad: () async{ onLoad: () async {
if(state.workList.length<state.totalCount){ if (state.workList.length < state.totalCount) {
state.pageNumber ++; state.pageNumber++;
return logic.getList(); return logic.getList();
} }
}, },
@ -75,28 +73,21 @@ class _HomePageState extends State<HomePage>
), ),
), ),
),*/ ),*/
SizedBox(height: 30.h),
Obx(() { Obx(() {
return $TermRow([ return $TermRow([
EntranceModel(title: '作业批阅', EntranceModel(title: '作业批阅', image: 'assets/images/job_home_marking.png', navigationUrl: Routes.readOverPage),
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: '知识点点掌握', EntranceModel(title: '知识点点掌握', image: 'assets/images/job_home_knowledge.png', navigationUrl: Routes.knowledgePointsGraspPage)
image: 'assets/images/job_home_knowledge.png',
navigationUrl: Routes.knowledgePointsGraspPage)
], state.readOver.value); ], state.readOver.value);
}), }),
spaceWidth, spaceWidth,
$TermRow([ $TermRow([
EntranceModel(title: '答题轨迹', EntranceModel(title: '答题轨迹', image: 'assets/images/job_home_answer_record.png', navigationUrl: Routes.answerTrajectoryPage),
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',
@ -127,7 +118,7 @@ class _HomePageState extends State<HomePage>
'id': item.id, 'id': item.id,
'name': item.name, 'name': item.name,
'grade': item.grade, 'grade': item.grade,
'subject':item.subject, 'subject': item.subject,
}); });
}, },
child: Container( child: Container(
@ -136,8 +127,7 @@ class _HomePageState extends State<HomePage>
children: [ children: [
SizedBox(height: 4.h), SizedBox(height: 4.h),
Container( Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 10.w),
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),
@ -152,25 +142,18 @@ class _HomePageState extends State<HomePage>
], ],
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment mainAxisAlignment: MainAxisAlignment.spaceBetween,
.spaceBetween,
children: [ children: [
Row( Row(
crossAxisAlignment: CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.start,
.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( padding: EdgeInsets.only(left: Utils.isPad() ? 2.w : 3.w),
left: Utils.isPad() ? 2.w : 3.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: state.type == 1 color: state.type == 1 ? const Color.fromRGBO(104, 136, 253, 1) : const Color.fromRGBO(255, 175, 56, 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),
@ -179,17 +162,14 @@ class _HomePageState extends State<HomePage>
), ),
), ),
margin: EdgeInsets.only(right: 4.w), margin: EdgeInsets.only(right: 4.w),
child: quickText( child: quickText(state.type == 1 ? '作业' : '考试', color: Colors.white, size: 10.sp),
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( color: const Color.fromRGBO(70, 70, 70, 1),
70, 70, 70, 1),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
) )
@ -201,41 +181,24 @@ class _HomePageState extends State<HomePage>
children: [ children: [
quickText( quickText(
EnumUtils.formatSubject(item.subject), EnumUtils.formatSubject(item.subject),
color: const Color.fromRGBO( color: const Color.fromRGBO(97, 97, 97, 1),
97, 97, 97, 1),
size: 12.sp, size: 12.sp,
), ),
quickText(' / ', quickText(' / ', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
color: const Color.fromRGBO(
130, 130, 130, 1),
size: 11.sp,
fontWeight: FontWeight.w500),
Row( Row(
crossAxisAlignment: CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.end,
.end,
children: [ children: [
quickText('题量:', quickText('题量:', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp),
color: const Color.fromRGBO(
130, 130, 130, 1),
size: 11.sp),
quickText( quickText(
'${item.questionCount! - item.annotateCount!}', '${item.questionCount! - item.annotateCount!}',
color: const Color.fromRGBO( color: const Color.fromRGBO(97, 97, 97, 1),
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),
@ -244,21 +207,16 @@ class _HomePageState extends State<HomePage>
Expanded( Expanded(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(10.r),
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 percent: item.annotateRate == null ? 0 : item.annotateRate! / 100,
? 0 progressColor: const Color(0xFF6888FD),
: item.annotateRate! / 100, backgroundColor: const Color(0xFFE8E8E8),
progressColor: const Color(
0xFF6888FD),
backgroundColor: const Color(
0xFFE8E8E8),
barRadius: Radius.circular(10.r), barRadius: Radius.circular(10.r),
), ),
), ),
@ -266,10 +224,7 @@ class _HomePageState extends State<HomePage>
SizedBox( SizedBox(
width: 10.r, width: 10.r,
), ),
quickText( quickText('${item.annotateRate!.toStringAsFixed(0)}%', size: 10.sp, color: const Color(0xFF464646)),
'${item.annotateRate!.toStringAsFixed(
0)}%', size: 10.sp,
color: const Color(0xFF464646)),
], ],
), ),
// FavoriteButton(jobTaskItem.id, jobTaskItem.title), // FavoriteButton(jobTaskItem.id, jobTaskItem.title),
@ -287,7 +242,7 @@ class _HomePageState extends State<HomePage>
], ],
), ),
), ),
); ));
} }
@override @override
@ -303,8 +258,7 @@ class EntranceModel extends Object {
String navigationUrl; String navigationUrl;
String? page; String? page;
EntranceModel( EntranceModel({required this.title, required this.image, required this.navigationUrl, this.page});
{required this.title, required this.image, required this.navigationUrl, this.page});
} }
@swidget @swidget
@ -313,8 +267,7 @@ Widget $termRow(BuildContext context, List<EntranceModel> items, int? data) {
Widget childWidget; Widget childWidget;
switch (leng) { switch (leng) {
case 1: case 1:
childWidget = childWidget = Row(children: [Expanded(child: $TermItem(items[0], data!))]);
Row(children: [Expanded(child: $TermItem(items[0], data!))]);
break; break;
case 2: case 2:
childWidget = Row(children: [ childWidget = Row(children: [
@ -348,13 +301,11 @@ Widget $termRow(BuildContext context, List<EntranceModel> items, int? data) {
childWidget = Container(); childWidget = Container();
} }
return Container( return Container(padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget);
padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget);
} }
@swidget @swidget
Widget $termItem(BuildContext context, EntranceModel e, int data, Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHeight}) {
{double? theHeight}) {
bool isJob = e.title == '作业批阅'; bool isJob = e.title == '作业批阅';
return Material( return Material(
@ -383,13 +334,10 @@ Widget $termItem(BuildContext context, EntranceModel e, int data,
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), borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r), topRight: Radius.circular(8.5.r), bottomRight: Radius.circular(8.5.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( padding: EdgeInsets.symmetric(horizontal: Utils.isPad() ? 11.w : 16.w, vertical: 2.h),
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(
@ -410,27 +358,21 @@ Widget $termItem(BuildContext context, EntranceModel e, int data,
alignment: Alignment.center, alignment: Alignment.center,
child: isJob child: isJob
? Column( ? Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset( Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
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( Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
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),
],
),
), ),
)), )),
); );