From 41b29f19f3d879d8e23724708eff7833b5920b85 Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Thu, 7 Nov 2024 10:58:04 +0800 Subject: [PATCH] no message --- .../components/question_paper_view.dart | 130 +++++++++--------- .../configuration_files/index.dart | 3 +- 2 files changed, 65 insertions(+), 68 deletions(-) diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart index 9626922..13542d3 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart @@ -586,77 +586,75 @@ class QuestionImageView extends HookWidget with EventBusMixin sateData.panQuestView = true, - child: SingleChildScrollView( - controller: scrollControllerQuestion, - physics: !annotationState.pen.value ? const BouncingScrollPhysics() : const NeverScrollableScrollPhysics(), - padding: EdgeInsets.zero, - scrollDirection: Axis.vertical, // 设置垂直滚动 - child: Container( - decoration: BoxDecoration( - boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.2), offset: Offset(-6.r, 1.r), blurRadius: 10.r, spreadRadius: 8.r)]), - child: Listener( - behavior: HitTestBehavior.opaque, - onPointerDown: (PointerDownEvent event) { - // 判断当前是否已经有触摸点,如果有则忽略该触摸事件 + return SingleChildScrollView( + controller: scrollControllerQuestion, + physics: !annotationState.pen.value ? const BouncingScrollPhysics() : const NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + scrollDirection: Axis.vertical, // 设置垂直滚动 + child: Container( + decoration: BoxDecoration( + boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.2), offset: Offset(-6.r, 1.r), blurRadius: 10.r, spreadRadius: 8.r)]), + child: Listener( + behavior: HitTestBehavior.opaque, + onPointerDown: (PointerDownEvent event) { + // 判断当前是否已经有触摸点,如果有则忽略该触摸事件 - // 处理单个触摸点按下的逻辑 - activePointers++; - }, - onPointerUp: (PointerUpEvent details) { - // 处理单个触摸点抬起的逻辑 - // activePointers--; - // globalPosition = null; - activePointers--; + // 处理单个触摸点按下的逻辑 + activePointers++; + sateData.panQuestView = true; + }, + onPointerUp: (PointerUpEvent details) { + // 处理单个触摸点抬起的逻辑 + // activePointers--; + // globalPosition = null; + activePointers--; - var imageScale = sateData.imageScale.value; - if (imageScale == null || !annotationState.pen.value) return; - vnHandWritings.value.add(null); // 增加空点以分隔不同的线段 - sateData.handwritings = vnHandWritings.value; // 添加笔迹数据 - }, - onPointerMove: (PointerMoveEvent event) { - if (activePointers != 1) return; + var imageScale = sateData.imageScale.value; + if (imageScale == null || !annotationState.pen.value) return; + vnHandWritings.value.add(null); // 增加空点以分隔不同的线段 + sateData.handwritings = vnHandWritings.value; // 添加笔迹数据 + }, + onPointerMove: (PointerMoveEvent event) { + if (activePointers != 1) return; - var imageScale = sateData.imageScale.value; - if (imageScale == null || !annotationState.pen.value) return; - Offset localPosition = event.localPosition; - var dy = localPosition.dy; - if (dy > imageScale.actualImgHeight || dy < 0) return; // 检查笔记是否超出图片范围 + var imageScale = sateData.imageScale.value; + if (imageScale == null || !annotationState.pen.value) return; + Offset localPosition = event.localPosition; + var dy = localPosition.dy; + if (dy > imageScale.actualImgHeight || dy < 0) return; // 检查笔记是否超出图片范围 - vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition); - sateData.handwritings = vnHandWritings.value; - }, - child: Stack( - children: [ - $TheCachedNetworkImage( - imageUrl: imageUrl, - 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; - return imageWidget; - }, + vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition); + sateData.handwritings = vnHandWritings.value; + }, + child: Stack( + children: [ + $TheCachedNetworkImage( + imageUrl: imageUrl, + 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; + return imageWidget; + }, + ), + RepaintBoundary( + key: logic.pictureOverviewKey, + child: CustomPaint( + isComplex: true, + size: customPaintSize.value, + foregroundPainter: DrawingPainter(ctrl: vnHandWritings), + child: showZgtAnnotate != null + ? $TheCachedNetworkImage( + imgWidth: maxWidth, + imageUrl: showZgtAnnotate, + (_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth), + ) + : null, ), - RepaintBoundary( - key: logic.pictureOverviewKey, - child: CustomPaint( - isComplex: true, - size: customPaintSize.value, - foregroundPainter: DrawingPainter(ctrl: vnHandWritings), - child: showZgtAnnotate != null - ? $TheCachedNetworkImage( - imgWidth: maxWidth, - imageUrl: showZgtAnnotate, - (_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth), - ) - : null, - ), - ), - ], - ), + ), + ], ), ), ), diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/configuration_files/index.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/configuration_files/index.dart index 57b5507..451ff47 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/configuration_files/index.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/configuration_files/index.dart @@ -107,11 +107,10 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin { state.studentQuestions.value = data.studentQuestions; } catch (e) { print('获取数据报错了:$e'); - ToastUtils.showError('未获取到试题数据,请重试'); + // ToastUtils.showError('未获取到试题数据,请重试'); state.getDataError.value = true; } finally { if (timerControl.isActive) timerControl.cancel(); - ToastUtils.dismiss(); } }