no message
This commit is contained in:
parent
d3509a2eee
commit
952e181e45
|
|
@ -34,39 +34,33 @@ class AnswerHandwriting extends Dialog {
|
|||
final int? questionNo;
|
||||
final Function closeCall;
|
||||
AnswerHandwriting(
|
||||
{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,
|
||||
);
|
||||
}
|
||||
{super.key, required this.homeworkId, required this.studentId, required this.closeCall, this.templateId, this.pageNum, this.questionNo});
|
||||
final _handwritingLogic = Get.find<HandwritingLogic>();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var boxHeight = ScreenUtil().screenHeight / 1.168; // 盒子高度
|
||||
var boxWidth = ScreenUtil().screenWidth - (ScreenUtil().scaleWidth < 1.5 ? 40.r : 40.r); // 盒子宽度
|
||||
return OrientationBuilder(builder: (BuildContext context, Orientation orientation) {
|
||||
var boxHeight = ScreenUtil().screenHeight / 1.168; // 盒子高度
|
||||
var boxWidth = ScreenUtil().screenWidth - (ScreenUtil().scaleWidth < 1.5 ? 40.r : 40.r); // 盒子宽度
|
||||
|
||||
return Center(
|
||||
child: Container(
|
||||
height: boxHeight,
|
||||
width: boxWidth,
|
||||
alignment: Alignment.center,
|
||||
child: AnswerHandwritingMainBox(
|
||||
handwritingLogic: _handwritingLogic,
|
||||
boxHeight: boxHeight,
|
||||
boxWidth: boxWidth,
|
||||
homeworkId: homeworkId,
|
||||
templateId: templateId,
|
||||
studentId: studentId,
|
||||
pageNum: pageNum,
|
||||
questionNo: questionNo,
|
||||
closeCall: closeCall,
|
||||
return Center(
|
||||
child: Container(
|
||||
height: boxHeight,
|
||||
width: boxWidth,
|
||||
alignment: Alignment.center,
|
||||
child: AnswerHandwritingMainBox(
|
||||
handwritingLogic: _handwritingLogic,
|
||||
boxHeight: boxHeight,
|
||||
boxWidth: boxWidth,
|
||||
homeworkId: homeworkId,
|
||||
templateId: templateId,
|
||||
studentId: studentId,
|
||||
pageNum: pageNum,
|
||||
questionNo: questionNo,
|
||||
closeCall: closeCall,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,26 +72,29 @@ Future<void> showAnswerHandwriting(
|
|||
int? pageNum,
|
||||
int? questionNo,
|
||||
}) async {
|
||||
try {
|
||||
backCall() {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
Get.put(HandwritingLogic(backCall));
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AnswerHandwriting(
|
||||
homeworkId: homeworkId,
|
||||
templateId: templateId,
|
||||
studentId: studentId,
|
||||
pageNum: pageNum,
|
||||
questionNo: questionNo,
|
||||
closeCall: backCall,
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
Get.delete<HandwritingLogic>();
|
||||
backCall() {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
Get.put(HandwritingLogic(backCall));
|
||||
Get.find<HandwritingLogic>().params.value = OriginalManuscriptHandwritingParams(
|
||||
homeworkId: homeworkId,
|
||||
studentId: studentId,
|
||||
templateId: templateId,
|
||||
pageNum: pageNum,
|
||||
questionNo: questionNo,
|
||||
);
|
||||
await showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) => AnswerHandwriting(
|
||||
homeworkId: homeworkId,
|
||||
templateId: templateId,
|
||||
studentId: studentId,
|
||||
pageNum: pageNum,
|
||||
questionNo: questionNo,
|
||||
closeCall: backCall,
|
||||
),
|
||||
).then((e) => Get.delete<HandwritingLogic>());
|
||||
}
|
||||
|
||||
// 主图
|
||||
|
|
@ -364,7 +361,12 @@ class _HandwritingDrawBoxState extends State<HandwritingDrawBox> with EventBusMi
|
|||
_packagedHandwritingDataAll = [];
|
||||
}
|
||||
|
||||
_vnPrimaryHandWritings.value = [..._packagedHandwritingDataAll]; // 总体数据
|
||||
// _vnPrimaryHandWritings.is
|
||||
try {
|
||||
_vnPrimaryHandWritings.value = [..._packagedHandwritingDataAll]; // 总体数据
|
||||
} catch (e) {
|
||||
_vnPrimaryHandWritings = ValueNotifier<List<GestureHandwritingRecording>>(_packagedHandwritingDataAll);
|
||||
}
|
||||
// eventFire(model: JobHandwritingPlaybarBus);
|
||||
});
|
||||
showManuscriptStream = handwritingLogic.toolbar.showManuscript.listen((e) {
|
||||
|
|
@ -379,7 +381,13 @@ class _HandwritingDrawBoxState extends State<HandwritingDrawBox> with EventBusMi
|
|||
}
|
||||
});
|
||||
|
||||
executionDataStream = handwritingLogic.toolbar.executionData.listen((e) => _vnHandWritings.value = e);
|
||||
executionDataStream = handwritingLogic.toolbar.executionData.listen((e) {
|
||||
try {
|
||||
_vnHandWritings.value = e;
|
||||
} catch (e1) {
|
||||
_vnHandWritings = ValueNotifier<List<GestureHandwritingRecording>>(e);
|
||||
}
|
||||
});
|
||||
|
||||
eventOn(callback: (e) {
|
||||
switch (e.runtimeType) {
|
||||
|
|
@ -421,6 +429,8 @@ class _HandwritingDrawBoxState extends State<HandwritingDrawBox> with EventBusMi
|
|||
@override
|
||||
void dispose() {
|
||||
imageStream?.removeListener(theImageStreamListener);
|
||||
_vnHandWritings.dispose();
|
||||
_vnPrimaryHandWritings.dispose();
|
||||
showManuscriptStream.cancel();
|
||||
executionDataStream.cancel();
|
||||
eventCancel();
|
||||
|
|
@ -537,7 +547,8 @@ class _HandwritingDrawBoxState extends State<HandwritingDrawBox> with EventBusMi
|
|||
imageUrl: paperPicture,
|
||||
(context, imageProvider) {
|
||||
Image imageWidget = Image(image: imageProvider, fit: BoxFit.contain);
|
||||
if (handwritingLogic.imagInfoModel.value == null) {
|
||||
var imagInfoModel = handwritingLogic.imagInfoModel.value;
|
||||
if (imagInfoModel == null || imagInfoModel.boxWidth != widget.boxWidth) {
|
||||
imageStream?.removeListener(theImageStreamListener);
|
||||
imageStream = imageWidget.image.resolve(const ImageConfiguration());
|
||||
imageStream?.addListener(theImageStreamListener);
|
||||
|
|
@ -873,7 +884,6 @@ class StudentManuscriptBtn extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
print('显示原噶:${handwritingLogic.toolbar.showManuscript.value}');
|
||||
return InkWell(
|
||||
onTap: () => easyThrottle('job_handwriting_udent_manuscript', () {
|
||||
var showManuscript = handwritingLogic.toolbar.showManuscript.value;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// 逻辑文件
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.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';
|
||||
|
|
@ -33,6 +34,7 @@ class HandwritingLogic extends GetxController with RequestToolMixin {
|
|||
ever(params, (callback) => getData());
|
||||
ever(imagInfoModel, (callback) {
|
||||
// 图像数据初始化后 计算笔迹数据
|
||||
toolbar.initialization.value = false;
|
||||
handwritingInfo.value = getHandwritingDetail(resultData.value);
|
||||
getCalculatedSize();
|
||||
});
|
||||
|
|
@ -67,24 +69,25 @@ class HandwritingLogic extends GetxController with RequestToolMixin {
|
|||
double scaleRatio = imagInfoModel.value!.scaleRatio;
|
||||
if (mapData.isNotEmpty) {
|
||||
List<int> keys = mapData.keys.toList();
|
||||
|
||||
print('重新计算:${scaleRatio}');
|
||||
List<List<GestureHandwritingRecording>> _packagedHandwritingDatas = [];
|
||||
List<GestureHandwritingRecording> _packagedHandwritingDataAll = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
List<GestureHandwritingRecording> newTrajectoryData = mapData[keys[i]]!.map((e) {
|
||||
double theX = e.x;
|
||||
double theY = e.y;
|
||||
if (!e.initialization) {
|
||||
// 未初始化基准
|
||||
e.toInitialization(scaleRatio);
|
||||
theX = e.x;
|
||||
theY = e.y;
|
||||
}
|
||||
// double theX = e.x;
|
||||
// double theY = e.y;
|
||||
// if (!e.initialization) {
|
||||
// // 未初始化基准
|
||||
// e.toInitialization(scaleRatio);
|
||||
// theX = e.x;
|
||||
// theY = e.y;
|
||||
// }
|
||||
return GestureHandwritingRecording(
|
||||
data: Offset(theX, theY),
|
||||
stroke: e.stroke,
|
||||
data: Offset(e.x * scaleRatio, e.y * scaleRatio),
|
||||
// data: Offset(theX, theY),
|
||||
usageTime: e.time.toInt(),
|
||||
intervalTime: e.intervalTime,
|
||||
stroke: e.stroke,
|
||||
);
|
||||
}).toList();
|
||||
|
||||
|
|
@ -101,6 +104,7 @@ class HandwritingLogic extends GetxController with RequestToolMixin {
|
|||
}
|
||||
}
|
||||
|
||||
// 数据笔画处理计算
|
||||
HandwritingInfo? getHandwritingDetail(JobHandwriting? theData) {
|
||||
if (theData == null) return null;
|
||||
// 笔画分组
|
||||
|
|
|
|||
Loading…
Reference in New Issue