mcy_new #1
|
|
@ -57,7 +57,6 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
LastPage? lastPageVal = sateData.data.value?.lastPage;
|
LastPage? lastPageVal = sateData.data.value?.lastPage;
|
||||||
if (lastPageVal == null) return const SizedBox();
|
if (lastPageVal == null) return const SizedBox();
|
||||||
|
|
||||||
return FloatingActionButton(
|
return FloatingActionButton(
|
||||||
heroTag: '点击前往上一题',
|
heroTag: '点击前往上一题',
|
||||||
tooltip: '点击前往上一题',
|
tooltip: '点击前往上一题',
|
||||||
|
|
@ -81,7 +80,6 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
NextPage? nextPageVal = sateData.data.value?.nextPage;
|
NextPage? nextPageVal = sateData.data.value?.nextPage;
|
||||||
if (nextPageVal == null) return const SizedBox();
|
if (nextPageVal == null) return const SizedBox();
|
||||||
|
|
||||||
return FloatingActionButton(
|
return FloatingActionButton(
|
||||||
heroTag: '点击前往下一题',
|
heroTag: '点击前往下一题',
|
||||||
tooltip: '点击前往下一题',
|
tooltip: '点击前往下一题',
|
||||||
|
|
@ -114,8 +112,11 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {
|
||||||
final scrollControllerNum = useScrollController(); // 试题题号区域
|
final scrollControllerNum = useScrollController(); // 试题题号区域
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
|
scrollControllerNum.addListener(() {
|
||||||
|
if (sateData.panQuestView == false) sateData.slide.value = scrollControllerNum.offset;
|
||||||
|
});
|
||||||
var listenVal = sateData.slide.listen((e) {
|
var listenVal = sateData.slide.listen((e) {
|
||||||
if (e != scrollControllerNum.offset) scrollControllerNum.jumpTo(e);
|
if (e != scrollControllerNum.offset && sateData.panQuestView == true) scrollControllerNum.jumpTo(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
return () {
|
return () {
|
||||||
|
|
@ -136,29 +137,31 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: GestureDetector(
|
||||||
controller: scrollControllerNum,
|
onPanDown: (_) => sateData.panQuestView = false,
|
||||||
physics: const BouncingScrollPhysics(),
|
child: SingleChildScrollView(
|
||||||
padding: EdgeInsets.zero,
|
controller: scrollControllerNum,
|
||||||
scrollDirection: Axis.vertical, // 设置垂直滚动
|
physics: const BouncingScrollPhysics(),
|
||||||
child: Obx(() {
|
padding: EdgeInsets.zero,
|
||||||
var imageVal = sateData.imageScale.value;
|
scrollDirection: Axis.vertical, // 设置垂直滚动
|
||||||
if (imageVal == null) return const SizedBox();
|
child: Obx(() {
|
||||||
var studentQuestions = sateData.studentQuestions.value;
|
var imageVal = sateData.imageScale.value;
|
||||||
|
if (imageVal == null) return const SizedBox();
|
||||||
|
var studentQuestions = sateData.studentQuestions.value;
|
||||||
|
|
||||||
var boxHeight = imageVal.boxHeight;
|
var boxHeight = imageVal.boxHeight;
|
||||||
var actualImgHeight = imageVal.actualImgHeight; // 实际图片高度
|
var actualImgHeight = imageVal.actualImgHeight; // 实际图片高度
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
height: boxHeight > actualImgHeight ? boxHeight : actualImgHeight,
|
height: boxHeight > actualImgHeight ? boxHeight : actualImgHeight,
|
||||||
padding: EdgeInsets.only(top: imageVal.remainingHeight > 0 ? imageVal.remainingHeight / 2 : 0),
|
padding: EdgeInsets.only(top: imageVal.remainingHeight > 0 ? imageVal.remainingHeight / 2 : 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: studentQuestions?.asMap().keys.map((e) => $ScoringQuestionsView(studentQuestions[e], imageVal.scaleRatio)).toList() ?? [],
|
children: studentQuestions?.asMap().keys.map((e) => $ScoringQuestionsView(studentQuestions[e], imageVal.scaleRatio)).toList() ?? [],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -354,9 +357,17 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
vnHandWritings.value = annotationsData;
|
vnHandWritings.value = annotationsData;
|
||||||
});
|
});
|
||||||
|
|
||||||
scrollControllerQuestion.addListener(() => sateData.slide.value = scrollControllerQuestion.offset); // 执行滚动相关的逻辑,例如打印滚动位置
|
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 () {
|
||||||
|
listenVal.cancel();
|
||||||
imageStream?.removeListener(imageStreamListener.value);
|
imageStream?.removeListener(imageStreamListener.value);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -369,45 +380,48 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
var imageUrl = sateData.data.value?.zgtAnswer;
|
var imageUrl = sateData.data.value?.zgtAnswer;
|
||||||
if (imageUrl == null) return const SizedBox();
|
if (imageUrl == null) return const SizedBox();
|
||||||
|
|
||||||
return SingleChildScrollView(
|
return GestureDetector(
|
||||||
controller: scrollControllerQuestion,
|
onPanDown: (_) => sateData.panQuestView = true,
|
||||||
physics: !annotationState.pen.value ? const BouncingScrollPhysics() : const NeverScrollableScrollPhysics(),
|
child: SingleChildScrollView(
|
||||||
padding: EdgeInsets.zero,
|
controller: scrollControllerQuestion,
|
||||||
scrollDirection: Axis.vertical, // 设置垂直滚动
|
physics: !annotationState.pen.value ? const BouncingScrollPhysics() : const NeverScrollableScrollPhysics(),
|
||||||
child: Container(
|
padding: EdgeInsets.zero,
|
||||||
decoration: BoxDecoration(
|
scrollDirection: Axis.vertical, // 设置垂直滚动
|
||||||
boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.2), offset: Offset(-6.r, 1.r), blurRadius: 10.r, spreadRadius: 8.r)]),
|
child: Container(
|
||||||
child: Listener(
|
decoration: BoxDecoration(
|
||||||
behavior: HitTestBehavior.opaque,
|
boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.2), offset: Offset(-6.r, 1.r), blurRadius: 10.r, spreadRadius: 8.r)]),
|
||||||
onPointerUp: (PointerUpEvent details) {
|
child: Listener(
|
||||||
// 处理单个触摸点抬起的逻辑
|
behavior: HitTestBehavior.opaque,
|
||||||
// activePointers--;
|
onPointerUp: (PointerUpEvent details) {
|
||||||
// globalPosition = null;
|
// 处理单个触摸点抬起的逻辑
|
||||||
var imageScale = sateData.imageScale.value;
|
// activePointers--;
|
||||||
if (imageScale == null || !annotationState.pen.value) return;
|
// globalPosition = null;
|
||||||
vnHandWritings.value.add(null); // 增加空点以分隔不同的线段
|
var imageScale = sateData.imageScale.value;
|
||||||
},
|
if (imageScale == null || !annotationState.pen.value) return;
|
||||||
onPointerMove: (PointerMoveEvent event) {
|
vnHandWritings.value.add(null); // 增加空点以分隔不同的线段
|
||||||
var imageScale = sateData.imageScale.value;
|
},
|
||||||
if (imageScale == null || !annotationState.pen.value) return;
|
onPointerMove: (PointerMoveEvent event) {
|
||||||
Offset localPosition = event.localPosition;
|
var imageScale = sateData.imageScale.value;
|
||||||
var dy = localPosition.dy;
|
if (imageScale == null || !annotationState.pen.value) return;
|
||||||
if (dy > imageScale.actualImgHeight || dy < 0) return; // 检查笔记是否超出图片范围
|
Offset localPosition = event.localPosition;
|
||||||
|
var dy = localPosition.dy;
|
||||||
|
if (dy > imageScale.actualImgHeight || dy < 0) return; // 检查笔记是否超出图片范围
|
||||||
|
|
||||||
vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition);
|
vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition);
|
||||||
},
|
},
|
||||||
child: RepaintBoundary(
|
child: RepaintBoundary(
|
||||||
child: CustomPaint(
|
child: CustomPaint(
|
||||||
foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
|
foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
|
||||||
child: RepaintBoundary(
|
child: RepaintBoundary(
|
||||||
child: $TheCachedNetworkImage(
|
child: $TheCachedNetworkImage(
|
||||||
(context, imageProvider) {
|
(context, imageProvider) {
|
||||||
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
|
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
|
||||||
imageStream?.removeListener(imageStreamListener.value);
|
imageStream?.removeListener(imageStreamListener.value);
|
||||||
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener.value);
|
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener.value);
|
||||||
return imageWidget;
|
return imageWidget;
|
||||||
},
|
},
|
||||||
imageUrl: RequestConfig.imgUrl + imageUrl,
|
imageUrl: RequestConfig.imgUrl + imageUrl,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ class HomeworkReviewState {
|
||||||
late Rx<DoPaperDetailsResult?> data;
|
late Rx<DoPaperDetailsResult?> data;
|
||||||
late Rx<List<StudentQuestions>?> studentQuestions;
|
late Rx<List<StudentQuestions>?> studentQuestions;
|
||||||
late Rx<double> slide; // 滑动位置
|
late Rx<double> slide; // 滑动位置
|
||||||
|
late bool? panQuestView;
|
||||||
late Rx<TestQuestionsImageInfo?> imageScale;
|
late Rx<TestQuestionsImageInfo?> imageScale;
|
||||||
|
|
||||||
// late String dateEnd = '';
|
// late String dateEnd = '';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue