优化部分功能

This commit is contained in:
1147192855@qq.com 2024-11-05 15:49:00 +08:00
parent 33d5481773
commit 1ec5c5eb62
5 changed files with 325 additions and 398 deletions

View File

@ -20,8 +20,8 @@ class RequestConfig {
static const connectTimeout = 8000; // static const connectTimeout = 8000; //
static const receiveTimeout = 8000; // static const receiveTimeout = 8000; //
static const bool requestDataPrinting = true; // static const bool requestDataPrinting = false; //
static const bool printSwitch = true; // static const bool printSwitch = false; //
static const successCode = [204, 200]; // code static const successCode = [204, 200]; // code
static final BasePage basePage = BasePage(1, 10); // static final BasePage basePage = BasePage(1, 10); //

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:functional_widget_annotation/functional_widget_annotation.dart'; import 'package:functional_widget_annotation/functional_widget_annotation.dart';
import 'package:gesture_zoom_box/gesture_zoom_box.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_bus.dart'; import 'package:making_school_asignment_app/common/job/marking_models/do_paper_bus.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart'; import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart';
@ -41,15 +42,14 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
// //
Expanded( Expanded(
flex: 7, flex: 7,
child: LayoutBuilder( child: LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
builder: (BuildContext context, BoxConstraints constraints) {
var maxWidth = constraints.maxWidth; var maxWidth = constraints.maxWidth;
var maxHeight = constraints.maxHeight; var maxHeight = constraints.maxHeight;
return Stack( return Stack(
children: [ children: [
// //
QuestionImageView( QuestionImageView(maxWidth, maxHeight, sateData, annotationState, logic),
maxWidth, maxHeight, sateData, annotationState, logic),
// //
// Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)), // Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
// //
@ -63,19 +63,15 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
heroTag: '点击前往上一题', heroTag: '点击前往上一题',
tooltip: '点击前往上一题', tooltip: '点击前往上一题',
focusColor: Theme.of(context).primaryColor, focusColor: Theme.of(context).primaryColor,
backgroundColor: backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
const Color.fromRGBO(24, 32, 32, 0.05),
elevation: 10.r, elevation: 10.r,
onPressed: () => onPressed: () => easyThrottle('TestQuestionSwitch', () {
easyThrottle('TestQuestionSwitch', () {
var param = sateData.param.value; var param = sateData.param.value;
param.studentId = lastPageVal.studentId; param.studentId = lastPageVal.studentId;
param.templateId = lastPageVal.templateId; param.templateId = lastPageVal.templateId;
sateData.param.value = sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
DoPaperDetailsParam.fromJson(param.toJson());
}), }),
child: Icon(Icons.arrow_back_ios, child: Icon(Icons.arrow_back_ios, color: Colors.white, size: 22.sp),
color: Colors.white, size: 22.sp),
); );
}), }),
), ),
@ -90,18 +86,14 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
heroTag: '点击前往下一题', heroTag: '点击前往下一题',
tooltip: '点击前往下一题', tooltip: '点击前往下一题',
elevation: 10.r, elevation: 10.r,
backgroundColor: backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
const Color.fromRGBO(24, 32, 32, 0.05), onPressed: () => easyThrottle('TestQuestionSwitch', () {
onPressed: () =>
easyThrottle('TestQuestionSwitch', () {
var param = sateData.param.value; var param = sateData.param.value;
param.studentId = nextPageVal.studentId; param.studentId = nextPageVal.studentId;
param.templateId = nextPageVal.templateId; param.templateId = nextPageVal.templateId;
sateData.param.value = sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
DoPaperDetailsParam.fromJson(param.toJson());
}), }),
child: Icon(Icons.arrow_forward_ios, child: Icon(Icons.arrow_forward_ios, color: Colors.white, size: 22.sp),
color: Colors.white, size: 22.sp),
); );
}), }),
), ),
@ -122,8 +114,7 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
child: CupertinoButton( child: CupertinoButton(
color: Colors.grey[300], color: Colors.grey[300],
onPressed: () => easyThrottle('home_work_reload_data', () { onPressed: () => easyThrottle('home_work_reload_data', () {
sateData.param.value = sateData.param.value = DoPaperDetailsParam.fromJson(sateData.param.value.toJson());
DoPaperDetailsParam.fromJson(sateData.param.value.toJson());
}), }),
child: quickText('重新请求', color: Colors.black38), child: quickText('重新请求', color: Colors.black38),
), ),
@ -136,8 +127,7 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
// //
@swidget @swidget
Widget $totalSubmitCountView( Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData) {
BuildContext context, HomeworkReviewState sateData) {
return Obx(() { return Obx(() {
var data = sateData.data.value; var data = sateData.data.value;
if (data == null) return Container(); if (data == null) return Container();
@ -152,10 +142,7 @@ Widget $totalSubmitCountView(
context: context, context: context,
elevation: 10, elevation: 10,
backgroundColor: Colors.white, backgroundColor: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r), topRight: Radius.circular(10.r))),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.r),
topRight: Radius.circular(10.r))),
builder: (BuildContext context) { builder: (BuildContext context) {
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 2.w), padding: EdgeInsets.symmetric(horizontal: 2.w),
@ -173,8 +160,7 @@ Widget $totalSubmitCountView(
SizedBox(height: 10.h), SizedBox(height: 10.h),
Expanded( Expanded(
child: ListView( child: ListView(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 4.w),
vertical: 8.h, horizontal: 4.w),
children: [ children: [
Wrap( Wrap(
spacing: 7.2.w, // () spacing: 7.2.w, // ()
@ -185,39 +171,27 @@ Widget $totalSubmitCountView(
alignment: const FractionalOffset(0.05, 0.09), alignment: const FractionalOffset(0.05, 0.09),
children: [ children: [
Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(top: 1.2.h, bottom: 1.5.h, left: 13.w, right: 5.w),
top: 1.2.h,
bottom: 1.5.h,
left: 13.w,
right: 5.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r), borderRadius: BorderRadius.circular(4.r),
color: const Color.fromRGBO( color: const Color.fromRGBO(239, 242, 255, 1),
239, 242, 255, 1),
), ),
child: quickText( child: quickText(
e.name, e.name,
size: 12.sp, size: 12.sp,
wordSpacing: 2, wordSpacing: 2,
color: color: const Color.fromRGBO(80, 94, 110, 1),
const Color.fromRGBO(80, 94, 110, 1),
), ),
), ),
Stack( Stack(
alignment: alignment: const FractionalOffset(0.52, 0.24),
const FractionalOffset(0.52, 0.24),
children: [ children: [
Icon( Icon(
const IconData(0xe63d, const IconData(0xe63d, fontFamily: "AlibabaIcon"),
fontFamily: "AlibabaIcon"),
size: 12.sp, size: 12.sp,
color: e.isPriority color: e.isPriority ? Theme.of(context).primaryColor : const Color.fromRGBO(164, 164, 164, 1),
? Theme.of(context).primaryColor
: const Color.fromRGBO(
164, 164, 164, 1),
), ),
quickText('优先', quickText('优先', size: 4.sp, color: Colors.white),
size: 4.sp, color: Colors.white),
], ],
), ),
], ],
@ -239,17 +213,11 @@ Widget $totalSubmitCountView(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.only(bottom: 1.h), padding: EdgeInsets.only(bottom: 1.h),
child: quickText('已阅', child: quickText('已阅', color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
), ),
quickText(data.annotatedCount, quickText(data.annotatedCount, color: Theme.of(context).primaryColor, size: 12.sp, fontWeight: FontWeight.bold),
color: Theme.of(context).primaryColor, quickText('/', color: const Color.fromRGBO(117, 117, 117, 1), size: 12.sp),
size: 12.sp, quickText(data.submitCount - data.annotatedCount, color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
fontWeight: FontWeight.bold),
quickText('/',
color: const Color.fromRGBO(117, 117, 117, 1), size: 12.sp),
quickText(data.submitCount - data.annotatedCount,
color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
], ],
), ),
), ),
@ -259,18 +227,15 @@ Widget $totalSubmitCountView(
// //
@hwidget @hwidget
Widget $questionNumberView(BuildContext context, HomeworkReviewLogic logic, Widget $questionNumberView(BuildContext context, HomeworkReviewLogic logic, HomeworkReviewState sateData) {
HomeworkReviewState sateData) {
final scrollControllerNum = useScrollController(); // final scrollControllerNum = useScrollController(); //
useEffect(() { useEffect(() {
scrollControllerNum.addListener(() { scrollControllerNum.addListener(() {
if (sateData.panQuestView == false) if (sateData.panQuestView == false) sateData.slide.value = scrollControllerNum.offset;
sateData.slide.value = scrollControllerNum.offset;
}); });
var listenVal = sateData.slide.listen((e) { var listenVal = sateData.slide.listen((e) {
if (e != scrollControllerNum.offset && sateData.panQuestView == true) if (e != scrollControllerNum.offset && sateData.panQuestView == true) scrollControllerNum.jumpTo(e);
scrollControllerNum.jumpTo(e);
}); });
return () { return () {
@ -307,20 +272,13 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewLogic logic,
return Container( return Container(
height: boxHeight > actualImgHeight ? boxHeight : actualImgHeight, height: boxHeight > actualImgHeight ? boxHeight : actualImgHeight,
padding: EdgeInsets.only( padding: EdgeInsets.only(top: imageVal.remainingHeight > 0 ? imageVal.remainingHeight / 2 : 0),
top: imageVal.remainingHeight > 0
? imageVal.remainingHeight / 2
: 0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: studentQuestions children: studentQuestions
?.asMap() ?.asMap()
.keys .keys
.map((e) => $ScoringQuestionsView( .map((e) => $ScoringQuestionsView(logic, studentQuestions[e], imageVal.scaleRatio, studentQuestions))
logic,
studentQuestions[e],
imageVal.scaleRatio,
studentQuestions))
.toList() ?? .toList() ??
[], [],
), ),
@ -333,11 +291,7 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewLogic logic,
// //
@hwidget @hwidget
Widget $scoringQuestionsView( Widget $scoringQuestionsView(
BuildContext context, BuildContext context, HomeworkReviewLogic logic, StudentQuestions item, double scaleRatio, List<StudentQuestions>? studentQuestions) {
HomeworkReviewLogic logic,
StudentQuestions item,
double scaleRatio,
List<StudentQuestions>? studentQuestions) {
var studentScore = useState<int?>(item.studentScore); var studentScore = useState<int?>(item.studentScore);
useValueChanged<int?, void>(studentScore.value, (_, __) { useValueChanged<int?, void>(studentScore.value, (_, __) {
@ -346,8 +300,7 @@ Widget $scoringQuestionsView(
// //
var annotateTime = logic.state.data.value?.annotateTime; var annotateTime = logic.state.data.value?.annotateTime;
if (annotateTime == null) { if (annotateTime == null) {
var noRatingGiven = var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
if (noRatingGiven == null) logic.submit(context); if (noRatingGiven == null) logic.submit(context);
} }
}); });
@ -359,13 +312,13 @@ Widget $scoringQuestionsView(
useEffect(() { useEffect(() {
return () {}; return () {};
}, []); }, []);
var padinVal = item.correctRate > 0 var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h);
? EdgeInsets.only(top: 6.4.h)
: EdgeInsets.symmetric(vertical: 2.h);
return Container( return Container(
height: item.height! * scaleRatio, height: item.height! * scaleRatio,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
child: item.useTime == 0?Container():Stack( child: item.useTime == 0
? Container()
: Stack(
alignment: const FractionalOffset(0, 0), alignment: const FractionalOffset(0, 0),
children: [ children: [
Row( Row(
@ -377,18 +330,14 @@ Widget $scoringQuestionsView(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap, tapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: backgroundColor: const Color.fromRGBO(237, 237, 237, 1), //
const Color.fromRGBO(237, 237, 237, 1), // shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), //
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero), //
), ),
child: Padding( child: Padding(
padding: padinVal, padding: padinVal,
child: Icon( child: Icon(
size: 22.sp, size: 22.sp,
color: studentScore.value == 2 color: studentScore.value == 2 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
? const Color(0xFF54971F)
: const Color.fromRGBO(114, 114, 114, 1),
const IconData(0xe62b, fontFamily: "AlibabaIcon"), const IconData(0xe62b, fontFamily: "AlibabaIcon"),
), ),
), ),
@ -403,18 +352,14 @@ Widget $scoringQuestionsView(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap, tapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: backgroundColor: const Color.fromRGBO(237, 237, 237, 1), //
const Color.fromRGBO(237, 237, 237, 1), // shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), //
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero), //
), ),
child: Padding( child: Padding(
padding: padinVal, padding: padinVal,
child: Icon( child: Icon(
size: 22.sp, size: 22.sp,
color: studentScore.value == 1 color: studentScore.value == 1 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
? const Color(0xFF54971F)
: const Color.fromRGBO(114, 114, 114, 1),
const IconData(0xe62c, fontFamily: "AlibabaIcon"), const IconData(0xe62c, fontFamily: "AlibabaIcon"),
), ),
), ),
@ -429,18 +374,14 @@ Widget $scoringQuestionsView(
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap, tapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: backgroundColor: const Color.fromRGBO(237, 237, 237, 1), //
const Color.fromRGBO(237, 237, 237, 1), // shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), //
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.zero), //
), ),
child: Padding( child: Padding(
padding: padinVal, padding: padinVal,
child: Icon( child: Icon(
size: 22.sp, size: 22.sp,
color: studentScore.value == 0 color: studentScore.value == 0 ? Colors.green : const Color.fromRGBO(114, 114, 114, 1),
? const Color(0xFF54971F)
: const Color.fromRGBO(114, 114, 114, 1),
const IconData(0xe62a, fontFamily: "AlibabaIcon"), const IconData(0xe62a, fontFamily: "AlibabaIcon"),
), ),
), ),
@ -457,11 +398,8 @@ Widget $scoringQuestionsView(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
SizedBox(width: 1.1.w), SizedBox(width: 1.1.w),
quickText('${item.questionNo}', quickText('${item.questionNo}', color: Theme.of(context).primaryColor.withOpacity(0.7), size: 8.sp),
color: Theme.of(context).primaryColor.withOpacity(0.7), if (item.correctRate > 0) quickText(' 正确率', color: Colors.grey, size: 5.sp),
size: 8.sp),
if (item.correctRate > 0)
quickText(' 正确率', color: Colors.grey, size: 5.sp),
if (item.correctRate > 0) if (item.correctRate > 0)
Expanded( Expanded(
child: LinearPercentIndicator( child: LinearPercentIndicator(
@ -471,10 +409,7 @@ Widget $scoringQuestionsView(
alignment: MainAxisAlignment.center, alignment: MainAxisAlignment.center,
progressColor: Theme.of(context).primaryColor, progressColor: Theme.of(context).primaryColor,
backgroundColor: const Color(0xFFB8C7CB).withOpacity(0.35), backgroundColor: const Color(0xFFB8C7CB).withOpacity(0.35),
center: quickText("${item.correctRate}%", center: quickText("${item.correctRate}%", size: 5.sp, align: TextAlign.center, color: Colors.white),
size: 5.sp,
align: TextAlign.center,
color: Colors.white),
), ),
) )
], ],
@ -486,16 +421,13 @@ Widget $scoringQuestionsView(
} }
// //
class QuestionImageView extends HookWidget class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar> {
with EventBusMixin<BottomOperationBar> {
final double maxWidth; final double maxWidth;
final double maxHeight; final double maxHeight;
final HomeworkReviewLogic logic; final HomeworkReviewLogic logic;
final HomeworkReviewState sateData; final HomeworkReviewState sateData;
final HomeworkReviewAnnotationsControlState annotationState; final HomeworkReviewAnnotationsControlState annotationState;
QuestionImageView(this.maxWidth, this.maxHeight, this.sateData, QuestionImageView(this.maxWidth, this.maxHeight, this.sateData, this.annotationState, this.logic, {super.key});
this.annotationState, this.logic,
{super.key});
/// ///
int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) { int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) {
@ -511,10 +443,14 @@ class QuestionImageView extends HookWidget
int activePointers = 0; int activePointers = 0;
ImageStream? imageStream;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theMaxHeight = useState<double>(maxHeight);
final scrollControllerQuestion = useScrollController(); // final scrollControllerQuestion = useScrollController(); //
var vnHandWritings = useValueNotifier<List<dynamic>>([]); var vnHandWritings = useValueNotifier<List<dynamic>>([]);
var customPaintSize = useState<Size>(Size.zero);
useEffect(() { useEffect(() {
var listenStream = sateData.data.listen((e) { var listenStream = sateData.data.listen((e) {
@ -522,17 +458,24 @@ class QuestionImageView extends HookWidget
sateData.handwritings = []; sateData.handwritings = [];
vnHandWritings.value = sateData.handwritings; vnHandWritings.value = sateData.handwritings;
}); });
return () => listenStream.cancel(); var listenStreamImageScale = sateData.imageScale.listen((e) {
customPaintSize.value = Size(
sateData.imageScale.value?.actualImgWidth ?? 0,
sateData.imageScale.value?.actualImgHeight ?? 0,
);
});
return () {
listenStream.cancel();
listenStreamImageScale.cancel();
};
}, []); }, []);
ImageStream? imageStream; var imageStreamListener = useState<ImageStreamListener>(ImageStreamListener((ImageInfo info, bool _) {
var imageStreamListener = useState<ImageStreamListener>(
ImageStreamListener((ImageInfo info, bool _) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
sateData.imageScale.value = TestQuestionsImageInfo( sateData.imageScale.value = TestQuestionsImageInfo(
templateId: sateData.data.value?.templateId, templateId: sateData.data.value?.templateId,
boxWidth: maxWidth, boxWidth: maxWidth,
boxHeight: maxHeight, boxHeight: theMaxHeight.value,
imageWidth: info.image.width.toDouble(), imageWidth: info.image.width.toDouble(),
imageHeight: info.image.height.toDouble(), imageHeight: info.image.height.toDouble(),
url: sateData.data.value!.zgtAnswer, url: sateData.data.value!.zgtAnswer,
@ -550,16 +493,9 @@ class QuestionImageView extends HookWidget
bool? res = await showDialog<bool>( bool? res = await showDialog<bool>(
context: context, context: context,
builder: (context1) { builder: (context1) {
return AlertDialog( return AlertDialog(content: quickText("是否撤销全部批注痕迹?"), actions: <Widget>[
content: quickText("是否撤销全部批注痕迹?"), TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)),
actions: <Widget>[ TextButton(child: quickText("确定", color: Theme.of(context).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))
]); ]);
}, },
); );
@ -570,15 +506,10 @@ class QuestionImageView extends HookWidget
await showDialog<bool>( await showDialog<bool>(
context: context, context: context,
builder: (context1) { builder: (context1) {
return AlertDialog( return AlertDialog(content: quickText("是否撤销上次批阅批注痕迹?"), actions: <Widget>[
content: quickText("是否撤销上次批阅批注痕迹?"), TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)),
actions: <Widget>[
TextButton( TextButton(
child: quickText("取消"), child: quickText("确定", color: Theme.of(context).primaryColor),
onPressed: () => Navigator.pop(context1, false)),
TextButton(
child: quickText("确定",
color: Theme.of(context).primaryColor),
onPressed: () { onPressed: () {
Navigator.pop(context1, true); Navigator.pop(context1, true);
sateData.data.value?.zgtAnnotate = null; sateData.data.value?.zgtAnnotate = null;
@ -600,15 +531,10 @@ class QuestionImageView extends HookWidget
await showDialog<bool>( await showDialog<bool>(
context: context, context: context,
builder: (context1) { builder: (context1) {
return AlertDialog( return AlertDialog(content: quickText("是否撤销上次批阅批注痕迹?"), actions: <Widget>[
content: quickText("是否撤销上次批阅批注痕迹?"), TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)),
actions: <Widget>[
TextButton( TextButton(
child: quickText("取消"), child: quickText("确定", color: Theme.of(context).primaryColor),
onPressed: () => Navigator.pop(context1, false)),
TextButton(
child: quickText("确定",
color: Theme.of(context).primaryColor),
onPressed: () { onPressed: () {
Navigator.pop(context1, true); Navigator.pop(context1, true);
sateData.data.value?.zgtAnnotate = null; sateData.data.value?.zgtAnnotate = null;
@ -636,8 +562,7 @@ class QuestionImageView extends HookWidget
}); // }); //
var listenVal = sateData.slide.listen((e) { var listenVal = sateData.slide.listen((e) {
if (e != scrollControllerQuestion.offset && if (e != scrollControllerQuestion.offset && sateData.panQuestView == false) scrollControllerQuestion.jumpTo(e);
sateData.panQuestView == false) scrollControllerQuestion.jumpTo(e);
}); });
// //
@ -648,6 +573,10 @@ class QuestionImageView extends HookWidget
}; };
}, []); }, []);
useValueChanged<double, void>(maxHeight, (oldValue, __) {
theMaxHeight.value = maxHeight;
});
return Container( return Container(
height: maxHeight, height: maxHeight,
// padding: EdgeInsets.only(bottom: 2.h, top: 2.h), // padding: EdgeInsets.only(bottom: 2.h, top: 2.h),
@ -655,25 +584,19 @@ class QuestionImageView extends HookWidget
child: Obx(() { child: Obx(() {
var imageUrl = sateData.data.value?.zgtAnswer; var imageUrl = sateData.data.value?.zgtAnswer;
var showZgtAnnotate = sateData.data.value?.showZgtAnnotate; var showZgtAnnotate = sateData.data.value?.showZgtAnnotate;
if (imageUrl == null) return const SizedBox(); if (imageUrl == null) return const SizedBox();
return GestureDetector( return GestureDetector(
onPanDown: (_) => sateData.panQuestView = true, onPanDown: (_) => sateData.panQuestView = true,
child: SingleChildScrollView( child: SingleChildScrollView(
controller: scrollControllerQuestion, controller: scrollControllerQuestion,
physics: !annotationState.pen.value physics: !annotationState.pen.value ? const BouncingScrollPhysics() : const NeverScrollableScrollPhysics(),
? const BouncingScrollPhysics()
: const NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
scrollDirection: Axis.vertical, // scrollDirection: Axis.vertical, //
child: Container( child: Container(
decoration: BoxDecoration(boxShadow: [ decoration: BoxDecoration(
BoxShadow( boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.2), offset: Offset(-6.r, 1.r), blurRadius: 10.r, spreadRadius: 8.r)]),
color: Colors.grey.withOpacity(0.2),
offset: Offset(-6.r, 1.r),
blurRadius: 10.r,
spreadRadius: 8.r)
]),
child: Listener( child: Listener(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onPointerDown: (PointerDownEvent event) { onPointerDown: (PointerDownEvent event) {
@ -700,11 +623,9 @@ class QuestionImageView extends HookWidget
if (imageScale == null || !annotationState.pen.value) return; if (imageScale == null || !annotationState.pen.value) return;
Offset localPosition = event.localPosition; Offset localPosition = event.localPosition;
var dy = localPosition.dy; var dy = localPosition.dy;
if (dy > imageScale.actualImgHeight || dy < 0) if (dy > imageScale.actualImgHeight || dy < 0) return; //
return; //
vnHandWritings.value = List.from(vnHandWritings.value) vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition);
..add(localPosition);
sateData.handwritings = vnHandWritings.value; sateData.handwritings = vnHandWritings.value;
}, },
child: Stack( child: Stack(
@ -712,28 +633,23 @@ class QuestionImageView extends HookWidget
$TheCachedNetworkImage( $TheCachedNetworkImage(
imageUrl: imageUrl, imageUrl: imageUrl,
(context, imageProvider) { (context, imageProvider) {
Image imageWidget = Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
Image(image: imageProvider, fit: BoxFit.fitWidth);
imageStream?.removeListener(imageStreamListener.value); imageStream?.removeListener(imageStreamListener.value);
imageStream = imageWidget.image imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener.value);
.resolve(const ImageConfiguration()) // return imageWidget;
..addListener(imageStreamListener.value);
return imageWidget; return imageWidget;
}, },
), ),
RepaintBoundary( RepaintBoundary(
key: logic.pictureOverviewKey, key: logic.pictureOverviewKey,
child: CustomPaint( child: CustomPaint(
isComplex: true,
size: customPaintSize.value,
foregroundPainter: DrawingPainter(ctrl: vnHandWritings), foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
size: Size(
sateData.imageScale.value?.actualImgWidth ?? 0,
sateData.imageScale.value?.actualImgHeight ?? 0,
),
child: showZgtAnnotate != null child: showZgtAnnotate != null
? $TheCachedNetworkImage( ? $TheCachedNetworkImage(
imageUrl: showZgtAnnotate, imageUrl: showZgtAnnotate,
(_, imageProvider) => Image( (_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth),
image: imageProvider, fit: BoxFit.fitWidth),
) )
: null, : null,
), ),
@ -765,8 +681,7 @@ class DrawingPainter extends CustomPainter {
for (int i = 0; i < pointsLength; i++) { for (int i = 0; i < pointsLength; i++) {
Offset? offsetData = points[i]; Offset? offsetData = points[i];
Offset? nextOffsetData = pointsLength - 1 == i ? null : points[i + 1]; Offset? nextOffsetData = pointsLength - 1 == i ? null : points[i + 1];
if (offsetData != null && nextOffsetData != null) if (offsetData != null && nextOffsetData != null) canvas.drawLine(offsetData, nextOffsetData, paintBrush);
canvas.drawLine(offsetData, nextOffsetData, paintBrush);
} }
} }

View File

@ -5,12 +5,12 @@ import 'package:get/get.dart';
import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.dart'; import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.dart';
import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
import 'package:making_school_asignment_app/page/home_page/children/annotate_class/annotate_class_logic.dart'; import 'package:making_school_asignment_app/page/home_page/children/annotate_class/annotate_class_logic.dart';
import 'package:making_school_asignment_app/page/home_page/children/homework_review/components/question_paper_view.dart';
import 'package:making_school_asignment_app/page/home_page/home_logic.dart'; import 'package:making_school_asignment_app/page/home_page/home_logic.dart';
import 'components/bottom_operation_bar.dart'; import 'components/bottom_operation_bar.dart';
import 'components/dropdown_switch_students_type.dart'; import 'components/dropdown_switch_students_type.dart';
import 'components/favorite_widget.dart'; import 'components/favorite_widget.dart';
import 'components/question_paper_view.dart';
import 'configuration_files/index.dart'; import 'configuration_files/index.dart';
class HomeworkReview extends StatefulWidget { class HomeworkReview extends StatefulWidget {
@ -21,6 +21,7 @@ class HomeworkReview extends StatefulWidget {
} }
class _HomeworkReviewState extends State<HomeworkReview> { class _HomeworkReviewState extends State<HomeworkReview> {
final ScrollController controller = ScrollController();
final logic = Get.find<HomeworkReviewLogic>(); final logic = Get.find<HomeworkReviewLogic>();
final sateData = Get.find<HomeworkReviewLogic>().state; final sateData = Get.find<HomeworkReviewLogic>().state;
final AnnotateClassLogic _controller = Get.find<AnnotateClassLogic>(); final AnnotateClassLogic _controller = Get.find<AnnotateClassLogic>();
@ -29,12 +30,14 @@ class _HomeworkReviewState extends State<HomeworkReview> {
@override @override
void initState() { void initState() {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); //
super.initState(); super.initState();
} }
@override @override
void dispose() { void dispose() {
Get.delete<HomeworkReviewLogic>(); Get.delete<HomeworkReviewLogic>();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]); //
super.dispose(); super.dispose();
} }
@ -48,15 +51,6 @@ class _HomeworkReviewState extends State<HomeworkReview> {
_homeLogicController.getList(); _homeLogicController.getList();
} }
}, },
child: AnnotatedRegion(
value: const SystemUiOverlayStyle(
systemNavigationBarColor: Color(0xFF000000),
systemNavigationBarDividerColor: null,
statusBarColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.light,
statusBarIconBrightness: Brightness.light,
statusBarBrightness: Brightness.light,
),
child: SafeArea( child: SafeArea(
child: Scaffold( child: Scaffold(
appBar: AppBar( appBar: AppBar(
@ -74,7 +68,23 @@ class _HomeworkReviewState extends State<HomeworkReview> {
// //
const DropdownSwitchStudentsType(), const DropdownSwitchStudentsType(),
SizedBox(height: 1.h), SizedBox(height: 1.h),
const Expanded(child: QuestionPaperView()), const Expanded(child: QuestionPaperView()
// child: CustomZoomWidget(
// child: Image.network('https://cdn3-banquan.ituchong.com/weili/image/l/903170934517792920.jpeg'),
// ),
// child: CustomZoomWidget(
// child: Image.network('https://cdn3-banquan.ituchong.com/weili/image/l/903170934517792920.jpeg'),
// minScale: 0.8,
// maxScale: 4,
// resetDuration: const Duration(milliseconds: 200),
// boundaryMargin: const EdgeInsets.only(bottom: 0),
// clipBehavior: Clip.hardEdge,
// useOverlay: false,
// maxOverlayOpacity: 0.5,
// overlayColor: Colors.black,
// fingersRequiredToPinch: 2,
// ),
),
const BottomAnnotationSwitch() const BottomAnnotationSwitch()
], ],
), ),
@ -83,7 +93,6 @@ class _HomeworkReviewState extends State<HomeworkReview> {
// floatingActionButtonLocation: FloatingActionButtonLocation.startFloat, // floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
), ),
), ),
),
); );
} }
} }

View File

@ -30,7 +30,8 @@ class _ReadOverPageState extends State<ReadOverPage> {
value: const SystemUiOverlayStyle( value: const SystemUiOverlayStyle(
/* systemNavigationBarColor: Color(0xFF000000), /* systemNavigationBarColor: Color(0xFF000000),
systemNavigationBarDividerColor: null,*/ systemNavigationBarDividerColor: null,*/
statusBarColor: Colors.transparent, statusBarColor: Colors.white,
systemNavigationBarDividerColor: null,
systemNavigationBarIconBrightness: Brightness.light, systemNavigationBarIconBrightness: Brightness.light,
statusBarIconBrightness: Brightness.light, statusBarIconBrightness: Brightness.light,
statusBarBrightness: Brightness.light, statusBarBrightness: Brightness.light,
@ -177,7 +178,12 @@ class _ReadOverPageState extends State<ReadOverPage> {
@override @override
void dispose() { void dispose() {
Get.delete<ReadOverLogic>(); Get.delete<ReadOverLogic>();
super.dispose();
logic.homeController.getList(); logic.homeController.getList();
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
statusBarColor: Colors.transparent, //
statusBarIconBrightness: Brightness.light,
systemStatusBarContrastEnforced: false,
));
super.dispose();
} }
} }

View File

@ -22,7 +22,7 @@ part 'annotate_list.g.dart';
class AnnotateList extends StatefulWidget { class AnnotateList extends StatefulWidget {
final int tabIndex; final int tabIndex;
final int assessType; final int assessType;
const AnnotateList({Key? key,required this.tabIndex,required this.assessType}) : super(key: key); const AnnotateList({super.key, required this.tabIndex, required this.assessType});
@override @override
State<AnnotateList> createState() => _AnnotateListState(); State<AnnotateList> createState() => _AnnotateListState();
@ -35,7 +35,6 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
late RxList<Items> annotateList = RxList(); late RxList<Items> annotateList = RxList();
late int page = 1; late int page = 1;
late TabController tabController2; late TabController tabController2;
/* 待阅卷 */ /* 待阅卷 */
late final EasyRefreshController refreshController1; late final EasyRefreshController refreshController1;
@ -61,7 +60,6 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
EasyLoading.show(status: 'loading...'); EasyLoading.show(status: 'loading...');
getUnAnnotateList(); getUnAnnotateList();
getAnnotateList(); getAnnotateList();
} }
// //
@ -75,6 +73,7 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
EasyLoading.dismiss(); EasyLoading.dismiss();
print('state.unAnnotateList.length=${unAnnotateList.length}'); print('state.unAnnotateList.length=${unAnnotateList.length}');
} }
// //
void getAnnotateList() async { void getAnnotateList() async {
WorkStudent data = WorkStudent([], 0); WorkStudent data = WorkStudent([], 0);
@ -87,6 +86,7 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
EasyLoading.dismiss(); EasyLoading.dismiss();
print('state.annotateList.length=${annotateList.length}'); print('state.annotateList.length=${annotateList.length}');
} }
/// ///
Future<void> onMyRefresh(EasyRefreshController controller, int tab) async { Future<void> onMyRefresh(EasyRefreshController controller, int tab) async {
/* params.page = RequestConfig.basePage.page; /* params.page = RequestConfig.basePage.page;
@ -100,7 +100,6 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
} else { } else {
getAnnotateList(); getAnnotateList();
} }
} }
Future<void> getCollect(item) async { Future<void> getCollect(item) async {
@ -122,7 +121,6 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
}*/ }*/
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
@ -159,15 +157,15 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
if (value.endDate != null) { if (value.endDate != null) {
if (!Utils.isPad() && value.startDate!.year == value.endDate!.year) { if (!Utils.isPad() && value.startDate!.year == value.endDate!.year) {
customTimeStr.value = customTimeStr.value = '${value.startDate.toString().substring(5, 10)}~${value.endDate.toString().substring(5, 10)}';
'${value.startDate.toString().substring(5, 10)}~${value.endDate.toString().substring(5, 10)}';
} else { } else {
customTimeStr.value = '${customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}'; customTimeStr.value = '${customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}';
} }
} }
} }
}), }),
Expanded(child: IndexedStack( Expanded(
child: IndexedStack(
index: widget.tabIndex, index: widget.tabIndex,
children: <Widget>[ children: <Widget>[
$EasyRefresh( $EasyRefresh(
@ -237,13 +235,7 @@ Widget $easyRefresh({
padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w), padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
Items item = data[index]; Items item = data[index];
return TaskListItem( return TaskListItem(completed: completed, jobTaskItem: item, type: type, collectFun: collectFun, tabIndex: tab - 1);
completed: completed,
jobTaskItem: item,
type: type,
collectFun: collectFun,
tabIndex:tab - 1
);
}, },
itemCount: data.length, itemCount: data.length,
), ),
@ -265,8 +257,14 @@ Widget $reviewedItem({
return InkWell( return InkWell(
onTap: () { onTap: () {
Get.toNamed(Routes.annotateClassPage, Get.toNamed(Routes.annotateClassPage, arguments: {
arguments: {'id': jobTaskItem.id, 'name': jobTaskItem.name, 'grade': jobTaskItem.grade,'subject':jobTaskItem.subject, 'completed': true,'tabIndex':tabIndex}); 'id': jobTaskItem.id,
'name': jobTaskItem.name,
'grade': jobTaskItem.grade,
'subject': jobTaskItem.subject,
'completed': true,
'tabIndex': tabIndex
});
}, },
child: Container( child: Container(
padding: EdgeInsets.only(right: 5.w), padding: EdgeInsets.only(right: 5.w),
@ -288,7 +286,6 @@ Widget $reviewedItem({
// //
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: 32.w, width: 32.w,