mcy_new #1
|
|
@ -57,7 +57,6 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
|||
child: Obx(() {
|
||||
LastPage? lastPageVal = sateData.data.value?.lastPage;
|
||||
if (lastPageVal == null) return const SizedBox();
|
||||
|
||||
return FloatingActionButton(
|
||||
heroTag: '点击前往上一题',
|
||||
tooltip: '点击前往上一题',
|
||||
|
|
@ -81,7 +80,6 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
|||
child: Obx(() {
|
||||
NextPage? nextPageVal = sateData.data.value?.nextPage;
|
||||
if (nextPageVal == null) return const SizedBox();
|
||||
|
||||
return FloatingActionButton(
|
||||
heroTag: '点击前往下一题',
|
||||
tooltip: '点击前往下一题',
|
||||
|
|
@ -114,8 +112,11 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {
|
|||
final scrollControllerNum = useScrollController(); // 试题题号区域
|
||||
|
||||
useEffect(() {
|
||||
scrollControllerNum.addListener(() {
|
||||
if (sateData.panQuestView == false) sateData.slide.value = scrollControllerNum.offset;
|
||||
});
|
||||
var listenVal = sateData.slide.listen((e) {
|
||||
if (e != scrollControllerNum.offset) scrollControllerNum.jumpTo(e);
|
||||
if (e != scrollControllerNum.offset && sateData.panQuestView == true) scrollControllerNum.jumpTo(e);
|
||||
});
|
||||
|
||||
return () {
|
||||
|
|
@ -136,6 +137,8 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {
|
|||
)
|
||||
],
|
||||
),
|
||||
child: GestureDetector(
|
||||
onPanDown: (_) => sateData.panQuestView = false,
|
||||
child: SingleChildScrollView(
|
||||
controller: scrollControllerNum,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
|
|
@ -158,7 +161,7 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {
|
|||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -354,9 +357,17 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
|||
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 () {
|
||||
listenVal.cancel();
|
||||
imageStream?.removeListener(imageStreamListener.value);
|
||||
};
|
||||
}, []);
|
||||
|
|
@ -369,7 +380,9 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
|||
var imageUrl = sateData.data.value?.zgtAnswer;
|
||||
if (imageUrl == null) return const SizedBox();
|
||||
|
||||
return SingleChildScrollView(
|
||||
return GestureDetector(
|
||||
onPanDown: (_) => sateData.panQuestView = true,
|
||||
child: SingleChildScrollView(
|
||||
controller: scrollControllerQuestion,
|
||||
physics: !annotationState.pen.value ? const BouncingScrollPhysics() : const NeverScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.zero,
|
||||
|
|
@ -414,6 +427,7 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class HomeworkReviewState {
|
|||
late Rx<DoPaperDetailsResult?> data;
|
||||
late Rx<List<StudentQuestions>?> studentQuestions;
|
||||
late Rx<double> slide; // 滑动位置
|
||||
late bool? panQuestView;
|
||||
late Rx<TestQuestionsImageInfo?> imageScale;
|
||||
|
||||
// late String dateEnd = '';
|
||||
|
|
|
|||
Loading…
Reference in New Issue