Compare commits

..

No commits in common. "cec4aec9d58e6a674d51c64599c30fa9bf0aa1ef" and "091f82581eff663b411e9e4b959bd8c5e609374e" have entirely different histories.

2 changed files with 62 additions and 76 deletions

View File

@ -34,33 +34,39 @@ class AnswerHandwriting extends Dialog {
final int? questionNo; final int? questionNo;
final Function closeCall; final Function closeCall;
AnswerHandwriting( AnswerHandwriting(
{super.key, required this.homeworkId, required this.studentId, required this.closeCall, this.templateId, this.pageNum, this.questionNo}); {super.key, required this.homeworkId, required this.studentId, required this.closeCall, this.templateId, this.pageNum, this.questionNo}) {
Get.find<HandwritingLogic>().params.value = OriginalManuscriptHandwritingParams(
homeworkId: homeworkId,
studentId: studentId,
templateId: templateId,
pageNum: pageNum,
questionNo: questionNo,
);
}
final _handwritingLogic = Get.find<HandwritingLogic>(); final _handwritingLogic = Get.find<HandwritingLogic>();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return OrientationBuilder(builder: (BuildContext context, Orientation orientation) { var boxHeight = ScreenUtil().screenHeight / 1.168; //
var boxHeight = ScreenUtil().screenHeight / 1.168; // var boxWidth = ScreenUtil().screenWidth - (ScreenUtil().scaleWidth < 1.5 ? 40.r : 40.r); //
var boxWidth = ScreenUtil().screenWidth - (ScreenUtil().scaleWidth < 1.5 ? 40.r : 40.r); //
return Center( return Center(
child: Container( child: Container(
height: boxHeight, height: boxHeight,
width: boxWidth, width: boxWidth,
alignment: Alignment.center, alignment: Alignment.center,
child: AnswerHandwritingMainBox( child: AnswerHandwritingMainBox(
handwritingLogic: _handwritingLogic, handwritingLogic: _handwritingLogic,
boxHeight: boxHeight, boxHeight: boxHeight,
boxWidth: boxWidth, boxWidth: boxWidth,
homeworkId: homeworkId, homeworkId: homeworkId,
templateId: templateId, templateId: templateId,
studentId: studentId, studentId: studentId,
pageNum: pageNum, pageNum: pageNum,
questionNo: questionNo, questionNo: questionNo,
closeCall: closeCall, closeCall: closeCall,
),
), ),
); ),
}); );
} }
} }
@ -72,29 +78,26 @@ Future<void> showAnswerHandwriting(
int? pageNum, int? pageNum,
int? questionNo, int? questionNo,
}) async { }) async {
backCall() { try {
Navigator.of(context).pop(); backCall() {
} Navigator.of(context).pop();
}
Get.put(HandwritingLogic(backCall)); Get.put(HandwritingLogic(backCall));
Get.find<HandwritingLogic>().params.value = OriginalManuscriptHandwritingParams( await showDialog(
homeworkId: homeworkId, context: context,
studentId: studentId, builder: (BuildContext context) => AnswerHandwriting(
templateId: templateId, homeworkId: homeworkId,
pageNum: pageNum, templateId: templateId,
questionNo: questionNo, studentId: studentId,
); pageNum: pageNum,
await showDialog( questionNo: questionNo,
context: context, closeCall: backCall,
builder: (BuildContext context) => AnswerHandwriting( ),
homeworkId: homeworkId, );
templateId: templateId, } finally {
studentId: studentId, Get.delete<HandwritingLogic>();
pageNum: pageNum, }
questionNo: questionNo,
closeCall: backCall,
),
).then((e) => Get.delete<HandwritingLogic>());
} }
// //
@ -361,12 +364,7 @@ class _HandwritingDrawBoxState extends State<HandwritingDrawBox> with EventBusMi
_packagedHandwritingDataAll = []; _packagedHandwritingDataAll = [];
} }
// _vnPrimaryHandWritings.is _vnPrimaryHandWritings.value = [..._packagedHandwritingDataAll]; //
try {
_vnPrimaryHandWritings.value = [..._packagedHandwritingDataAll]; //
} catch (e) {
_vnPrimaryHandWritings = ValueNotifier<List<GestureHandwritingRecording>>(_packagedHandwritingDataAll);
}
// eventFire(model: JobHandwritingPlaybarBus); // eventFire(model: JobHandwritingPlaybarBus);
}); });
showManuscriptStream = handwritingLogic.toolbar.showManuscript.listen((e) { showManuscriptStream = handwritingLogic.toolbar.showManuscript.listen((e) {
@ -381,13 +379,7 @@ class _HandwritingDrawBoxState extends State<HandwritingDrawBox> with EventBusMi
} }
}); });
executionDataStream = handwritingLogic.toolbar.executionData.listen((e) { executionDataStream = handwritingLogic.toolbar.executionData.listen((e) => _vnHandWritings.value = e);
try {
_vnHandWritings.value = e;
} catch (e1) {
_vnHandWritings = ValueNotifier<List<GestureHandwritingRecording>>(e);
}
});
eventOn(callback: (e) { eventOn(callback: (e) {
switch (e.runtimeType) { switch (e.runtimeType) {
@ -429,8 +421,6 @@ class _HandwritingDrawBoxState extends State<HandwritingDrawBox> with EventBusMi
@override @override
void dispose() { void dispose() {
imageStream?.removeListener(theImageStreamListener); imageStream?.removeListener(theImageStreamListener);
_vnHandWritings.dispose();
_vnPrimaryHandWritings.dispose();
showManuscriptStream.cancel(); showManuscriptStream.cancel();
executionDataStream.cancel(); executionDataStream.cancel();
eventCancel(); eventCancel();
@ -547,8 +537,7 @@ class _HandwritingDrawBoxState extends State<HandwritingDrawBox> with EventBusMi
imageUrl: paperPicture, imageUrl: paperPicture,
(context, imageProvider) { (context, imageProvider) {
Image imageWidget = Image(image: imageProvider, fit: BoxFit.contain); Image imageWidget = Image(image: imageProvider, fit: BoxFit.contain);
var imagInfoModel = handwritingLogic.imagInfoModel.value; if (handwritingLogic.imagInfoModel.value == null) {
if (imagInfoModel == null || imagInfoModel.boxWidth != widget.boxWidth) {
imageStream?.removeListener(theImageStreamListener); imageStream?.removeListener(theImageStreamListener);
imageStream = imageWidget.image.resolve(const ImageConfiguration()); imageStream = imageWidget.image.resolve(const ImageConfiguration());
imageStream?.addListener(theImageStreamListener); imageStream?.addListener(theImageStreamListener);
@ -884,6 +873,7 @@ class StudentManuscriptBtn extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Obx(() { return Obx(() {
print('显示原噶:${handwritingLogic.toolbar.showManuscript.value}');
return InkWell( return InkWell(
onTap: () => easyThrottle('job_handwriting_udent_manuscript', () { onTap: () => easyThrottle('job_handwriting_udent_manuscript', () {
var showManuscript = handwritingLogic.toolbar.showManuscript.value; var showManuscript = handwritingLogic.toolbar.showManuscript.value;

View File

@ -1,7 +1,6 @@
// //
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/config/request_config.dart'; import 'package:making_school_asignment_app/common/config/request_config.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_test_questions_image_info.dart'; import 'package:making_school_asignment_app/common/job/marking_models/do_test_questions_image_info.dart';
@ -34,7 +33,6 @@ class HandwritingLogic extends GetxController with RequestToolMixin {
ever(params, (callback) => getData()); ever(params, (callback) => getData());
ever(imagInfoModel, (callback) { ever(imagInfoModel, (callback) {
// //
toolbar.initialization.value = false;
handwritingInfo.value = getHandwritingDetail(resultData.value); handwritingInfo.value = getHandwritingDetail(resultData.value);
getCalculatedSize(); getCalculatedSize();
}); });
@ -69,25 +67,24 @@ class HandwritingLogic extends GetxController with RequestToolMixin {
double scaleRatio = imagInfoModel.value!.scaleRatio; double scaleRatio = imagInfoModel.value!.scaleRatio;
if (mapData.isNotEmpty) { if (mapData.isNotEmpty) {
List<int> keys = mapData.keys.toList(); List<int> keys = mapData.keys.toList();
print('重新计算:${scaleRatio}');
List<List<GestureHandwritingRecording>> _packagedHandwritingDatas = []; List<List<GestureHandwritingRecording>> _packagedHandwritingDatas = [];
List<GestureHandwritingRecording> _packagedHandwritingDataAll = []; List<GestureHandwritingRecording> _packagedHandwritingDataAll = [];
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
List<GestureHandwritingRecording> newTrajectoryData = mapData[keys[i]]!.map((e) { List<GestureHandwritingRecording> newTrajectoryData = mapData[keys[i]]!.map((e) {
// double theX = e.x; double theX = e.x;
// double theY = e.y; double theY = e.y;
// if (!e.initialization) { if (!e.initialization) {
// // //
// e.toInitialization(scaleRatio); e.toInitialization(scaleRatio);
// theX = e.x; theX = e.x;
// theY = e.y; theY = e.y;
// } }
return GestureHandwritingRecording( return GestureHandwritingRecording(
stroke: e.stroke, data: Offset(theX, theY),
data: Offset(e.x * scaleRatio, e.y * scaleRatio),
// data: Offset(theX, theY),
usageTime: e.time.toInt(), usageTime: e.time.toInt(),
intervalTime: e.intervalTime, intervalTime: e.intervalTime,
stroke: e.stroke,
); );
}).toList(); }).toList();
@ -104,7 +101,6 @@ class HandwritingLogic extends GetxController with RequestToolMixin {
} }
} }
//
HandwritingInfo? getHandwritingDetail(JobHandwriting? theData) { HandwritingInfo? getHandwritingDetail(JobHandwriting? theData) {
if (theData == null) return null; if (theData == null) return null;
// //