处理基本完成
This commit is contained in:
parent
d1fd1fb1bc
commit
e239ad8710
|
|
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https://services.gradle.org/distributions/gradle-7.6.3-all.zip
|
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-7.6.3-all.zip
|
||||||
|
|
@ -181,9 +181,7 @@ class Utils {
|
||||||
stu.noAnswerCount = data.dtls.where((w) => w.state == 0 && stu.studentId == w.studentId).length;
|
stu.noAnswerCount = data.dtls.where((w) => w.state == 0 && stu.studentId == w.studentId).length;
|
||||||
|
|
||||||
List<Questions> ques = data.questions;
|
List<Questions> ques = data.questions;
|
||||||
stu.queDtls = data.dtls
|
stu.queDtls = data.dtls.where((w) => w.studentId == stu.studentId && ques.indexWhere((q) => w.templateId == q.templateId && w.questionNo == q.questionNo) > -1).toList();
|
||||||
.where((w) => w.studentId == stu.studentId && ques.indexWhere((q) => w.templateId == q.templateId && w.questionNo == q.questionNo) > -1)
|
|
||||||
.toList();
|
|
||||||
int okCount = stu.queDtls!.where((w) => w.state == 3).length;
|
int okCount = stu.queDtls!.where((w) => w.state == 3).length;
|
||||||
int ttlCount = stu.queDtls!.length;
|
int ttlCount = stu.queDtls!.length;
|
||||||
stu.okRate = Utils.calcRate(okCount, ttlCount);
|
stu.okRate = Utils.calcRate(okCount, ttlCount);
|
||||||
|
|
@ -291,23 +289,26 @@ class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
static DateTime getWeekStartDate() {
|
static DateTime getWeekStartDate() {
|
||||||
|
// DateTime now = DateTime.now();
|
||||||
|
// int dayOfWeek = now.weekday; // 获取今天是周几(1代表周一,7代表周日)
|
||||||
|
// int diff = dayOfWeek - 1; // 计算今天距离周一的天数差
|
||||||
|
// if (diff < 0) {
|
||||||
|
// diff += 7; // 如果是周日,则需要加上一周的天数
|
||||||
|
// }
|
||||||
|
// return now.subtract(Duration(days: diff)); // 减去天数差,得到本周一的时间
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
int dayOfWeek = now.weekday; // 获取今天是周几(1代表周一,7代表周日)
|
return now.subtract(const Duration(days: 6));
|
||||||
int diff = dayOfWeek - 1; // 计算今天距离周一的天数差
|
|
||||||
if (diff < 0) {
|
|
||||||
diff += 7; // 如果是周日,则需要加上一周的天数
|
|
||||||
}
|
|
||||||
return now.subtract(Duration(days: diff)); // 减去天数差,得到本周一的时间
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static DateTime getWeekEndDate() {
|
static DateTime getWeekEndDate() {
|
||||||
DateTime now = DateTime.now();
|
// DateTime now = DateTime.now();
|
||||||
int dayOfWeek = now.weekday; // 获取今天是周几
|
// int dayOfWeek = now.weekday; // 获取今天是周几
|
||||||
int diff = 7 - dayOfWeek; // 计算今天距离周日的天数差
|
// int diff = 7 - dayOfWeek; // 计算今天距离周日的天数差
|
||||||
if (diff == 0) {
|
// if (diff == 0) {
|
||||||
diff = 7; // 如果是周日,则加上一周的天数
|
// diff = 7; // 如果是周日,则加上一周的天数
|
||||||
}
|
// }
|
||||||
return now.add(Duration(days: diff)); // 加上天数差减一,得到本周日的时间
|
// return now.add(Duration(days: diff)); // 加上天数差减一,得到本周日的时间
|
||||||
|
return DateTime.now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,10 @@ class MyApp extends StatelessWidget {
|
||||||
const MyApp({super.key});
|
const MyApp({super.key});
|
||||||
|
|
||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
// String? oldRouter;
|
||||||
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,
|
||||||
|
|
@ -87,6 +89,13 @@ class MyApp extends StatelessWidget {
|
||||||
// systemStatusBarContrastEnforced: false,
|
// systemStatusBarContrastEnforced: false,
|
||||||
// ));
|
// ));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// if (Routes.reviewHomework == currentRouter) {
|
||||||
|
// // SystemChrome.setEnabledSystemUIMode(SystemUiMode.leanBack, overlays: []);
|
||||||
|
// } else if (oldRouter == Routes.reviewHomework) {
|
||||||
|
// // SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]); // 屏幕刘海
|
||||||
|
// }
|
||||||
|
// oldRouter = currentRouter;
|
||||||
},
|
},
|
||||||
// 这里是国际化支持,确保添加flutter_localizations依赖
|
// 这里是国际化支持,确保添加flutter_localizations依赖
|
||||||
supportedLocales: const [
|
supportedLocales: const [
|
||||||
|
|
@ -106,7 +115,7 @@ class MyApp extends StatelessWidget {
|
||||||
return locale;
|
return locale;
|
||||||
},
|
},
|
||||||
//默认专场动画
|
//默认专场动画
|
||||||
defaultTransition: Transition.fade,
|
defaultTransition: getTransition(),
|
||||||
//初始化路由页面
|
//初始化路由页面
|
||||||
initialRoute: Routes.startPage,
|
initialRoute: Routes.startPage,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.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/anti_shake_throttling.dart';
|
||||||
import 'package:making_school_asignment_app/page/global_widget/show_student_list.dart';
|
import 'package:making_school_asignment_app/page/global_widget/show_student_list.dart';
|
||||||
import 'package:percent_indicator/percent_indicator.dart';
|
import 'package:percent_indicator/percent_indicator.dart';
|
||||||
import 'package:making_school_asignment_app/common/job/annotated_class.dart';
|
import 'package:making_school_asignment_app/common/job/annotated_class.dart';
|
||||||
|
|
@ -81,6 +83,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showStudentList(context, List<AnnotatedStudents> students, [bool submitted = false]) async {
|
void showStudentList(context, List<AnnotatedStudents> students, [bool submitted = false]) async {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -89,12 +92,13 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
title: '${widget.item.className ?? ''} ${submitted ? '已提交' : '未提交'}作业学生',
|
title: '${widget.item.className ?? ''} ${submitted ? '已提交' : '未提交'}作业学生',
|
||||||
studentList: students,
|
studentList: students,
|
||||||
homeworkId: widget.homeworkId,
|
homeworkId: widget.homeworkId,
|
||||||
subject:widget.logic.state.subject,
|
subject: widget.logic.state.subject,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
EasyLoading.dismiss();
|
EasyLoading.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
AnnotatedClass itemData = widget.item;
|
AnnotatedClass itemData = widget.item;
|
||||||
|
|
@ -118,7 +122,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: (){
|
onTap: () {
|
||||||
EasyLoading.show(status: 'loading...');
|
EasyLoading.show(status: 'loading...');
|
||||||
showStudentList(context, widget.item.commitStudent!, true);
|
showStudentList(context, widget.item.commitStudent!, true);
|
||||||
},
|
},
|
||||||
|
|
@ -131,7 +135,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
width: 20.r,
|
width: 20.r,
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: (){
|
onTap: () {
|
||||||
EasyLoading.show(status: 'loading...');
|
EasyLoading.show(status: 'loading...');
|
||||||
showStudentList(context, widget.item.noCommitStudent!, true);
|
showStudentList(context, widget.item.noCommitStudent!, true);
|
||||||
},
|
},
|
||||||
|
|
@ -158,12 +162,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
title: "收藏夹${widget.item.homeworkFavs.isNotEmpty ? '(${widget.item.homeworkFavs.length})' : ''}",
|
title: "收藏夹${widget.item.homeworkFavs.isNotEmpty ? '(${widget.item.homeworkFavs.length})' : ''}",
|
||||||
font: widget.font - 2.sp,
|
font: widget.font - 2.sp,
|
||||||
clickFunction: () {
|
clickFunction: () {
|
||||||
Get.toNamed(Routes.favStudentPage, arguments: {
|
Get.toNamed(Routes.favStudentPage, arguments: {'homeworkName': widget.name, 'classId': widget.item.classId, 'homeworkId': widget.logic.state.homeworkId.value, 'grade': widget.item.grade});
|
||||||
'homeworkName': widget.name,
|
|
||||||
'classId': widget.item.classId,
|
|
||||||
'homeworkId': widget.logic.state.homeworkId.value,
|
|
||||||
'grade': widget.item.grade
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -211,12 +210,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
title: "收藏夹${widget.item.homeworkFavs.isNotEmpty ? '(${widget.item.homeworkFavs.length})' : ''}",
|
title: "收藏夹${widget.item.homeworkFavs.isNotEmpty ? '(${widget.item.homeworkFavs.length})' : ''}",
|
||||||
font: widget.font - 2.sp,
|
font: widget.font - 2.sp,
|
||||||
clickFunction: () {
|
clickFunction: () {
|
||||||
Get.toNamed(Routes.favStudentPage, arguments: {
|
Get.toNamed(Routes.favStudentPage, arguments: {'homeworkName': widget.name, 'classId': widget.item.classId, 'homeworkId': widget.logic.state.homeworkId.value, 'grade': widget.item.grade});
|
||||||
'homeworkName': widget.name,
|
|
||||||
'classId': widget.item.classId,
|
|
||||||
'homeworkId': widget.logic.state.homeworkId.value,
|
|
||||||
'grade': widget.item.grade
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -224,16 +218,14 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 10.r,left: 14.r,right: 14.r),
|
padding: EdgeInsets.only(top: 10.r, left: 14.r, right: 14.r),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [quickText('批阅进度', size: widget.font - 2.sp, color: const Color(0xFF8E8E8E)), quickText('${widget.item.annotateRate}%', size: widget.font + 10.sp, color: const Color(0xFF464646))],
|
||||||
quickText('批阅进度', size: widget.font - 2.sp, color: const Color(0xFF8E8E8E)),
|
),
|
||||||
quickText('${widget.item.annotateRate}%', size: widget.font + 10.sp, color: const Color(0xFF464646))
|
),
|
||||||
],
|
|
||||||
),),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 0.r, left: 14.r,right: 14.r,bottom: 10.r),
|
padding: EdgeInsets.only(top: 0.r, left: 14.r, right: 14.r, bottom: 10.r),
|
||||||
child: LinearPercentIndicator(
|
child: LinearPercentIndicator(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
animation: true,
|
animation: true,
|
||||||
|
|
@ -257,27 +249,9 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
barRadius: Radius.circular(10.r),
|
barRadius: Radius.circular(10.r),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ProgressBar(
|
ProgressBar(title: '客观题正确率:', color: const Color(0xFFADDCA5), percent: widget.item.kgtCorrectRate / 100, marginEdg: EdgeInsets.zero, padingEdg: EdgeInsets.only(top: 8.h, left: 14.r, right: 14.r), fontSize: widget.font - 2.sp),
|
||||||
title: '客观题正确率:',
|
ProgressBar(title: '主观题正确率:', color: const Color(0xFFADDCA5), percent: widget.item.zgtCorrectRate / 100, padingEdg: EdgeInsets.symmetric(horizontal: 10.r), marginEdg: EdgeInsets.only(top: 8.h), fontSize: widget.font - 2.sp),
|
||||||
color: const Color(0xFFADDCA5),
|
ProgressBar(title: '总正确率:', color: const Color(0xFFADDCA5), percent: widget.item.correctRate / 100, padingEdg: EdgeInsets.symmetric(horizontal: 10.r), marginEdg: EdgeInsets.only(top: 8.h), fontSize: widget.font - 2.sp),
|
||||||
percent: widget.item.kgtCorrectRate / 100,
|
|
||||||
marginEdg: EdgeInsets.zero,
|
|
||||||
padingEdg: EdgeInsets.only(top: 8.h, left: 14.r, right: 14.r),
|
|
||||||
fontSize: widget.font - 2.sp),
|
|
||||||
ProgressBar(
|
|
||||||
title: '主观题正确率:',
|
|
||||||
color: const Color(0xFFADDCA5),
|
|
||||||
percent: widget.item.zgtCorrectRate / 100,
|
|
||||||
padingEdg: EdgeInsets.symmetric(horizontal: 10.r),
|
|
||||||
marginEdg: EdgeInsets.only(top: 8.h),
|
|
||||||
fontSize: widget.font - 2.sp),
|
|
||||||
ProgressBar(
|
|
||||||
title: '总正确率:',
|
|
||||||
color: const Color(0xFFADDCA5),
|
|
||||||
percent: widget.item.correctRate / 100,
|
|
||||||
padingEdg: EdgeInsets.symmetric(horizontal: 10.r),
|
|
||||||
marginEdg: EdgeInsets.only(top: 8.h),
|
|
||||||
fontSize: widget.font - 2.sp),
|
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(top: 10.r),
|
margin: EdgeInsets.only(top: 10.r),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|
@ -302,10 +276,8 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
widget.logic.goQuickDataCheck(widget.item);
|
widget.logic.goQuickDataCheck(widget.item);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding:EdgeInsets.symmetric(vertical:10.r),
|
padding: EdgeInsets.symmetric(vertical: 10.r),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(border: Border(right: BorderSide(width: 1.r, color: const Color.fromRGBO(221, 221, 221, 1)))),
|
||||||
border: Border(right: BorderSide(width: 1.r,color:const Color.fromRGBO(221, 221, 221, 1) ))
|
|
||||||
),
|
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: quickText('数据快查', color: const Color.fromRGBO(118, 118, 118, 1), size: widget.font),
|
child: quickText('数据快查', color: const Color.fromRGBO(118, 118, 118, 1), size: widget.font),
|
||||||
),
|
),
|
||||||
|
|
@ -326,20 +298,27 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
: [
|
: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () => easyThrottle('TO_GO_REVIEWHOMEWORK', () {
|
||||||
print('批阅..........');
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.leanBack, overlays: []).then((_) {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
Get.toNamed(Routes.reviewHomework, arguments: {
|
Get.toNamed(Routes.reviewHomework, arguments: {
|
||||||
'homeworkId': widget.homeworkId,
|
'homeworkId': widget.homeworkId,
|
||||||
'homeworkName': widget.name,
|
'homeworkName': widget.name,
|
||||||
'classId': itemData.classId,
|
'classId': itemData.classId,
|
||||||
'subject': widget.logic.state.subject,
|
'subject': widget.logic.state.subject,
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
|
});
|
||||||
|
// Get.toNamed(Routes.reviewHomework, arguments: {
|
||||||
|
// 'homeworkId': widget.homeworkId,
|
||||||
|
// 'homeworkName': widget.name,
|
||||||
|
// 'classId': itemData.classId,
|
||||||
|
// 'subject': widget.logic.state.subject,
|
||||||
|
// });
|
||||||
|
}),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding:EdgeInsets.symmetric(vertical:10.r),
|
padding: EdgeInsets.symmetric(vertical: 10.r),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(border: Border(right: BorderSide(width: 1.r, color: const Color.fromRGBO(221, 221, 221, 1)))),
|
||||||
border: Border(right: BorderSide(width: 1.r,color:const Color.fromRGBO(221, 221, 221, 1) ))
|
|
||||||
),
|
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: quickText('批阅', color: const Color.fromRGBO(118, 118, 118, 1), size: widget.font),
|
child: quickText('批阅', color: const Color.fromRGBO(118, 118, 118, 1), size: widget.font),
|
||||||
),
|
),
|
||||||
|
|
@ -348,7 +327,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
// Container(width: 1.w, height: 30.h, color: const Color.fromRGBO(221, 221, 221, 1)),
|
// Container(width: 1.w, height: 30.h, color: const Color.fromRGBO(221, 221, 221, 1)),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async{
|
onTap: () async {
|
||||||
var confim = await confirmDialog('当前批阅任务未完成,请确认需要结束此任务?');
|
var confim = await confirmDialog('当前批阅任务未完成,请确认需要结束此任务?');
|
||||||
if (confim) {
|
if (confim) {
|
||||||
widget.logic.getOverAnnotate(widget.item.classId);
|
widget.logic.getOverAnnotate(widget.item.classId);
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,8 @@ Widget $historyHomework(BuildContext context) {
|
||||||
if (studentId == null || (sateData.value?.students.isEmpty ?? true)) return;
|
if (studentId == null || (sateData.value?.students.isEmpty ?? true)) return;
|
||||||
var currentStudent = sateData.value!.students.firstWhereOrNull((e) => e.id == studentId);
|
var currentStudent = sateData.value!.students.firstWhereOrNull((e) => e.id == studentId);
|
||||||
if (currentStudent == null) return;
|
if (currentStudent == null) return;
|
||||||
Get.toNamed(Routes.studentWorkDetailPage, arguments: {'studentId': studentId, 'studentName': currentStudent.name});
|
var theState = Get.find<HomeworkReviewLogic>().state;
|
||||||
|
Get.toNamed(Routes.studentWorkDetailPage, arguments: {'studentId': studentId, 'studentName': currentStudent.name,'subject':theState.param.value.subject});
|
||||||
}),
|
}),
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,270 @@
|
||||||
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/job/marking_models/do_test_questions_image_info.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
|
||||||
|
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
||||||
|
import 'package:percent_indicator/linear_percent_indicator.dart';
|
||||||
|
|
||||||
|
import '../configuration_files/index.dart';
|
||||||
|
import '../configuration_files/zoom_logic.dart';
|
||||||
|
|
||||||
|
part 'question_number_view.g.dart';
|
||||||
|
|
||||||
|
/// 试题题号
|
||||||
|
class QuestionNumberView extends GetView<HomeworkReviewLogic> {
|
||||||
|
const QuestionNumberView({super.key});
|
||||||
|
|
||||||
|
HomeworkReviewState get sateData => controller.state;
|
||||||
|
ZoomState get sateZoomData => controller.zoomLogic.zoomState;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
height: double.infinity,
|
||||||
|
decoration: const BoxDecoration(color: Color.fromRGBO(159, 159, 159, 0.97)),
|
||||||
|
child: GestureDetector(
|
||||||
|
onPanDown: (_) => sateData.panQuestView = false,
|
||||||
|
child: Obx(() {
|
||||||
|
var zoomFile = sateZoomData.zoomFile.value;
|
||||||
|
if (zoomFile == null) return const SizedBox();
|
||||||
|
|
||||||
|
var studentQuestions = sateData.studentQuestions.value ?? [];
|
||||||
|
|
||||||
|
return $QuestionNumberScrollView(
|
||||||
|
controller:controller,
|
||||||
|
sateData: sateData,
|
||||||
|
sateZoomData: sateZoomData,
|
||||||
|
studentQuestions: studentQuestions,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 试题题号视图
|
||||||
|
@hwidget
|
||||||
|
Widget $questionNumberScrollView({
|
||||||
|
required HomeworkReviewLogic controller,
|
||||||
|
required ZoomState sateZoomData,
|
||||||
|
required HomeworkReviewState sateData,
|
||||||
|
required List<StudentQuestions> studentQuestions,
|
||||||
|
}) {
|
||||||
|
final scrollControllerNum = useScrollController(); // 试题题号区域
|
||||||
|
var useZoom = useState<double>(sateZoomData.initScale.value ?? 1);
|
||||||
|
var usePiddingTop = useState<double>(sateZoomData.zoomFile.value?.imageHeightOffsetStart ?? 0);
|
||||||
|
useValueChanged<double?, void>(sateZoomData.zoomFile.value?.imageHeightOffsetStart, (_, __) {
|
||||||
|
usePiddingTop.value = sateZoomData.zoomFile.value?.imageHeightOffsetStart ?? 0;
|
||||||
|
});
|
||||||
|
useEffect(() {
|
||||||
|
var stream = sateZoomData.initScale.listen((e) {
|
||||||
|
// print("initScale : $e");
|
||||||
|
useZoom.value = e ?? 1;
|
||||||
|
var zoomFile = sateZoomData.zoomFile.value;
|
||||||
|
if (zoomFile?.actualHeight == null) return;
|
||||||
|
|
||||||
|
// print(zoomFile?.toJson());
|
||||||
|
// print("缩放基数:${useZoom.value}");
|
||||||
|
// print("图片实际高度:${zoomFile!.actualHeight! * useZoom.value}");
|
||||||
|
// print("视图剩余高度:${zoomFile.viewHeight - (zoomFile.actualHeight! * useZoom.value)}");
|
||||||
|
// var topDistance = (zoomFile!.viewHeight - (zoomFile.actualHeight! * useZoom.value)) / 2;
|
||||||
|
var topDistance = zoomFile!.getZoomFileOffsetStart(useZoom.value);
|
||||||
|
// print("视图剩余高度/2:${max(0, topDistance)}");
|
||||||
|
// 使用 max 函数确保 topDistance 不小于 0
|
||||||
|
usePiddingTop.value = max(0, topDistance);
|
||||||
|
});
|
||||||
|
|
||||||
|
return () {
|
||||||
|
stream.cancel();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
var actualImgHeight = useState(sateZoomData.zoomFile.value?.actualHeight);
|
||||||
|
useValueChanged<double?, void>(sateZoomData.zoomFile.value?.actualHeight, (_, __) {
|
||||||
|
actualImgHeight.value = sateZoomData.zoomFile.value?.actualHeight ?? 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
scrollControllerNum.addListener(() {
|
||||||
|
if (sateData.panQuestView == false) sateData.slide.value = scrollControllerNum.offset;
|
||||||
|
});
|
||||||
|
var listenVal = sateData.slide.listen((e) {
|
||||||
|
if (sateData.panQuestView != null && sateData.panQuestView == true && e != scrollControllerNum.offset) {
|
||||||
|
print("进来了试题题号视图");
|
||||||
|
scrollControllerNum.jumpTo(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return () {
|
||||||
|
listenVal.cancel();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// var actualImgHeight = useImageInfo.value?.actualImgHeight ?? 0; // 实际图片高度
|
||||||
|
|
||||||
|
// print("图片高度:$actualImgHeight");
|
||||||
|
|
||||||
|
print("数据长度:${studentQuestions.length}");
|
||||||
|
print("FFFFFFFFF ${usePiddingTop.value}");
|
||||||
|
|
||||||
|
return SingleChildScrollView(
|
||||||
|
controller: scrollControllerNum,
|
||||||
|
physics: const BouncingScrollPhysics(),
|
||||||
|
padding: EdgeInsets.only(top: usePiddingTop.value > 0 ? usePiddingTop.value : 0),
|
||||||
|
scrollDirection: Axis.vertical, // 设置垂直滚动
|
||||||
|
child: SizedBox(
|
||||||
|
height: (actualImgHeight.value ?? 0) * useZoom.value,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: studentQuestions
|
||||||
|
.map((e) => $ScoringQuestionsView(
|
||||||
|
studentQuestions,
|
||||||
|
e,
|
||||||
|
controller,
|
||||||
|
sateZoomData.zoomFile.value!.scaleRatio,
|
||||||
|
useZoom.value,
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 单道题得分框
|
||||||
|
@hwidget
|
||||||
|
Widget $scoringQuestionsView(BuildContext context, List<StudentQuestions>? studentQuestions,StudentQuestions item, HomeworkReviewLogic logic, double scaleRatio, double initScale) {
|
||||||
|
var studentScore = useState<int?>(item.studentScore);
|
||||||
|
|
||||||
|
useValueChanged<int?, void>(studentScore.value, (_, __) {
|
||||||
|
item.studentScore = studentScore.value;
|
||||||
|
|
||||||
|
// 校验是否自动提交 对于已经批阅过的试题 不重复自动提交
|
||||||
|
var annotateTime = logic.state.data.value?.annotateTime;
|
||||||
|
if (annotateTime == null) {
|
||||||
|
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
|
||||||
|
if (noRatingGiven == null) logic.submit(context);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
useValueChanged<StudentQuestions, void>(item, (_, __) {
|
||||||
|
studentScore.value = item.studentScore;
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
return () {};
|
||||||
|
}, []);
|
||||||
|
var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h);
|
||||||
|
return Container(
|
||||||
|
height: item.height! * scaleRatio * initScale,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
child: item.useTime == 0
|
||||||
|
? Container()
|
||||||
|
: Stack(
|
||||||
|
alignment: const FractionalOffset(0, 0),
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// 对
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
||||||
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: padinVal,
|
||||||
|
child: Icon(
|
||||||
|
size: 22.sp,
|
||||||
|
color: studentScore.value == 2 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
|
||||||
|
const IconData(0xe62b, fontFamily: "AlibabaIcon"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
||||||
|
studentScore.value = studentScore.value == 2 ? null : 2;
|
||||||
|
}, duration: const Duration(milliseconds: 222)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// 半
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
||||||
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: padinVal,
|
||||||
|
child: Icon(
|
||||||
|
size: 22.sp,
|
||||||
|
color: studentScore.value == 1 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
|
||||||
|
const IconData(0xe62c, fontFamily: "AlibabaIcon"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
||||||
|
studentScore.value = studentScore.value == 1 ? null : 1;
|
||||||
|
}, duration: const Duration(milliseconds: 222)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// 错
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
|
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
||||||
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: padinVal,
|
||||||
|
child: Icon(
|
||||||
|
size: 22.sp,
|
||||||
|
color: studentScore.value == 0 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
|
||||||
|
const IconData(0xe62a, fontFamily: "AlibabaIcon"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
||||||
|
studentScore.value = studentScore.value == 0 ? null : 0;
|
||||||
|
}, duration: const Duration(milliseconds: 222)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
IgnorePointer(
|
||||||
|
// 事件穿透
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SizedBox(width: 1.1.w),
|
||||||
|
quickText(item.questionNo, color: Theme.of(context).primaryColor.withOpacity(0.7), size: 8.sp),
|
||||||
|
if (item.correctRate > 0) quickText(' 正确率', color: Colors.grey, size: 5.sp),
|
||||||
|
if (item.correctRate > 0)
|
||||||
|
Expanded(
|
||||||
|
child: LinearPercentIndicator(
|
||||||
|
lineHeight: 6.h,
|
||||||
|
percent: item.correctRate / 100,
|
||||||
|
barRadius: Radius.circular(1.2.r),
|
||||||
|
alignment: MainAxisAlignment.center,
|
||||||
|
progressColor: Theme.of(context).primaryColor,
|
||||||
|
backgroundColor: const Color(0xFFB8C7CB).withOpacity(0.35),
|
||||||
|
center: quickText("${item.correctRate}%", size: 5.sp, align: TextAlign.center, color: Colors.white),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -13,26 +13,23 @@ import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.d
|
||||||
import 'package:making_school_asignment_app/common/utils/cached_network_img.dart';
|
import 'package:making_school_asignment_app/common/utils/cached_network_img.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/homework_review/configuration_files/index.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
|
||||||
import 'package:percent_indicator/linear_percent_indicator.dart';
|
|
||||||
import 'package:zoom_widget/zoom_widget.dart';
|
import 'package:zoom_widget/zoom_widget.dart';
|
||||||
|
|
||||||
import '../configuration_files/zoom_logic.dart';
|
import '../configuration_files/zoom_logic.dart';
|
||||||
|
import 'question_number_view.dart';
|
||||||
|
|
||||||
part 'question_paper_view.g.dart';
|
part 'question_paper_view.g.dart';
|
||||||
|
|
||||||
// 试题详情
|
// 试题详情视图
|
||||||
|
class QuestionPaperView extends GetView<HomeworkReviewLogic> {
|
||||||
class QuestionPaperView extends StatelessWidget {
|
|
||||||
const QuestionPaperView({super.key});
|
const QuestionPaperView({super.key});
|
||||||
|
|
||||||
|
HomeworkReviewState get sateData => controller.state;
|
||||||
|
ZoomState get zoomState => controller.zoomLogic.zoomState;
|
||||||
|
HomeworkReviewAnnotationsControlState get annotationState => controller.annotationState;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final zoomLogic = Get.find<ZoomLogic>();
|
|
||||||
final zoomState = zoomLogic.zoomState;
|
|
||||||
final logic = Get.find<HomeworkReviewLogic>();
|
|
||||||
final sateData = logic.state;
|
|
||||||
final annotationState = logic.annotationState;
|
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
|
|
@ -46,34 +43,23 @@ class QuestionPaperView extends StatelessWidget {
|
||||||
if (zoomFileModel == null) {
|
if (zoomFileModel == null) {
|
||||||
/// 计算高度
|
/// 计算高度
|
||||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
|
return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
var maxWidth = constraints.maxWidth;
|
WidgetsBinding.instance.addPostFrameCallback((_) => zoomState.zoomFile.value = ZoomFileModel(
|
||||||
var maxHeight = constraints.maxHeight;
|
viewWidth: constraints.maxWidth,
|
||||||
// var maxHeight = ScreenUtil().screenHeight - 95.h - logic.appBarHeight; // 1187.2356785851596
|
viewHeight: constraints.maxHeight,
|
||||||
// print("原始 视图的高度:${maxHeight1} $maxHeight ${MediaQuery.of(context).padding.top}");
|
));
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
return const SizedBox();
|
||||||
zoomState.zoomFile.value = ZoomFileModel(viewWidth: maxWidth, viewHeight: maxHeight);
|
|
||||||
});
|
});
|
||||||
return SizedBox();
|
|
||||||
});
|
|
||||||
} else if (zoomFileModel.fileHeight == null) {
|
|
||||||
/// 文件未计算实际高度
|
|
||||||
return SizedBox();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 文件未计算实际高度
|
||||||
|
if (zoomFileModel.fileHeight == null) return const SizedBox();
|
||||||
|
|
||||||
var maxWidth = zoomFileModel.viewWidth;
|
var maxWidth = zoomFileModel.viewWidth;
|
||||||
var maxHeight = zoomFileModel.viewHeight;
|
var maxHeight = zoomFileModel.viewHeight;
|
||||||
print("文件的高度:${zoomFileModel.actualHeight!}");
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
// 主图
|
// 主图
|
||||||
QuestionImageView(
|
QuestionImageView(maxWidth, maxHeight, annotationState, controller, zoomState: zoomState, sateData: sateData, actualHeight: zoomFileModel.actualHeight!),
|
||||||
maxWidth,
|
|
||||||
maxHeight,
|
|
||||||
sateData,
|
|
||||||
annotationState,
|
|
||||||
logic,
|
|
||||||
actualHeight: zoomFileModel.actualHeight!,
|
|
||||||
),
|
|
||||||
// 继续批阅按钮
|
// 继续批阅按钮
|
||||||
// Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
|
// Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
|
||||||
// 上一题按钮
|
// 上一题按钮
|
||||||
|
|
@ -129,11 +115,28 @@ class QuestionPaperView extends StatelessWidget {
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
// 试题题号视图
|
// 试题题号视图
|
||||||
Expanded(flex: 2, child: $QuestionNumberView(logic, sateData)),
|
const Expanded(flex: 2, child: QuestionNumberView()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Obx(() {
|
|
||||||
|
/// 数据出错再次请求按钮
|
||||||
|
const DataErrorThenRequestAgainButton(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 数据出错再次请求按钮
|
||||||
|
class DataErrorThenRequestAgainButton extends StatelessWidget {
|
||||||
|
const DataErrorThenRequestAgainButton({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GetBuilder<HomeworkReviewLogic>(builder: (logic) {
|
||||||
|
final sateData = logic.state;
|
||||||
|
|
||||||
if (!sateData.getDataError.value) return const SizedBox();
|
if (!sateData.getDataError.value) return const SizedBox();
|
||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
child: CupertinoButton(
|
child: CupertinoButton(
|
||||||
color: Colors.grey[300],
|
color: Colors.grey[300],
|
||||||
|
|
@ -143,9 +146,7 @@ class QuestionPaperView extends StatelessWidget {
|
||||||
child: quickText('再次请求', color: Colors.black38),
|
child: quickText('再次请求', color: Colors.black38),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
});
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -249,250 +250,16 @@ Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@swidget
|
|
||||||
Widget $questionNumberView(BuildContext context, HomeworkReviewLogic logic, HomeworkReviewState sateData) {
|
|
||||||
return Obx(() {
|
|
||||||
var imageVal = sateData.imageScale.value;
|
|
||||||
if (imageVal == null) return const SizedBox();
|
|
||||||
|
|
||||||
var studentQuestions = sateData.studentQuestions.value ?? [];
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
height: double.infinity,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color.fromRGBO(159, 159, 159, 0.97),
|
|
||||||
boxShadow: [BoxShadow(color: const Color.fromRGBO(46, 91, 255, 0.2), offset: Offset(0, 8.w), blurRadius: 1, spreadRadius: 2)],
|
|
||||||
),
|
|
||||||
child: GestureDetector(
|
|
||||||
onPanDown: (_) => sateData.panQuestView = false,
|
|
||||||
child: $QuestionNumberScrollView(
|
|
||||||
logic: logic,
|
|
||||||
sateData: sateData,
|
|
||||||
imageVal: imageVal,
|
|
||||||
studentQuestions: studentQuestions,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 试题题号视图
|
|
||||||
@hwidget
|
|
||||||
Widget $questionNumberScrollView(
|
|
||||||
BuildContext context, {
|
|
||||||
required HomeworkReviewLogic logic,
|
|
||||||
required HomeworkReviewState sateData,
|
|
||||||
required TestQuestionsImageInfo imageVal,
|
|
||||||
required List<StudentQuestions> studentQuestions,
|
|
||||||
}) {
|
|
||||||
var boxHeight = imageVal.boxHeight;
|
|
||||||
final scrollControllerNum = useScrollController(); // 试题题号区域
|
|
||||||
var usePiddingTop = useState<double>(logic.state.imageScaleZoom.value?.imageHeightOffsetStart ?? 0);
|
|
||||||
var useImageInfo = useState<TestQuestionsImageInfo?>(imageVal);
|
|
||||||
|
|
||||||
// var initScale = useState<double>(logic.state.initScale.value ?? 1);
|
|
||||||
|
|
||||||
// useValueChanged<double?, void>(logic.state.initScale.value, (_, __) {
|
|
||||||
// initScale.value = logic.state.initScale.value ?? 1;
|
|
||||||
// print("变化了.......... ${initScale.value}");
|
|
||||||
// });
|
|
||||||
|
|
||||||
useEffect(() {
|
|
||||||
scrollControllerNum.addListener(() {
|
|
||||||
if (sateData.panQuestView == false) sateData.slide.value = scrollControllerNum.offset;
|
|
||||||
});
|
|
||||||
var listenVal = sateData.slide.listen((e) {
|
|
||||||
if (sateData.panQuestView != null && sateData.panQuestView == true && e != scrollControllerNum.offset) {
|
|
||||||
print("进来了试题题号视图");
|
|
||||||
scrollControllerNum.jumpTo(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var stream = logic.state.imageScaleZoom.listen((e) {
|
|
||||||
useImageInfo.value = e;
|
|
||||||
usePiddingTop.value = e?.imageHeightOffsetStart ?? 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
return () {
|
|
||||||
stream.cancel();
|
|
||||||
listenVal.cancel();
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
var actualImgHeight = useImageInfo.value?.actualImgHeight ?? 0; // 实际图片高度
|
|
||||||
|
|
||||||
print("容器高度:$boxHeight");
|
|
||||||
print("图片高度:$actualImgHeight");
|
|
||||||
|
|
||||||
print("数据长度:${studentQuestions.length}");
|
|
||||||
return SingleChildScrollView(
|
|
||||||
controller: scrollControllerNum,
|
|
||||||
physics: const BouncingScrollPhysics(),
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
scrollDirection: Axis.vertical, // 设置垂直滚动
|
|
||||||
child: Container(
|
|
||||||
height: actualImgHeight,
|
|
||||||
margin: EdgeInsets.only(top: usePiddingTop.value > 0 ? usePiddingTop.value : 0),
|
|
||||||
color: Colors.red,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: studentQuestions
|
|
||||||
.asMap()
|
|
||||||
.keys
|
|
||||||
.map((e) => $ScoringQuestionsView(
|
|
||||||
logic,
|
|
||||||
studentQuestions[e],
|
|
||||||
imageVal.scaleRatio,
|
|
||||||
studentQuestions,
|
|
||||||
useImageInfo.value?.zoom ?? 1,
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 单道题得分框
|
|
||||||
@hwidget
|
|
||||||
Widget $scoringQuestionsView(BuildContext context, HomeworkReviewLogic logic, StudentQuestions item, double scaleRatio,
|
|
||||||
List<StudentQuestions>? studentQuestions, double initScale) {
|
|
||||||
var studentScore = useState<int?>(item.studentScore);
|
|
||||||
|
|
||||||
useValueChanged<int?, void>(studentScore.value, (_, __) {
|
|
||||||
item.studentScore = studentScore.value;
|
|
||||||
|
|
||||||
// 校验是否自动提交 对于已经批阅过的试题 不重复自动提交
|
|
||||||
var annotateTime = logic.state.data.value?.annotateTime;
|
|
||||||
if (annotateTime == null) {
|
|
||||||
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
|
|
||||||
if (noRatingGiven == null) logic.submit(context);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
useValueChanged<StudentQuestions, void>(item, (_, __) {
|
|
||||||
studentScore.value = item.studentScore;
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() {
|
|
||||||
return () {};
|
|
||||||
}, []);
|
|
||||||
var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h);
|
|
||||||
return Container(
|
|
||||||
height: item.height! * scaleRatio * initScale,
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
child: item.useTime == 0
|
|
||||||
? Container()
|
|
||||||
: Stack(
|
|
||||||
alignment: const FractionalOffset(0, 0),
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
// 对
|
|
||||||
Expanded(
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: padinVal,
|
|
||||||
child: Icon(
|
|
||||||
size: 22.sp,
|
|
||||||
color: studentScore.value == 2 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
|
|
||||||
const IconData(0xe62b, fontFamily: "AlibabaIcon"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
|
||||||
studentScore.value = studentScore.value == 2 ? null : 2;
|
|
||||||
}, duration: const Duration(milliseconds: 222)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// 半
|
|
||||||
Expanded(
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: padinVal,
|
|
||||||
child: Icon(
|
|
||||||
size: 22.sp,
|
|
||||||
color: studentScore.value == 1 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
|
|
||||||
const IconData(0xe62c, fontFamily: "AlibabaIcon"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
|
||||||
studentScore.value = studentScore.value == 1 ? null : 1;
|
|
||||||
}, duration: const Duration(milliseconds: 222)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// 错
|
|
||||||
Expanded(
|
|
||||||
child: ElevatedButton(
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色
|
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: padinVal,
|
|
||||||
child: Icon(
|
|
||||||
size: 22.sp,
|
|
||||||
color: studentScore.value == 0 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
|
|
||||||
const IconData(0xe62a, fontFamily: "AlibabaIcon"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () => easyThrottle('scoring_homework_questions', () {
|
|
||||||
studentScore.value = studentScore.value == 0 ? null : 0;
|
|
||||||
}, duration: const Duration(milliseconds: 222)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
IgnorePointer(
|
|
||||||
// 事件穿透
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
SizedBox(width: 1.1.w),
|
|
||||||
quickText('${item.questionNo}', color: Theme.of(context).primaryColor.withOpacity(0.7), size: 8.sp),
|
|
||||||
if (item.correctRate > 0) quickText(' 正确率', color: Colors.grey, size: 5.sp),
|
|
||||||
if (item.correctRate > 0)
|
|
||||||
Expanded(
|
|
||||||
child: LinearPercentIndicator(
|
|
||||||
lineHeight: 6.h,
|
|
||||||
percent: item.correctRate / 100,
|
|
||||||
barRadius: Radius.circular(1.2.r),
|
|
||||||
alignment: MainAxisAlignment.center,
|
|
||||||
progressColor: Theme.of(context).primaryColor,
|
|
||||||
backgroundColor: const Color(0xFFB8C7CB).withOpacity(0.35),
|
|
||||||
center: quickText("${item.correctRate}%", size: 5.sp, align: TextAlign.center, color: Colors.white),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 试题图片视图
|
// 试题图片视图
|
||||||
class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar> {
|
class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar> {
|
||||||
final double maxWidth;
|
final double maxWidth;
|
||||||
final double maxHeight;
|
final double maxHeight;
|
||||||
final double actualHeight;
|
final double actualHeight;
|
||||||
final HomeworkReviewLogic logic;
|
final HomeworkReviewLogic logic;
|
||||||
|
final ZoomState zoomState;
|
||||||
final HomeworkReviewState sateData;
|
final HomeworkReviewState sateData;
|
||||||
final HomeworkReviewAnnotationsControlState annotationState;
|
final HomeworkReviewAnnotationsControlState annotationState;
|
||||||
QuestionImageView(this.maxWidth, this.maxHeight, this.sateData, this.annotationState, this.logic, {required this.actualHeight, super.key});
|
QuestionImageView(this.maxWidth, this.maxHeight, this.annotationState, this.logic, {required this.actualHeight, required this.zoomState, required this.sateData, super.key});
|
||||||
|
|
||||||
/// 获取数组指定倒数具体值的下标
|
/// 获取数组指定倒数具体值的下标
|
||||||
int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) {
|
int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) {
|
||||||
|
|
@ -506,28 +273,24 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int activePointers = 0;
|
int _activePointers = 0;
|
||||||
|
|
||||||
ImageStream? imageStream;
|
|
||||||
var zoomKey = GlobalKey();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theMaxHeight = useState<double>(maxHeight);
|
final theMaxHeight = useState<double>(maxHeight);
|
||||||
|
|
||||||
useValueChanged<double, void>(maxHeight, (oldValue, __) => theMaxHeight.value = maxHeight);
|
useValueChanged<double, void>(maxHeight, (oldValue, __) => theMaxHeight.value = maxHeight);
|
||||||
// final imgActualHeight = useState<double?>(sateData.imageScale.value?.actualImgHeight);
|
|
||||||
// final scrollControllerQuestion = useScrollController(); // 试题图片区域
|
var zoomKey = useState<GlobalKey>(GlobalKey());
|
||||||
|
useValueChanged<int?, void>(zoomState.zoomFile.value?.templateId, (old, __) {
|
||||||
|
zoomKey.value = GlobalKey();
|
||||||
|
});
|
||||||
|
|
||||||
var vnHandWritings = useValueNotifier<List<dynamic>>([]);
|
var vnHandWritings = useValueNotifier<List<dynamic>>([]);
|
||||||
|
|
||||||
/// 滑动高度
|
/// 滑动高度
|
||||||
var initPosition = useState<Offset?>(null);
|
var initPosition = useState<Offset?>(null);
|
||||||
|
|
||||||
var customPaintSize = useState<Size>(Size.zero);
|
// var customPaintSize = useState<Size>(Size.zero);
|
||||||
|
|
||||||
// useValueChanged<double?, void>(sateData.imageScale.value?.actualImgHeight, (_, __) {
|
|
||||||
// imgActualHeight.value = sateData.imageScale.value?.actualImgHeight;
|
|
||||||
// });
|
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
var listenStream = sateData.data.listen((e) {
|
var listenStream = sateData.data.listen((e) {
|
||||||
|
|
@ -535,17 +298,9 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
sateData.handwritings = [];
|
sateData.handwritings = [];
|
||||||
vnHandWritings.value = sateData.handwritings;
|
vnHandWritings.value = sateData.handwritings;
|
||||||
});
|
});
|
||||||
var listenStreamImageScale = sateData.imageScale.listen((e) {
|
|
||||||
customPaintSize.value = Size(
|
|
||||||
sateData.imageScale.value?.actualImgWidth ?? 0,
|
|
||||||
sateData.imageScale.value?.actualImgHeight ?? 0,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
var streamSubscriptionSlide = sateData.slide.listen((e) {
|
var streamSubscriptionSlide = sateData.slide.listen((e) {
|
||||||
if (sateData.panQuestView != null &&
|
if (sateData.panQuestView != null && sateData.panQuestView == false && initPosition.value?.dy.abs().toInt().toDouble() != sateData.slide.value) {
|
||||||
sateData.panQuestView == false &&
|
|
||||||
initPosition.value?.dy.abs().toInt().toDouble() != sateData.slide.value) {
|
|
||||||
if (sateData.zoomOffset != null) {
|
if (sateData.zoomOffset != null) {
|
||||||
sateData.zoomOffset = Offset(sateData.zoomOffset!.dx, -sateData.slide.value);
|
sateData.zoomOffset = Offset(sateData.zoomOffset!.dx, -sateData.slide.value);
|
||||||
}
|
}
|
||||||
|
|
@ -555,25 +310,10 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
});
|
});
|
||||||
return () {
|
return () {
|
||||||
listenStream.cancel();
|
listenStream.cancel();
|
||||||
listenStreamImageScale.cancel();
|
|
||||||
streamSubscriptionSlide.cancel();
|
streamSubscriptionSlide.cancel();
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
var imageStreamListener = useState<ImageStreamListener>(ImageStreamListener((ImageInfo info, bool _) {
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
sateData.imageScale.value = TestQuestionsImageInfo(
|
|
||||||
templateId: sateData.data.value?.templateId,
|
|
||||||
boxWidth: maxWidth,
|
|
||||||
boxHeight: theMaxHeight.value,
|
|
||||||
imageWidth: info.image.width.toDouble(),
|
|
||||||
imageHeight: info.image.height.toDouble(),
|
|
||||||
url: sateData.data.value!.zgtAnswer,
|
|
||||||
);
|
|
||||||
// print("这里的高度 ${theMaxHeight.value} $actualHeight ${sateData.imageScale.value?.actualImgHeight}");
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
// 可选:添加滚动监听
|
// 可选:添加滚动监听
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
eventOn(callback: (BottomOperationBar e) async {
|
eventOn(callback: (BottomOperationBar e) async {
|
||||||
|
|
@ -582,12 +322,9 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
// 情况全部
|
// 情况全部
|
||||||
if (annotationsData.isNotEmpty) {
|
if (annotationsData.isNotEmpty) {
|
||||||
bool? res = await showDialog<bool>(
|
bool? res = await showDialog<bool>(
|
||||||
context: context,
|
context: Get.context ?? context,
|
||||||
builder: (context1) {
|
builder: (context1) {
|
||||||
return AlertDialog(content: quickText("是否撤销全部批注痕迹?"), actions: <Widget>[
|
return AlertDialog(content: quickText("是否撤销全部批注痕迹?"), actions: <Widget>[TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)), TextButton(child: quickText("确定", color: Theme.of(context1).primaryColor), onPressed: () => Navigator.pop(context1, true))]);
|
||||||
TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)),
|
|
||||||
TextButton(child: quickText("确定", color: Theme.of(context).primaryColor), onPressed: () => Navigator.pop(context1, true))
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res == true) vnHandWritings.value = [];
|
if (res == true) vnHandWritings.value = [];
|
||||||
|
|
@ -648,100 +385,82 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
vnHandWritings.value = annotationsData;
|
vnHandWritings.value = annotationsData;
|
||||||
});
|
});
|
||||||
|
|
||||||
// scrollControllerQuestion.addListener(() {
|
|
||||||
// sateData.slide.value = scrollControllerQuestion.offset;
|
|
||||||
// }); // 执行滚动相关的逻辑,例如打印滚动位置
|
|
||||||
|
|
||||||
// var listenVal = sateData.slide.listen((e) {
|
|
||||||
// if (e != scrollControllerQuestion.offset && sateData.panQuestView == false) scrollControllerQuestion.jumpTo(e);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// 返回一个清理函数,在组件销毁时移除监听
|
|
||||||
return () {
|
return () {
|
||||||
activePointers = 0;
|
_activePointers = 0;
|
||||||
// listenVal.cancel();
|
|
||||||
imageStream?.removeListener(imageStreamListener.value);
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
print("++++++++++++++++++++++ ${theMaxHeight.value}");
|
print("++++++++++++++++++++++ ${theMaxHeight.value}");
|
||||||
print("+++++ 位置:${initPosition.value}");
|
print("+++++ 位置:${initPosition.value}");
|
||||||
print("+++++ 缩放:${sateData.initScale.value}");
|
|
||||||
// sateData.slide.value
|
|
||||||
|
|
||||||
return Container(
|
return Listener(
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// boxShadow: [
|
|
||||||
// BoxShadow(
|
|
||||||
// color: Colors.grey.withOpacity(0.2),
|
|
||||||
// offset: Offset(-6.r, 1.r),
|
|
||||||
// blurRadius: 10.r,
|
|
||||||
// spreadRadius: 8.r,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
width: maxWidth,
|
|
||||||
// height: theMaxHeight.value,
|
|
||||||
child: Listener(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
onPointerDown: (PointerDownEvent event) {
|
onPointerDown: (PointerDownEvent event) {
|
||||||
// 判断当前是否已经有触摸点,如果有则忽略该触摸事件
|
// 判断当前是否已经有触摸点,如果有则忽略该触摸事件
|
||||||
|
|
||||||
// 处理单个触摸点按下的逻辑
|
// 处理单个触摸点按下的逻辑
|
||||||
activePointers++;
|
_activePointers++;
|
||||||
sateData.panQuestView = true;
|
sateData.panQuestView = true;
|
||||||
},
|
},
|
||||||
onPointerUp: (PointerUpEvent details) {
|
onPointerUp: (PointerUpEvent details) {
|
||||||
// 处理单个触摸点抬起的逻辑
|
// 处理单个触摸点抬起的逻辑
|
||||||
// activePointers--;
|
// activePointers--;
|
||||||
// globalPosition = null;
|
// globalPosition = null;
|
||||||
activePointers--;
|
_activePointers--;
|
||||||
|
if (!annotationState.pen.value) return;
|
||||||
|
|
||||||
var imageScale = sateData.imageScale.value;
|
|
||||||
if (imageScale == null || !annotationState.pen.value) return;
|
|
||||||
vnHandWritings.value.add(null); // 增加空点以分隔不同的线段
|
vnHandWritings.value.add(null); // 增加空点以分隔不同的线段
|
||||||
sateData.handwritings = vnHandWritings.value; // 添加笔迹数据
|
sateData.handwritings = vnHandWritings.value; // 添加笔迹数据
|
||||||
},
|
},
|
||||||
onPointerMove: (PointerMoveEvent event) {
|
onPointerMove: (PointerMoveEvent event) {
|
||||||
if (activePointers != 1) return;
|
if (_activePointers != 1) return;
|
||||||
|
if (!annotationState.pen.value) return;
|
||||||
|
|
||||||
var imageScale = sateData.imageScale.value;
|
|
||||||
if (imageScale == null || !annotationState.pen.value) return;
|
|
||||||
Offset localPosition = event.localPosition; // 相对
|
Offset localPosition = event.localPosition; // 相对
|
||||||
|
var imageHeightOffsetStart = zoomState.zoomFile.value!.getZoomFileOffsetStart(zoomState.initScale.value ?? 1);
|
||||||
print("\\\\\\\\");
|
print("位置:$localPosition; 图片所在位置:$imageHeightOffsetStart");
|
||||||
print(localPosition);
|
if (imageHeightOffsetStart == 0) return;
|
||||||
print("\\\\\\\\ ${imageScale.actualImgHeight}");
|
|
||||||
|
|
||||||
var dy = localPosition.dy;
|
var dy = localPosition.dy;
|
||||||
if (dy > imageScale.actualImgHeight || dy < 0) return; // 检查笔记是否超出图片范围
|
if (dy < imageHeightOffsetStart || dy > zoomState.zoomFile.value!.imageHeightOffsetend!) return; // 检查笔记是否超出图片范围
|
||||||
|
|
||||||
var theScale = sateData.initScale.value ?? 1;
|
// 说明:“- imageHeightOffsetStart” 由于显示笔记的位置是以图片的位置开始,手势坐标是以左上角开始 所以需要减去上面空白位置
|
||||||
|
print("向上距离:$imageHeightOffsetStart");
|
||||||
|
localPosition = Offset(localPosition.dx, localPosition.dy - imageHeightOffsetStart);
|
||||||
|
|
||||||
/// 缩放后的基数
|
// var theScale = sateData.initScale.value ?? 1;
|
||||||
if (theScale != 1) {
|
|
||||||
localPosition = Offset(localPosition.dx / theScale, localPosition.dy / theScale);
|
|
||||||
var theZoomOffset = sateData.zoomOffset;
|
|
||||||
if (theZoomOffset != null) {
|
|
||||||
var dx = theZoomOffset.dx;
|
|
||||||
var dy = theZoomOffset.dy;
|
|
||||||
localPosition = Offset(localPosition.dx + dx, localPosition.dy + dy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// print("}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} $theScale");
|
||||||
|
|
||||||
|
// /// 缩放后的基数
|
||||||
|
// if (theScale != 1) {
|
||||||
|
// print("PPPPPPPPPPPPPPPPPPPPPPPP");
|
||||||
|
// localPosition = Offset(localPosition.dx / theScale, localPosition.dy / theScale);
|
||||||
|
// var theZoomOffset = sateData.zoomOffset;
|
||||||
|
// if (theZoomOffset != null) {
|
||||||
|
// var dx = theZoomOffset.dx;
|
||||||
|
// var dy = theZoomOffset.dy;
|
||||||
|
// localPosition = Offset(localPosition.dx + dx, localPosition.dy + dy);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
print("最终位置 : $localPosition");
|
||||||
vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition);
|
vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition);
|
||||||
sateData.handwritings = vnHandWritings.value;
|
sateData.handwritings = vnHandWritings.value;
|
||||||
|
print(sateData.handwritings);
|
||||||
},
|
},
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
var isPen = annotationState.pen.value;
|
var isPen = annotationState.pen.value;
|
||||||
var showZgtAnnotate = sateData.data.value?.showZgtAnnotate;
|
var showZgtAnnotate = sateData.data.value?.showZgtAnnotate;
|
||||||
// sateData.slide.value
|
|
||||||
// print("55555高度: ${actualHeight} ${initPosition.value}");
|
return Container(
|
||||||
return IgnorePointer(
|
height: double.infinity,
|
||||||
|
width: double.infinity,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: IgnorePointer(
|
||||||
ignoring: isPen,
|
ignoring: isPen,
|
||||||
child: Zoom(
|
child: Zoom(
|
||||||
key: zoomKey,
|
key: zoomKey.value,
|
||||||
initTotalZoomOut: true, // 展示全部内容 初始化不产生滚动条
|
initTotalZoomOut: true, // 展示全部内容 初始化不产生滚动条
|
||||||
zoomSensibility: 0.05,
|
zoomSensibility: 0.05,
|
||||||
scrollWeight: 4.r,
|
scrollWeight: 4.r,
|
||||||
|
|
@ -749,53 +468,30 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
maxZoomWidth: maxWidth,
|
maxZoomWidth: maxWidth,
|
||||||
maxZoomHeight: actualHeight,
|
maxZoomHeight: actualHeight,
|
||||||
canvasColor: Colors.transparent,
|
canvasColor: Colors.transparent,
|
||||||
initPosition: initPosition.value,
|
// initPosition: initPosition.value,
|
||||||
initScale: sateData.initScale.value,
|
// initScale: logic.zoomLogic.zoomState.initScale.value ?? 1,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
onScaleUpdate: logic.onScaleUpdate,
|
onScaleUpdate: logic.zoomLogic.onScaleUpdate,
|
||||||
onPositionUpdate: logic.onPanUpPosition,
|
onPositionUpdate: logic.zoomLogic.onPanUpPosition,
|
||||||
child: Center(
|
child: RepaintBoundary(
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
$TheCachedNetworkImage(
|
|
||||||
imageUrl: sateData.data.value!.zgtAnswer,
|
|
||||||
imgWidth: maxWidth,
|
|
||||||
(context, imageProvider) {
|
|
||||||
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
|
|
||||||
imageStream?.removeListener(imageStreamListener.value);
|
|
||||||
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener.value);
|
|
||||||
return imageWidget;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
RepaintBoundary(
|
|
||||||
key: logic.pictureOverviewKey,
|
key: logic.pictureOverviewKey,
|
||||||
child: CustomPaint(
|
child: CustomPaint(
|
||||||
isComplex: true,
|
// isComplex: true,
|
||||||
size: customPaintSize.value,
|
// size: customPaintSize.value,
|
||||||
foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
|
foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
|
||||||
child: showZgtAnnotate != null
|
child: $TheCachedNetworkImage(
|
||||||
? $TheCachedNetworkImage(
|
|
||||||
imgWidth: maxWidth,
|
imgWidth: maxWidth,
|
||||||
imageUrl: showZgtAnnotate,
|
imageUrl: showZgtAnnotate ?? sateData.data.value!.zgtAnswer,
|
||||||
(_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth))
|
(_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth),
|
||||||
: null,
|
|
||||||
),
|
),
|
||||||
|
// child: showZgtAnnotate != null ? $TheCachedNetworkImage(imgWidth: maxWidth, imageUrl: showZgtAnnotate, (_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth)) : null,
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// return Obx(() {
|
|
||||||
// var imageUrl = sateData.data.value?.zgtAnswer;
|
|
||||||
|
|
||||||
// if (imageUrl == null) return const SizedBox();
|
|
||||||
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -805,7 +501,7 @@ class DrawingPainter extends CustomPainter {
|
||||||
final Paint paintBrush = Paint()
|
final Paint paintBrush = Paint()
|
||||||
..color = Colors.red
|
..color = Colors.red
|
||||||
..strokeCap = StrokeCap.round
|
..strokeCap = StrokeCap.round
|
||||||
..strokeWidth = 0.6.r;
|
..strokeWidth = 0.75.sp;
|
||||||
DrawingPainter({required this.ctrl}) : super(repaint: ctrl);
|
DrawingPainter({required this.ctrl}) : super(repaint: ctrl);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import 'package:making_school_asignment_app/common/job/marking_models/do_test_qu
|
||||||
import 'package:making_school_asignment_app/common/job/marking_models/favor_param.dart';
|
import 'package:making_school_asignment_app/common/job/marking_models/favor_param.dart';
|
||||||
import 'package:making_school_asignment_app/common/job/marking_models/review_submission_params.dart';
|
import 'package:making_school_asignment_app/common/job/marking_models/review_submission_params.dart';
|
||||||
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart';
|
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart';
|
||||||
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart' as anti_shake_throttling;
|
|
||||||
import 'package:making_school_asignment_app/common/utils/permission_describe_util.dart';
|
import 'package:making_school_asignment_app/common/utils/permission_describe_util.dart';
|
||||||
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';
|
||||||
|
|
@ -34,8 +33,8 @@ class HomeworkReviewState {
|
||||||
late Rx<List<StudentQuestions>?> studentQuestions;
|
late Rx<List<StudentQuestions>?> studentQuestions;
|
||||||
late Rx<double> slide; // 滑动位置
|
late Rx<double> slide; // 滑动位置
|
||||||
bool? panQuestView = null;
|
bool? panQuestView = null;
|
||||||
late Rx<TestQuestionsImageInfo?> imageScale;
|
// late Rx<TestQuestionsImageInfo?> imageScale;
|
||||||
late Rx<TestQuestionsImageInfo?> imageScaleZoom = Rx<TestQuestionsImageInfo?>(null);
|
// late Rx<TestQuestionsImageInfo?> imageScaleZoom = Rx<TestQuestionsImageInfo?>(null);
|
||||||
|
|
||||||
/// 图片放大后的操作存放数据
|
/// 图片放大后的操作存放数据
|
||||||
List<dynamic> handwritings = [];
|
List<dynamic> handwritings = [];
|
||||||
|
|
@ -43,7 +42,6 @@ class HomeworkReviewState {
|
||||||
bool lastQuestionPrompt = false; // 最后一题提示
|
bool lastQuestionPrompt = false; // 最后一题提示
|
||||||
Rx<bool> getDataError = false.obs; // 获取作业数据报错
|
Rx<bool> getDataError = false.obs; // 获取作业数据报错
|
||||||
|
|
||||||
Rx<double?> initScale = Rx<double?>(null);
|
|
||||||
Offset? zoomOffset;
|
Offset? zoomOffset;
|
||||||
RxBool favorite = false.obs; // 初始化数据
|
RxBool favorite = false.obs; // 初始化数据
|
||||||
// late String dateEnd = '';
|
// late String dateEnd = '';
|
||||||
|
|
@ -68,22 +66,23 @@ class HomeworkReviewBinding extends Bindings {
|
||||||
@override
|
@override
|
||||||
void dependencies() {
|
void dependencies() {
|
||||||
Get.lazyPut(() => HomeworkReviewLogic());
|
Get.lazyPut(() => HomeworkReviewLogic());
|
||||||
Get.lazyPut(() => ZoomLogic());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
||||||
|
final zoomLogic = Get.find<ZoomLogic>();
|
||||||
final GlobalKey pictureOverviewKey = GlobalKey();
|
final GlobalKey pictureOverviewKey = GlobalKey();
|
||||||
late StreamSubscription<DoPaperDetailsParam> _paramListen;
|
late StreamSubscription<DoPaperDetailsParam> _paramListen;
|
||||||
late StreamSubscription<DoPaperDetailsResult?> _dataListen;
|
late StreamSubscription<DoPaperDetailsResult?> _dataListen;
|
||||||
final HomeworkReviewState state = HomeworkReviewState();
|
final HomeworkReviewState state = HomeworkReviewState();
|
||||||
final HomeworkReviewAnnotationsControlState annotationState = HomeworkReviewAnnotationsControlState();
|
final HomeworkReviewAnnotationsControlState annotationState = HomeworkReviewAnnotationsControlState();
|
||||||
double appBarHeight = 56;
|
double appBarHeight = 56;
|
||||||
StreamSubscription<double?>? initScaleStream;
|
|
||||||
StreamSubscription<TestQuestionsImageInfo?>? imageScaleZoomStream;
|
StreamSubscription<TestQuestionsImageInfo?>? imageScaleZoomStream;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
|
|
||||||
appBarHeight = MediaQuery.of(Get.context!).padding.top;
|
appBarHeight = MediaQuery.of(Get.context!).padding.top;
|
||||||
print("appBarHeight :$appBarHeight");
|
print("appBarHeight :$appBarHeight");
|
||||||
// WidgetsFlutterBinding.ensureInitialized();
|
// WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
@ -98,7 +97,7 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
||||||
).obs;
|
).obs;
|
||||||
state.data = Rx<DoPaperDetailsResult?>(null);
|
state.data = Rx<DoPaperDetailsResult?>(null);
|
||||||
state.studentQuestions = Rx<List<StudentQuestions>?>(null);
|
state.studentQuestions = Rx<List<StudentQuestions>?>(null);
|
||||||
state.imageScale = Rx<TestQuestionsImageInfo?>(null);
|
// state.imageScale = Rx<TestQuestionsImageInfo?>(null);
|
||||||
state.slide = 0.0.obs;
|
state.slide = 0.0.obs;
|
||||||
|
|
||||||
// 参数变化更新作业详情
|
// 参数变化更新作业详情
|
||||||
|
|
@ -106,27 +105,26 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
||||||
// 试题数据
|
// 试题数据
|
||||||
_dataListen = state.data.listen((e) {
|
_dataListen = state.data.listen((e) {
|
||||||
if (e == null) return;
|
if (e == null) return;
|
||||||
state.imageScale.value = null;
|
var zoomState = zoomLogic.zoomState;
|
||||||
|
|
||||||
|
state.studentQuestions.value = e.studentQuestions; // 赋值试题集合
|
||||||
|
|
||||||
|
|
||||||
|
final currentTemplateId = zoomState.zoomFile.value?.templateId; // 获取旧题号ID
|
||||||
|
if (currentTemplateId != null && currentTemplateId != e.templateId) {
|
||||||
|
// zoom 题号判断是否有变 有变就需要清空 zoom文件
|
||||||
|
zoomState.initScale.value = null;
|
||||||
|
zoomState.zoomFile.value!.clearZoomFile(e.templateId);
|
||||||
|
zoomState.zoomFile.update((_) {}); // 更新的是对象 需要执行此回调
|
||||||
|
}
|
||||||
if (state.favorite.value != e.isFav) state.favorite.value = !state.favorite.value;
|
if (state.favorite.value != e.isFav) state.favorite.value = !state.favorite.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
imageScaleZoomStream = state.imageScale.listen((e) {
|
// imageScaleZoomStream = state.imageScale.listen((e) {
|
||||||
// state.imageScaleZoom.value = theImageScale;
|
// // state.imageScaleZoom.value = theImageScale;
|
||||||
var theImageScaleZoom = state.imageScaleZoom.value;
|
// var theImageScaleZoom = state.imageScaleZoom.value;
|
||||||
if (theImageScaleZoom == null || theImageScaleZoom.url != e?.url) state.imageScaleZoom.value = e;
|
// if (theImageScaleZoom == null || theImageScaleZoom.url != e?.url) state.imageScaleZoom.value = e;
|
||||||
});
|
// });
|
||||||
|
|
||||||
initScaleStream = state.initScale.listen((e) {
|
|
||||||
anti_shake_throttling.debounce(() {
|
|
||||||
var theImageScale = state.imageScale.value;
|
|
||||||
if (theImageScale != null) {
|
|
||||||
theImageScale = TestQuestionsImageInfo.fromJson(theImageScale.toJson());
|
|
||||||
theImageScale.zoom = e ?? 1;
|
|
||||||
theImageScale = TestQuestionsImageInfo.fromJson(theImageScale.toJson());
|
|
||||||
}
|
|
||||||
state.imageScaleZoom.value = theImageScale;
|
|
||||||
}, const Duration(milliseconds: 100))();
|
|
||||||
});
|
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) => getData());
|
WidgetsBinding.instance.addPostFrameCallback((_) => getData());
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
@ -154,7 +152,6 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]); // 屏幕刘海
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]); // 屏幕刘海
|
||||||
_dataListen.cancel();
|
_dataListen.cancel();
|
||||||
_paramListen.cancel();
|
_paramListen.cancel();
|
||||||
initScaleStream?.cancel();
|
|
||||||
imageScaleZoomStream?.cancel();
|
imageScaleZoomStream?.cancel();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
@ -171,10 +168,8 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
||||||
// item.topHeight = itemPre.height;
|
// item.topHeight = itemPre.height;
|
||||||
// }
|
// }
|
||||||
state.getDataError.value = false;
|
state.getDataError.value = false;
|
||||||
state.data.value = data;
|
|
||||||
state.handwritings = [];
|
state.handwritings = [];
|
||||||
state.studentQuestions.value = data.studentQuestions;
|
state.data.value = data;
|
||||||
state.initScale.value = null;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('获取数据报错了:$e');
|
print('获取数据报错了:$e');
|
||||||
// ToastUtils.showError('未获取到试题数据,请重试');
|
// ToastUtils.showError('未获取到试题数据,请重试');
|
||||||
|
|
@ -243,12 +238,8 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
||||||
if (boundary == null) return null;
|
if (boundary == null) return null;
|
||||||
// double dpr = MediaQuery.of(context).devicePixelRatio;
|
// double dpr = MediaQuery.of(context).devicePixelRatio;
|
||||||
|
|
||||||
double pixelRatio = MediaQuery.of(context).devicePixelRatio;
|
/// 此图片在设备中的像素比例
|
||||||
var imageScale = state.imageScale.value;
|
double? pixelRatio = zoomLogic.zoomState.zoomFile.value?.scaleRatio ?? MediaQuery.of(context).devicePixelRatio;
|
||||||
if (imageScale != null) {
|
|
||||||
// 还原图片原始比例
|
|
||||||
pixelRatio = imageScale.imageWidth / imageScale.boxWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.Image image = await boundary.toImage(pixelRatio: pixelRatio);
|
ui.Image image = await boundary.toImage(pixelRatio: pixelRatio);
|
||||||
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
|
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
|
||||||
|
|
@ -351,24 +342,6 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPanUpPosition(Offset val) async {
|
|
||||||
// 手指在移动 非物体移动的位置
|
|
||||||
|
|
||||||
if (state.zoomOffset?.dy.toStringAsFixed(2) != val.dy.toStringAsFixed(2) ||
|
|
||||||
state.zoomOffset?.dx.toStringAsFixed(2) != val.dx.toStringAsFixed(2)) {
|
|
||||||
print('**************** 正在移动位置 YYY:${val.dy}');
|
|
||||||
print('**************** 正在移动位置 XXX:${val.dx}');
|
|
||||||
state.zoomOffset = val;
|
|
||||||
state.slide.value = val.dy.abs().toInt().toDouble();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 缩放组件 ==> 缩放监听
|
|
||||||
void onScaleUpdate(double scale, double zoom) async {
|
|
||||||
print("$scale $zoom");
|
|
||||||
state.initScale.value = zoom;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> toFavorite() async {
|
Future<void> toFavorite() async {
|
||||||
try {
|
try {
|
||||||
var data = state.data.value!;
|
var data = state.data.value!;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:ui' show ImmutableBuffer, ImageDescriptor;
|
import 'dart:ui' show ImmutableBuffer, ImageDescriptor;
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart' as anti_shake_throttling;
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
@ -13,24 +14,28 @@ import 'index.dart';
|
||||||
part 'zoom_logic.g.dart';
|
part 'zoom_logic.g.dart';
|
||||||
|
|
||||||
class ZoomLogic extends GetxController {
|
class ZoomLogic extends GetxController {
|
||||||
final logic = Get.find<HomeworkReviewLogic>();
|
ZoomState zoomState = ZoomState(
|
||||||
HomeworkReviewState get homeworkState => logic.state;
|
initScale: Rx<double?>(null),
|
||||||
|
zoomFile: Rx<ZoomFileModel?>(null),
|
||||||
|
);
|
||||||
|
|
||||||
ZoomState zoomState = ZoomState(zoomFile: Rx<ZoomFileModel?>(null));
|
var oldTemplateId;
|
||||||
|
|
||||||
var oldTemplateId = null;
|
|
||||||
late StreamSubscription _streamHomework;
|
late StreamSubscription _streamHomework;
|
||||||
late StreamSubscription _streamZoomState;
|
late StreamSubscription _streamZoomState;
|
||||||
|
|
||||||
|
StreamSubscription<double?>? initScaleStream;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
oldTemplateId = zoomState.zoomFile.value?.templateId;
|
oldTemplateId = zoomState.zoomFile.value?.templateId;
|
||||||
|
|
||||||
|
/// 根据第一次加载的试题题号 分析试题图片所占的宽高
|
||||||
_streamZoomState = zoomState.zoomFile.listen((e) {
|
_streamZoomState = zoomState.zoomFile.listen((e) {
|
||||||
var templateId = e?.templateId;
|
var templateId = e?.templateId;
|
||||||
print("ZOOMFILE 变化了 $templateId");
|
print("ZOOMFILE 变化了 $templateId");
|
||||||
if (templateId == null) return;
|
if (templateId == null) return;
|
||||||
|
|
||||||
var homeworkData = homeworkState.data.value;
|
var homeworkData = Get.find<HomeworkReviewLogic>().state.data.value;
|
||||||
var zgtAnswer = homeworkData?.zgtAnswer;
|
var zgtAnswer = homeworkData?.zgtAnswer;
|
||||||
print("333333");
|
print("333333");
|
||||||
if (zgtAnswer == null) return;
|
if (zgtAnswer == null) return;
|
||||||
|
|
@ -51,13 +56,21 @@ class ZoomLogic extends GetxController {
|
||||||
zoomState.zoomFile.value = ZoomFileModel.fromJson(oldVal.toJson());
|
zoomState.zoomFile.value = ZoomFileModel.fromJson(oldVal.toJson());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
_streamHomework = homeworkState.data.listen((e) {
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((e) {
|
||||||
|
/// 试题加载后更新尺寸对象(只要题号没有变就不更新尺寸对象)
|
||||||
|
_streamHomework = Get.find<HomeworkReviewLogic>().state.data.listen((e) {
|
||||||
print("HOMEWORKSTATE 变化了");
|
print("HOMEWORKSTATE 变化了");
|
||||||
if (e == null || zoomState.zoomFile.value == null) return;
|
if (e == null || zoomState.zoomFile.value == null) return;
|
||||||
zoomState.zoomFile.value!.templateId = e.templateId;
|
zoomState.zoomFile.value!.templateId = e.templateId;
|
||||||
print("666666 ${e.templateId}");
|
print("666666 ${e.templateId}");
|
||||||
zoomState.zoomFile.value = ZoomFileModel.fromJson(zoomState.zoomFile.value!.toJson());
|
zoomState.zoomFile.value = ZoomFileModel.fromJson(zoomState.zoomFile.value!.toJson());
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/// 监听缩放
|
||||||
|
initScaleStream = zoomState.initScale.listen((e) {});
|
||||||
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,12 +80,41 @@ class ZoomLogic extends GetxController {
|
||||||
_streamZoomState.cancel();
|
_streamZoomState.cancel();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 缩放组件 ==> 缩放监听
|
||||||
|
void onScaleUpdate(double scale, double zoom) async {
|
||||||
|
print("$scale $zoom");
|
||||||
|
|
||||||
|
/// 防抖
|
||||||
|
zoomState.initScale.value = zoom;
|
||||||
|
// anti_shake_throttling.debounce(() => zoomState.initScale.value = zoom, const Duration(milliseconds: 100))();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 缩放组件 ==> 位置更新
|
||||||
|
void onPanUpPosition(Offset val) async {
|
||||||
|
// 手指在移动 非物体移动的位置
|
||||||
|
var state = Get.find<HomeworkReviewLogic>().state;
|
||||||
|
if (state.zoomOffset?.dy.toStringAsFixed(2) != val.dy.toStringAsFixed(2) || state.zoomOffset?.dx.toStringAsFixed(2) != val.dx.toStringAsFixed(2)) {
|
||||||
|
// print('**************** 正在移动位置 YYY:${val.dy}');
|
||||||
|
// print('**************** 正在移动位置 XXX:${val.dx}');
|
||||||
|
state.zoomOffset = val;
|
||||||
|
state.slide.value = val.dy.abs().toInt().toDouble();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HomeworkReviewZoomBinding extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.lazyPut(() => ZoomLogic());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ZoomState {
|
class ZoomState {
|
||||||
|
final Rx<double?> initScale;
|
||||||
final Rx<ZoomFileModel?> zoomFile;
|
final Rx<ZoomFileModel?> zoomFile;
|
||||||
|
|
||||||
const ZoomState({required this.zoomFile});
|
const ZoomState({required this.zoomFile, required this.initScale});
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
@ -80,38 +122,73 @@ class ZoomFileModel extends Object {
|
||||||
double viewWidth; // 容器宽度
|
double viewWidth; // 容器宽度
|
||||||
double viewHeight; // 容器高度
|
double viewHeight; // 容器高度
|
||||||
|
|
||||||
|
double scaleRatio; // 基准
|
||||||
|
|
||||||
int? templateId; // 页码
|
int? templateId; // 页码
|
||||||
|
|
||||||
|
double? pixelRatio; // 像素比率
|
||||||
|
|
||||||
double? fileWidth; // 文件宽度
|
double? fileWidth; // 文件宽度
|
||||||
double? fileHeight; // 文件高度
|
double? fileHeight; // 文件高度
|
||||||
|
|
||||||
double? actualWidth; // 实际展示宽度
|
double? actualWidth; // 实际展示宽度
|
||||||
double? actualHeight; // 实际展示高度
|
double? actualHeight; // 实际展示高度
|
||||||
|
|
||||||
|
double? remainingHeight; // 视图剩余高度 实际展示图片展示高度下 剩余高度.(若为负数就是超出视图的高度值)
|
||||||
|
double? imageHeightOffsetStart; // 顶部坐标Y
|
||||||
|
double? imageHeightOffsetend; // 底部坐标Y
|
||||||
|
|
||||||
ZoomFileModel({
|
ZoomFileModel({
|
||||||
required this.viewWidth,
|
required this.viewWidth,
|
||||||
required this.viewHeight,
|
required this.viewHeight,
|
||||||
|
this.scaleRatio = 1,
|
||||||
this.templateId,
|
this.templateId,
|
||||||
this.fileWidth,
|
this.fileWidth,
|
||||||
this.fileHeight,
|
this.fileHeight,
|
||||||
this.actualWidth,
|
this.actualWidth,
|
||||||
this.actualHeight,
|
this.actualHeight,
|
||||||
|
this.remainingHeight,
|
||||||
|
this.imageHeightOffsetStart,
|
||||||
|
this.imageHeightOffsetend,
|
||||||
|
this.pixelRatio,
|
||||||
}) {
|
}) {
|
||||||
// 图片已视图宽为基准,高度自适应可滑动 图片的实际宽高都需要乘此基准值.
|
// 图片已视图宽为基准,高度自适应可滑动 图片的实际宽高都需要乘此基准值.
|
||||||
if (fileHeight == null || fileWidth == null) return;
|
if (fileHeight == null || fileWidth == null) return;
|
||||||
|
|
||||||
var scaleRatio = viewWidth / fileWidth!;
|
scaleRatio = viewWidth / fileWidth!;
|
||||||
actualWidth = fileWidth! * scaleRatio;
|
actualWidth = fileWidth! * scaleRatio;
|
||||||
actualHeight = fileHeight! * scaleRatio;
|
actualHeight = fileHeight! * scaleRatio;
|
||||||
|
|
||||||
// remainingHeight = boxHeight - actualImgHeight;
|
pixelRatio = fileWidth! / viewWidth; // 图片在此设备的像素比例
|
||||||
// imageHeightOffsetStart = remainingHeight / 2;
|
|
||||||
// imageHeightOffsetend = imageHeightOffsetStart + actualImgHeight;
|
remainingHeight = viewHeight - actualHeight!;
|
||||||
|
imageHeightOffsetStart = remainingHeight! / 2;
|
||||||
|
imageHeightOffsetend = imageHeightOffsetStart! + actualHeight!;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory ZoomFileModel.fromJson(Map<String, dynamic> srcJson) => _$ZoomFileModelFromJson(srcJson);
|
factory ZoomFileModel.fromJson(Map<String, dynamic> srcJson) => _$ZoomFileModelFromJson(srcJson);
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$ZoomFileModelToJson(this);
|
Map<String, dynamic> toJson() => _$ZoomFileModelToJson(this);
|
||||||
|
|
||||||
|
// 清空zoom文件(templateId 页码变换清空试题图片信息)
|
||||||
|
ZoomFileModel clearZoomFile(int newTemplateId) {
|
||||||
|
templateId = newTemplateId; // 页码
|
||||||
|
fileWidth = null; // 文件宽度
|
||||||
|
fileHeight = null; // 文件高度
|
||||||
|
actualWidth = null; // 实际展示宽度
|
||||||
|
actualHeight = null; // 实际展示高度
|
||||||
|
remainingHeight = null; // 视图剩余高度 实际展示图片展示高度下 剩余高度.(若为负数就是超出视图的高度值)
|
||||||
|
imageHeightOffsetStart = null; // 顶部坐标Y
|
||||||
|
imageHeightOffsetend = null; // 底部坐标Y
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 获取缩放比例后的空白距离
|
||||||
|
/// zoom 缩放比例
|
||||||
|
double getZoomFileOffsetStart(double zoom) {
|
||||||
|
if (zoom == 1 || actualHeight == null) return imageHeightOffsetStart ?? 0;
|
||||||
|
return (viewHeight - (actualHeight! * zoom)) / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 最终版
|
// 最终版
|
||||||
|
|
|
||||||
|
|
@ -20,18 +20,17 @@ class HomeworkReview extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final logic = Get.find<HomeworkReviewLogic>();
|
final logic = Get.find<HomeworkReviewLogic>();
|
||||||
final sateData = logic.state;
|
final sateData = logic.state;
|
||||||
final AnnotateClassLogic _controller = Get.find<AnnotateClassLogic>();
|
final AnnotateClassLogic controller = Get.find<AnnotateClassLogic>();
|
||||||
final HomeLogic _homeLogicController = Get.find<HomeLogic>();
|
final HomeLogic homeLogicController = Get.find<HomeLogic>();
|
||||||
|
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
onPopInvoked: (e) {
|
onPopInvoked: (e) {
|
||||||
if (e && sateData.needRefresh) {
|
if (e && sateData.needRefresh) {
|
||||||
_controller.getList();
|
controller.getList();
|
||||||
_homeLogicController.getList();
|
homeLogicController.getList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: SafeArea(
|
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
// titleSpacing: 0,
|
// titleSpacing: 0,
|
||||||
|
|
@ -42,26 +41,17 @@ class HomeworkReview extends StatelessWidget {
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
actions: [const FavoriteWidget(), SizedBox(width: 5.w), const ReturnToHomepage()],
|
actions: [const FavoriteWidget(), SizedBox(width: 5.w), const ReturnToHomepage()],
|
||||||
),
|
),
|
||||||
body: Column(
|
body: const Column(
|
||||||
children: [
|
children: [
|
||||||
// 下拉切换 30.h
|
// 下拉切换
|
||||||
const DropdownSwitchStudentsType(),
|
DropdownSwitchStudentsType(),
|
||||||
// +1
|
// SizedBox(height: 10),
|
||||||
SizedBox(height: 1.h),
|
// 试题展示区和打分区
|
||||||
const Expanded(child: QuestionPaperView()),
|
Expanded(child: QuestionPaperView()),
|
||||||
// +64.h
|
// 底部功能区
|
||||||
const BottomAnnotationSwitch()
|
BottomAnnotationSwitch()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// floatingActionButton: FloatingActionButton(
|
|
||||||
// elevation: 8,
|
|
||||||
// tooltip: "点击打开工具栏",
|
|
||||||
// backgroundColor: Colors.white,
|
|
||||||
// onPressed: () {},
|
|
||||||
// child: Icon(Icons.edit, size: 20.sp, color: Theme.of(context).primaryColor),
|
|
||||||
// ),
|
|
||||||
// floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class _JobReportPageState extends State<JobReportPage> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return OrientationBuilder(builder: (BuildContext context, Orientation orientation) {
|
return OrientationBuilder(builder: (BuildContext context, Orientation orientation) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Color.fromRGBO(245, 245, 245, 1),
|
backgroundColor: const Color.fromRGBO(245, 245, 245, 1),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
||||||
|
|
||||||
class PersonnelDataOverview extends StatefulWidget {
|
class PersonnelDataOverview extends StatefulWidget {
|
||||||
final List<Students> studentList;
|
final List<Students> studentList;
|
||||||
const PersonnelDataOverview({Key? key, required this.studentList}) : super(key: key);
|
const PersonnelDataOverview({super.key, required this.studentList});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PersonnelDataOverview> createState() => _PersonnelDataOverviewState();
|
State<PersonnelDataOverview> createState() => _PersonnelDataOverviewState();
|
||||||
|
|
@ -28,13 +28,13 @@ class _PersonnelDataOverviewState extends State<PersonnelDataOverview> {
|
||||||
var student = widget.studentList[i];
|
var student = widget.studentList[i];
|
||||||
TimeUnits timeUnits = convertMilliseconds(student.useTime!);
|
TimeUnits timeUnits = convertMilliseconds(student.useTime!);
|
||||||
String timeerStr = '';
|
String timeerStr = '';
|
||||||
if (timeUnits.hours > 0) timeerStr = timeUnits.hours.toString() + ':';
|
if (timeUnits.hours > 0) timeerStr = '${timeUnits.hours}:';
|
||||||
if (timeUnits.minutes > 0) timeerStr += timeUnits.minutes.toString() + ':';
|
if (timeUnits.minutes > 0) timeerStr += '${timeUnits.minutes}:';
|
||||||
timeerStr += timeUnits.seconds.toString();
|
timeerStr += timeUnits.seconds.toString();
|
||||||
|
|
||||||
names.add(student.studentName);
|
names.add(student.studentName);
|
||||||
useTimes.add(timeerStr);
|
useTimes.add(timeerStr);
|
||||||
correctRates.add(student.okRate!.toStringAsFixed(0) + '%');
|
correctRates.add('${student.okRate!.toStringAsFixed(0)}%');
|
||||||
noAnswerCounts.add(student.noAnswerCount.toString());
|
noAnswerCounts.add(student.noAnswerCount.toString());
|
||||||
rankings.add('${i + 1}名');
|
rankings.add('${i + 1}名');
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +60,7 @@ class _PersonnelDataOverviewState extends State<PersonnelDataOverview> {
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(bottom: 20.h),
|
margin: EdgeInsets.only(bottom: 20.h),
|
||||||
child: quickText('人员数据概况', color: Color.fromRGBO(92, 92, 92, 1), size: 14.sp, fontWeight: FontWeight.bold),
|
child: quickText('人员数据概况', color: const Color.fromRGBO(92, 92, 92, 1), size: 14.sp, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
Scrollbar(
|
Scrollbar(
|
||||||
thickness: 8.w,
|
thickness: 8.w,
|
||||||
|
|
@ -88,7 +88,7 @@ class _PersonnelDataOverviewState extends State<PersonnelDataOverview> {
|
||||||
color: const Color.fromRGBO(230, 230, 230, 1),
|
color: const Color.fromRGBO(230, 230, 230, 1),
|
||||||
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
|
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
|
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
|
||||||
child: quickText(entrie.key, color: Color.fromRGBO(24, 35, 77, 1), size: 12.sp, maxLines: 2),
|
child: quickText(entrie.key, color: const Color.fromRGBO(24, 35, 77, 1), size: 12.sp, maxLines: 2),
|
||||||
),
|
),
|
||||||
...entrie.value.map((e) {
|
...entrie.value.map((e) {
|
||||||
bool isTransparentChineseNew = isTransparentChinese && (e?.length ?? 0) == 0;
|
bool isTransparentChineseNew = isTransparentChinese && (e?.length ?? 0) == 0;
|
||||||
|
|
@ -97,23 +97,23 @@ class _PersonnelDataOverviewState extends State<PersonnelDataOverview> {
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
|
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
|
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
|
||||||
color: Color.fromRGBO(245, 245, 245, 1),
|
color: const Color.fromRGBO(245, 245, 245, 1),
|
||||||
child: isTransparentChineseNew
|
child: isTransparentChineseNew
|
||||||
? quickText('透明', color: Colors.transparent, size: 12.sp)
|
? quickText('透明', color: Colors.transparent, size: 12.sp)
|
||||||
: RegExp(r'^\d+$').hasMatch(e) || e.contains('%')
|
: RegExp(r'^\d+$').hasMatch(e) || e.contains('%')
|
||||||
? Row(
|
? Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
quickText(e, color: Color.fromRGBO(82, 82, 82, 1), size: 12.sp, maxLines: 2),
|
quickText(e, color: const Color.fromRGBO(82, 82, 82, 1), size: 12.sp, maxLines: 2),
|
||||||
quickText('透', color: Colors.transparent, size: 12.sp),
|
quickText('透', color: Colors.transparent, size: 12.sp),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: quickText(e, color: Color.fromRGBO(82, 82, 82, 1), size: 12.sp, maxLines: 2),
|
: quickText(e, color: const Color.fromRGBO(82, 82, 82, 1), size: 12.sp, maxLines: 2),
|
||||||
);
|
);
|
||||||
}).toList(),
|
}),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}).toList(),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class TaskListItem extends StatefulWidget {
|
||||||
final int tabIndex;
|
final int tabIndex;
|
||||||
final Function(Items item) collectFun;
|
final Function(Items item) collectFun;
|
||||||
|
|
||||||
const TaskListItem({Key? key, required this.completed, required this.jobTaskItem, required this.type, required this.collectFun,required this.tabIndex}) : super(key: key);
|
const TaskListItem({Key? key, required this.completed, required this.jobTaskItem, required this.type, required this.collectFun, required this.tabIndex}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<TaskListItem> createState() => _TaskListItemState();
|
State<TaskListItem> createState() => _TaskListItemState();
|
||||||
|
|
@ -31,8 +31,7 @@ class _TaskListItemState extends State<TaskListItem> {
|
||||||
return widget.completed
|
return widget.completed
|
||||||
? 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, 'subject': widget.jobTaskItem.subject, 'completed': true, 'tabIndex': widget.tabIndex});
|
||||||
arguments: {'id': widget.jobTaskItem.id, 'name': widget.jobTaskItem.name, 'grade': widget.jobTaskItem.grade,'subject': widget.jobTaskItem.subject, 'completed': true,'tabIndex':widget.tabIndex});
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
|
|
@ -73,7 +72,7 @@ class _TaskListItemState extends State<TaskListItem> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
margin: EdgeInsets.only(right: 4.w),
|
margin: EdgeInsets.only(right: 4.w),
|
||||||
child: quickText( widget.jobTaskItem.assessType == 0?'作业':'考试', color: Colors.white, size: 10.sp),
|
child: quickText(widget.jobTaskItem.assessType == 0 ? '作业' : '考试', color: Colors.white, size: 10.sp),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: quickText(
|
child: quickText(
|
||||||
|
|
@ -143,7 +142,13 @@ class _TaskListItemState extends State<TaskListItem> {
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
Get.toNamed(Routes.jobReportPage, arguments: {
|
||||||
|
'title': widget.jobTaskItem.name,
|
||||||
|
'homeworkId': widget.jobTaskItem.id,
|
||||||
|
'grade': widget.jobTaskItem.grade,
|
||||||
|
});
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: quickText('查看报告', color: const Color.fromRGBO(118, 118, 118, 1), size: 13.sp),
|
child: quickText('查看报告', color: const Color.fromRGBO(118, 118, 118, 1), size: 13.sp),
|
||||||
|
|
@ -159,8 +164,7 @@ class _TaskListItemState extends State<TaskListItem> {
|
||||||
padding: EdgeInsets.only(top: 10.r),
|
padding: EdgeInsets.only(top: 10.r),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.toNamed(Routes.annotateClassPage,
|
Get.toNamed(Routes.annotateClassPage, arguments: {'id': widget.jobTaskItem.id, 'name': widget.jobTaskItem.name, 'grade': widget.jobTaskItem.grade, 'subject': widget.jobTaskItem.subject, 'tabIndex': widget.tabIndex});
|
||||||
arguments: {'id': widget.jobTaskItem.id, 'name': widget.jobTaskItem.name, 'grade': widget.jobTaskItem.grade,'subject':widget.jobTaskItem.subject,'tabIndex':widget.tabIndex});
|
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.only(bottom: 16.h),
|
margin: EdgeInsets.only(bottom: 16.h),
|
||||||
|
|
@ -202,8 +206,8 @@ class _TaskListItemState extends State<TaskListItem> {
|
||||||
bottomRight: Radius.circular(12.r),
|
bottomRight: Radius.circular(12.r),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
margin: EdgeInsets.only(top:0.h,right: 4.w),
|
margin: EdgeInsets.only(top: 0.h, right: 4.w),
|
||||||
child: quickText(widget.jobTaskItem.assessType == 0?'作业':'考试', color: Colors.white, size: 10.sp),
|
child: quickText(widget.jobTaskItem.assessType == 0 ? '作业' : '考试', color: Colors.white, size: 10.sp),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
@ -243,8 +247,7 @@ class _TaskListItemState extends State<TaskListItem> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
quickText(' / ', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
|
quickText(' / ', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
|
||||||
quickText(DateTime.parse(widget.jobTaskItem.publishTime).toString().substring(0, 10),
|
quickText(DateTime.parse(widget.jobTaskItem.publishTime).toString().substring(0, 10), color: const Color.fromRGBO(97, 97, 97, 1), size: 12.sp),
|
||||||
color: const Color.fromRGBO(97, 97, 97, 1), size: 12.sp),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -266,7 +269,7 @@ class _TaskListItemState extends State<TaskListItem> {
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.jobTaskItem.isFixed! ? '已订正' : '收集订正',
|
widget.jobTaskItem.isFixed! ? '已订正' : '收集订正',
|
||||||
style: TextStyle(fontSize: 10.sp, color: widget.jobTaskItem.isFixed! ?const Color(0xFFF16262): const Color(0xFF8C68FF)),
|
style: TextStyle(fontSize: 10.sp, color: widget.jobTaskItem.isFixed! ? const Color(0xFFF16262) : const Color(0xFF8C68FF)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -274,15 +277,17 @@ class _TaskListItemState extends State<TaskListItem> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10.r,),
|
SizedBox(
|
||||||
|
width: 10.r,
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.r,horizontal: 9.r),
|
padding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 9.r),
|
||||||
decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.white),
|
decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.white),
|
||||||
child: CircularPercentIndicator(
|
child: CircularPercentIndicator(
|
||||||
radius: 50.r,
|
radius: 50.r,
|
||||||
lineWidth: 10.r,
|
lineWidth: 10.r,
|
||||||
animation: true,
|
animation: true,
|
||||||
reverse:true,
|
reverse: true,
|
||||||
percent: widget.jobTaskItem.annotateRate == null ? 0 : widget.jobTaskItem.annotateRate! / 100,
|
percent: widget.jobTaskItem.annotateRate == null ? 0 : widget.jobTaskItem.annotateRate! / 100,
|
||||||
center: Text.rich(TextSpan(children: [
|
center: Text.rich(TextSpan(children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import 'package:syncfusion_flutter_datepicker/datepicker.dart';
|
||||||
import 'student_work_detail_logic.dart';
|
import 'student_work_detail_logic.dart';
|
||||||
|
|
||||||
class StudentWorkDetailPage extends StatefulWidget {
|
class StudentWorkDetailPage extends StatefulWidget {
|
||||||
const StudentWorkDetailPage({Key? key}) : super(key: key);
|
const StudentWorkDetailPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StudentWorkDetailPage> createState() => _StudentWorkDetailPageState();
|
State<StudentWorkDetailPage> createState() => _StudentWorkDetailPageState();
|
||||||
|
|
@ -33,14 +33,14 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
return OrientationBuilder(
|
return OrientationBuilder(
|
||||||
builder: (BuildContext context, Orientation orientation) {
|
builder: (BuildContext context, Orientation orientation) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Color.fromRGBO(245, 245, 245, 1),
|
backgroundColor: const Color.fromRGBO(245, 245, 245, 1),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
title: Text('${state.studentName}作业详情',
|
title: Text('${state.studentName}作业详情',
|
||||||
style: TextStyle(fontSize: 14.sp, color: Color(0xFF333333))),
|
style: TextStyle(fontSize: 14.sp, color: const Color(0xFF333333))),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(Icons.arrow_back_ios, color: Colors.black),
|
icon: const Icon(Icons.arrow_back_ios, color: Colors.black),
|
||||||
onPressed: () => Get.back(),
|
onPressed: () => Get.back(),
|
||||||
),
|
),
|
||||||
actions: const [
|
actions: const [
|
||||||
|
|
@ -53,7 +53,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
Container(
|
Container(
|
||||||
height: 1.r,
|
height: 1.r,
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
color: Color.fromRGBO(179, 179, 179, 0.3),
|
color: const Color.fromRGBO(179, 179, 179, 0.3),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
|
@ -79,7 +79,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
fontSize: 14.sp,
|
fontSize: 14.sp,
|
||||||
color: state.isJob.value
|
color: state.isJob.value
|
||||||
? Theme.of(context).primaryColor
|
? Theme.of(context).primaryColor
|
||||||
: Color(0xFF505E6E)),
|
: const Color(0xFF505E6E)),
|
||||||
));
|
));
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|
@ -87,7 +87,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
Container(
|
Container(
|
||||||
height: 40.r,
|
height: 40.r,
|
||||||
width: 1.r,
|
width: 1.r,
|
||||||
color: Color.fromRGBO(179, 179, 179, 0.3),
|
color: const Color.fromRGBO(179, 179, 179, 0.3),
|
||||||
),
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
@ -107,7 +107,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
fontSize: 14.sp,
|
fontSize: 14.sp,
|
||||||
color: !state.isJob.value
|
color: !state.isJob.value
|
||||||
? Theme.of(context).primaryColor
|
? Theme.of(context).primaryColor
|
||||||
: Color(0xFF505E6E)),
|
: const Color(0xFF505E6E)),
|
||||||
);
|
);
|
||||||
})),
|
})),
|
||||||
),
|
),
|
||||||
|
|
@ -223,7 +223,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'注:',
|
'注:',
|
||||||
style: TextStyle(fontSize: 8.sp, color: Color(0xFF8B8B8B)),
|
style: TextStyle(fontSize: 8.sp, color: const Color(0xFF8B8B8B)),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: 10.r,
|
width: 10.r,
|
||||||
|
|
@ -239,7 +239,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'正确',
|
'正确',
|
||||||
style: TextStyle(fontSize: 8.sp, color: Color(0xFF8B8B8B)),
|
style: TextStyle(fontSize: 8.sp, color: const Color(0xFF8B8B8B)),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 15.r,
|
width: 15.r,
|
||||||
|
|
@ -258,7 +258,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'错误',
|
'错误',
|
||||||
style: TextStyle(fontSize: 8.sp, color: Color(0xFF8B8B8B)),
|
style: TextStyle(fontSize: 8.sp, color: const Color(0xFF8B8B8B)),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 15.r,
|
width: 15.r,
|
||||||
|
|
@ -269,7 +269,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5.r)),
|
borderRadius: BorderRadius.all(Radius.circular(5.r)),
|
||||||
// color: Color(0xFF666666),
|
// color: Color(0xFF666666),
|
||||||
border: Border.all(width: 1.r, color: Color(0xFF666666)),
|
border: Border.all(width: 1.r, color: const Color(0xFF666666)),
|
||||||
// border: Border.all(width: 1.r,color: Colors.grey),
|
// border: Border.all(width: 1.r,color: Colors.grey),
|
||||||
/* boxShadow: [
|
/* boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
|
@ -286,7 +286,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'已作答未批阅',
|
'已作答未批阅',
|
||||||
style: TextStyle(fontSize: 8.sp, color: Color(0xFF8B8B8B)),
|
style: TextStyle(fontSize: 8.sp, color: const Color(0xFF8B8B8B)),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 15.r,
|
width: 15.r,
|
||||||
|
|
@ -296,7 +296,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
height: 10.r,
|
height: 10.r,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(5.r)),
|
borderRadius: BorderRadius.all(Radius.circular(5.r)),
|
||||||
border: Border.all(width: 1.r, color: Color(0xFFDDDDDD)),
|
border: Border.all(width: 1.r, color: const Color(0xFFDDDDDD)),
|
||||||
// color: Color(0xFFDDDDDD),
|
// color: Color(0xFFDDDDDD),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -305,7 +305,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'未做',
|
'未做',
|
||||||
style: TextStyle(fontSize: 8.sp, color: Color(0xFF8B8B8B)),
|
style: TextStyle(fontSize: 8.sp, color: const Color(0xFF8B8B8B)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
@ -394,7 +394,7 @@ class _StudentWorkDetailPageState extends State<StudentWorkDetailPage> {
|
||||||
item.name,
|
item.name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 12.sp,
|
fontSize: 12.sp,
|
||||||
color: Color(0xFF464646)),
|
color: const Color(0xFF464646)),
|
||||||
)),
|
)),
|
||||||
// SizedBox(width: 5.r,),
|
// SizedBox(width: 5.r,),
|
||||||
// Text('2024.1',style: TextStyle(fontSize: 12.sp,color: Color(0xFF5B5B5B)),),
|
// Text('2024.1',style: TextStyle(fontSize: 12.sp,color: Color(0xFF5B5B5B)),),
|
||||||
|
|
|
||||||
|
|
@ -40,19 +40,21 @@ class _JobConditionFilterState extends State<JobConditionFilter> {
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime getMonthStartDate() {
|
DateTime getMonthStartDate() {
|
||||||
|
// DateTime now = DateTime.now();
|
||||||
|
// return DateTime(now.year, now.month, 1); // 获取当前月份的第一天
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
return DateTime(now.year, now.month, 1); // 获取当前月份的第一天
|
return now.subtract(const Duration(days: 29));
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTime getMonthEndDate() {
|
DateTime getMonthEndDate() {
|
||||||
DateTime now = DateTime.now();
|
DateTime now = DateTime.now();
|
||||||
int nextMonth = now.month + 1;
|
// int nextMonth = now.month + 1;
|
||||||
if (nextMonth > 12) {
|
// if (nextMonth > 12) {
|
||||||
nextMonth = 1;
|
// nextMonth = 1;
|
||||||
now = now.add(Duration(days: 31 - now.day)); // 跨年了,所以加到当前月的最后一天
|
// now = now.add(Duration(days: 31 - now.day)); // 跨年了,所以加到当前月的最后一天
|
||||||
} else {
|
// } else {
|
||||||
now = now.add(Duration(days: DateTime(now.year, nextMonth, 0).day - now.day)); // 加到下个月的第一天的前一天,即本月最后一天
|
// now = now.add(Duration(days: DateTime(now.year, nextMonth, 0).day - now.day)); // 加到下个月的第一天的前一天,即本月最后一天
|
||||||
}
|
// }
|
||||||
return now;
|
return now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import 'package:making_school_asignment_app/page/home_page/children/class_studen
|
||||||
import 'package:making_school_asignment_app/page/home_page/children/fav_student/fav_student_binding.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/fav_student/fav_student_binding.dart';
|
||||||
import 'package:making_school_asignment_app/page/home_page/children/fav_student/fav_student_view.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/fav_student/fav_student_view.dart';
|
||||||
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
|
||||||
|
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/zoom_logic.dart';
|
||||||
import 'package:making_school_asignment_app/page/home_page/children/homework_review/index.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/homework_review/index.dart';
|
||||||
import 'package:making_school_asignment_app/page/home_page/children/job_report/job_report_binding.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/job_report/job_report_binding.dart';
|
||||||
import 'package:making_school_asignment_app/page/home_page/children/job_report/job_report_view.dart';
|
import 'package:making_school_asignment_app/page/home_page/children/job_report/job_report_view.dart';
|
||||||
|
|
@ -44,63 +45,30 @@ part 'app_routes.dart';
|
||||||
|
|
||||||
abstract class AppPages {
|
abstract class AppPages {
|
||||||
static final pages = [
|
static final pages = [
|
||||||
GetPage(name: Routes.login, page: () => const LoginPage(), binding: LoginBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.login, page: () => const LoginPage(), binding: LoginBinding(), transition: getTransition()),
|
||||||
GetPage(name: Routes.register, page: () => const Register(), transition: getTransition()),
|
GetPage(name: Routes.register, page: () => const Register(), transition: getTransition()),
|
||||||
GetPage(name: Routes.agreementPage, page: () => const AgreementPage(), binding: LoginBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.agreementPage, page: () => const AgreementPage(), binding: LoginBinding(), transition: getTransition()),
|
||||||
GetPage(name: Routes.home, page: () => const HomePage(), binding: HomeBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.home, page: () => const HomePage(), binding: HomeBinding(), transition: getTransition()),
|
||||||
GetPage(name: Routes.startPage, page: () => const StartPage(), binding: StartPageIndexBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.startPage, page: () => const StartPage(), binding: StartPageIndexBinding(), transition: getTransition()),
|
||||||
GetPage(name: Routes.myInfo, page: () => const MyInfo(), transition: Transition.noTransition),
|
GetPage(name: Routes.myInfo, page: () => const MyInfo(), transition: getTransition()),
|
||||||
GetPage(name: Routes.work, page: () => const WorkPage(), binding: WorkBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.work, page: () => const WorkPage(), binding: WorkBinding(), transition: getTransition()),
|
||||||
GetPage(name: Routes.otherPage, page: () => const OhterPage(), transition: Transition.noTransition),
|
GetPage(name: Routes.otherPage, page: () => const OhterPage(), transition: getTransition()),
|
||||||
GetPage(name: Routes.readOverPage, page: () => const ReadOverPage(), binding: ReadOverBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.readOverPage, page: () => const ReadOverPage(), binding: ReadOverBinding(), transition: getTransition()),
|
||||||
GetPage(
|
GetPage(name: Routes.studentHistoryWorkPage, page: () => const StudentHistoryWorkPage(), binding: StudentHistoryWorkBinding(), transition: getTransition()),
|
||||||
name: Routes.studentHistoryWorkPage,
|
GetPage(name: Routes.classStudentPage, page: () => const ClassStudentPage(), binding: ClassStudentBinding(), transition: getTransition()),
|
||||||
page: () => const StudentHistoryWorkPage(),
|
GetPage(name: Routes.annotateClassPage, page: () => const AnnotateClassPage(), binding: AnnotateClassBinding(), transition: getTransition()),
|
||||||
binding: StudentHistoryWorkBinding(),
|
GetPage(name: Routes.quickDataCheckPage, page: () => const QuickDataCheckPage(), binding: QuickDataCheckBinding(), transition: getTransition()),
|
||||||
transition: Transition.noTransition),
|
GetPage(name: Routes.jobReportPage, page: () => const JobReportPage(), binding: JobReportBinding(), transition: getTransition()),
|
||||||
GetPage(name: Routes.classStudentPage, page: () => const ClassStudentPage(), binding: ClassStudentBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.studentPersonalPage, page: () => const StudentPersonalPage(), binding: StudentPersonalBinding(), transition: getTransition()),
|
||||||
GetPage(
|
GetPage(name: Routes.studentWorkDetailPage, page: () => const StudentWorkDetailPage(), binding: StudentWorkDetailBinding(), transition: getTransition()),
|
||||||
name: Routes.annotateClassPage, page: () => const AnnotateClassPage(), binding: AnnotateClassBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.knowledgePointsGraspPage, page: () => const KnowledgePointsGraspPage(), binding: KnowledgePointsGraspBinding(), transition: getTransition()),
|
||||||
GetPage(
|
GetPage(name: Routes.knowledgePointsGraspDetailPage, page: () => const KnowledgePointsGraspDetailPage(), binding: KnowledgePointsGraspDetailBinding(), transition: getTransition()),
|
||||||
name: Routes.quickDataCheckPage,
|
GetPage(name: Routes.answerTrajectoryPage, page: () => const AnswerTrajectoryPage(), binding: AnswerTrajectoryBinding(), transition: getTransition()),
|
||||||
page: () => const QuickDataCheckPage(),
|
GetPage(name: Routes.answerTrajectoryDetailPage, page: () => const AnswerTrajectoryDetailPage(), binding: AnswerTrajectoryDetailBinding(), transition: getTransition()),
|
||||||
binding: QuickDataCheckBinding(),
|
|
||||||
transition: Transition.noTransition),
|
|
||||||
GetPage(name: Routes.jobReportPage, page: () => const JobReportPage(), binding: JobReportBinding(), transition: Transition.noTransition),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.studentPersonalPage,
|
|
||||||
page: () => const StudentPersonalPage(),
|
|
||||||
binding: StudentPersonalBinding(),
|
|
||||||
transition: Transition.noTransition),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.studentWorkDetailPage,
|
|
||||||
page: () => const StudentWorkDetailPage(),
|
|
||||||
binding: StudentWorkDetailBinding(),
|
|
||||||
transition: Transition.noTransition),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.knowledgePointsGraspPage,
|
|
||||||
page: () => const KnowledgePointsGraspPage(),
|
|
||||||
binding: KnowledgePointsGraspBinding(),
|
|
||||||
transition: Transition.noTransition),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.knowledgePointsGraspDetailPage,
|
|
||||||
page: () => const KnowledgePointsGraspDetailPage(),
|
|
||||||
binding: KnowledgePointsGraspDetailBinding(),
|
|
||||||
transition: Transition.noTransition),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.answerTrajectoryPage,
|
|
||||||
page: () => const AnswerTrajectoryPage(),
|
|
||||||
binding: AnswerTrajectoryBinding(),
|
|
||||||
transition: Transition.noTransition),
|
|
||||||
GetPage(
|
|
||||||
name: Routes.answerTrajectoryDetailPage,
|
|
||||||
page: () => const AnswerTrajectoryDetailPage(),
|
|
||||||
binding: AnswerTrajectoryDetailBinding(),
|
|
||||||
transition: Transition.noTransition),
|
|
||||||
// 批阅主页(作业、考试)
|
// 批阅主页(作业、考试)
|
||||||
GetPage(name: Routes.reviewHomework, page: () => const HomeworkReview(), binding: HomeworkReviewBinding(), transition: getTransition()),
|
GetPage(name: Routes.reviewHomework, page: () => const HomeworkReview(), bindings: [HomeworkReviewBinding(), HomeworkReviewZoomBinding()], transition: getTransition()),
|
||||||
GetPage(name: Routes.reviewExam, page: () => const HomeworkReview(), binding: HomeworkReviewBinding(), transition: getTransition()),
|
// GetPage(name: Routes.reviewExam, page: () => const HomeworkReview(), bindings: [HomeworkReviewBinding(), HomeworkReviewZoomBinding()], transition: getTransition()),
|
||||||
GetPage(name: Routes.favStudentPage, page: () => const FavStudentPage(), binding: FavStudentBinding(), transition: Transition.noTransition),
|
GetPage(name: Routes.favStudentPage, page: () => const FavStudentPage(), binding: FavStudentBinding(), transition: getTransition()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ dependencies:
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.6
|
cupertino_icons: ^1.0.6
|
||||||
# 路由、依赖、状态插件
|
# 路由、依赖、状态插件
|
||||||
get: ^4.6.5
|
get: ^4.7.2
|
||||||
# loading插件
|
# loading插件
|
||||||
flutter_easyloading: ^3.0.5
|
flutter_easyloading: ^3.0.5
|
||||||
# 日志插件
|
# 日志插件
|
||||||
|
|
@ -65,6 +65,7 @@ dependencies:
|
||||||
flutter_widget_from_html_core: ^0.14.12
|
flutter_widget_from_html_core: ^0.14.12
|
||||||
# APP内存及本地存储插件
|
# APP内存及本地存储插件
|
||||||
get_storage: ^2.0.3
|
get_storage: ^2.0.3
|
||||||
|
zoom_widget: ^2.0.1
|
||||||
|
|
||||||
# start retrofit请求封装
|
# start retrofit请求封装
|
||||||
retrofit: ^4.1.0
|
retrofit: ^4.1.0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue