安卓才判断双指校验
This commit is contained in:
parent
4d42562508
commit
1ebdbf101a
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
@ -30,7 +31,8 @@ class QuestionPaperView extends GetView<HomeworkReviewLogic> {
|
||||||
|
|
||||||
HomeworkReviewState get sateData => controller.state;
|
HomeworkReviewState get sateData => controller.state;
|
||||||
ZoomState get zoomState => controller.zoomLogic.zoomState;
|
ZoomState get zoomState => controller.zoomLogic.zoomState;
|
||||||
HomeworkReviewAnnotationsControlState get annotationState => controller.annotationState;
|
HomeworkReviewAnnotationsControlState get annotationState =>
|
||||||
|
controller.annotationState;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -46,11 +48,13 @@ class QuestionPaperView extends GetView<HomeworkReviewLogic> {
|
||||||
|
|
||||||
if (zoomFileModel == null) {
|
if (zoomFileModel == null) {
|
||||||
/// 计算高度
|
/// 计算高度
|
||||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
|
return LayoutBuilder(builder:
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) => zoomState.zoomFile.value = ZoomFileModel(
|
(BuildContext context, BoxConstraints constraints) {
|
||||||
viewWidth: constraints.maxWidth,
|
WidgetsBinding.instance.addPostFrameCallback(
|
||||||
viewHeight: constraints.maxHeight,
|
(_) => zoomState.zoomFile.value = ZoomFileModel(
|
||||||
));
|
viewWidth: constraints.maxWidth,
|
||||||
|
viewHeight: constraints.maxHeight,
|
||||||
|
));
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +67,11 @@ class QuestionPaperView extends GetView<HomeworkReviewLogic> {
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
// 主图
|
// 主图
|
||||||
QuestionImageView(maxWidth, maxHeight, annotationState, controller, zoomState: zoomState, sateData: sateData, actualHeight: zoomFileModel.actualHeight!),
|
QuestionImageView(
|
||||||
|
maxWidth, maxHeight, annotationState, controller,
|
||||||
|
zoomState: zoomState,
|
||||||
|
sateData: sateData,
|
||||||
|
actualHeight: zoomFileModel.actualHeight!),
|
||||||
// 继续批阅按钮
|
// 继续批阅按钮
|
||||||
// Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
|
// Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
|
||||||
// 上一题按钮
|
// 上一题按钮
|
||||||
|
|
@ -77,15 +85,19 @@ class QuestionPaperView extends GetView<HomeworkReviewLogic> {
|
||||||
heroTag: '点击前往上一题',
|
heroTag: '点击前往上一题',
|
||||||
tooltip: '点击前往上一题',
|
tooltip: '点击前往上一题',
|
||||||
focusColor: Theme.of(context).primaryColor,
|
focusColor: Theme.of(context).primaryColor,
|
||||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
backgroundColor:
|
||||||
|
const Color.fromRGBO(24, 32, 32, 0.05),
|
||||||
elevation: 10.r,
|
elevation: 10.r,
|
||||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
onPressed: () =>
|
||||||
|
easyThrottle('TestQuestionSwitch', () {
|
||||||
var param = sateData.param.value;
|
var param = sateData.param.value;
|
||||||
param.studentId = lastPageVal.studentId;
|
param.studentId = lastPageVal.studentId;
|
||||||
param.templateId = lastPageVal.templateId;
|
param.templateId = lastPageVal.templateId;
|
||||||
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
|
sateData.param.value =
|
||||||
|
DoPaperDetailsParam.fromJson(param.toJson());
|
||||||
}),
|
}),
|
||||||
child: Icon(Icons.arrow_back_ios, color: Colors.white, size: 22.sp),
|
child: Icon(Icons.arrow_back_ios,
|
||||||
|
color: Colors.white, size: 22.sp),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|
@ -101,14 +113,18 @@ class QuestionPaperView extends GetView<HomeworkReviewLogic> {
|
||||||
heroTag: '点击前往下一题',
|
heroTag: '点击前往下一题',
|
||||||
tooltip: '点击前往下一题',
|
tooltip: '点击前往下一题',
|
||||||
elevation: 10.r,
|
elevation: 10.r,
|
||||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
backgroundColor:
|
||||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
const Color.fromRGBO(24, 32, 32, 0.05),
|
||||||
|
onPressed: () =>
|
||||||
|
easyThrottle('TestQuestionSwitch', () {
|
||||||
var param = sateData.param.value;
|
var param = sateData.param.value;
|
||||||
param.studentId = nextPageVal.studentId;
|
param.studentId = nextPageVal.studentId;
|
||||||
param.templateId = nextPageVal.templateId;
|
param.templateId = nextPageVal.templateId;
|
||||||
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
|
sateData.param.value =
|
||||||
|
DoPaperDetailsParam.fromJson(param.toJson());
|
||||||
}),
|
}),
|
||||||
child: Icon(Icons.arrow_forward_ios, color: Colors.white, size: 22.sp),
|
child: Icon(Icons.arrow_forward_ios,
|
||||||
|
color: Colors.white, size: 22.sp),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|
@ -145,7 +161,8 @@ class DataErrorThenRequestAgainButton extends StatelessWidget {
|
||||||
child: CupertinoButton(
|
child: CupertinoButton(
|
||||||
color: Colors.grey[300],
|
color: Colors.grey[300],
|
||||||
onPressed: () => easyThrottle('home_work_reload_data', () {
|
onPressed: () => easyThrottle('home_work_reload_data', () {
|
||||||
sateData.param.value = DoPaperDetailsParam.fromJson(sateData.param.value.toJson());
|
sateData.param.value =
|
||||||
|
DoPaperDetailsParam.fromJson(sateData.param.value.toJson());
|
||||||
}),
|
}),
|
||||||
child: quickText('再次请求', color: Colors.black38),
|
child: quickText('再次请求', color: Colors.black38),
|
||||||
),
|
),
|
||||||
|
|
@ -156,7 +173,8 @@ class DataErrorThenRequestAgainButton extends StatelessWidget {
|
||||||
|
|
||||||
// 底部已阅数量和待阅数量
|
// 底部已阅数量和待阅数量
|
||||||
@swidget
|
@swidget
|
||||||
Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData) {
|
Widget $totalSubmitCountView(
|
||||||
|
BuildContext context, HomeworkReviewState sateData) {
|
||||||
return Obx(() {
|
return Obx(() {
|
||||||
var data = sateData.data.value;
|
var data = sateData.data.value;
|
||||||
if (data == null) return Container();
|
if (data == null) return Container();
|
||||||
|
|
@ -171,7 +189,10 @@ Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData)
|
||||||
context: context,
|
context: context,
|
||||||
elevation: 10,
|
elevation: 10,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r), topRight: Radius.circular(10.r))),
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(10.r),
|
||||||
|
topRight: Radius.circular(10.r))),
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 2.w),
|
padding: EdgeInsets.symmetric(horizontal: 2.w),
|
||||||
|
|
@ -189,7 +210,8 @@ Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData)
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 4.w),
|
padding: EdgeInsets.symmetric(
|
||||||
|
vertical: 8.h, horizontal: 4.w),
|
||||||
children: [
|
children: [
|
||||||
Wrap(
|
Wrap(
|
||||||
spacing: 7.2.w, // 主轴(水平)方向间距
|
spacing: 7.2.w, // 主轴(水平)方向间距
|
||||||
|
|
@ -200,27 +222,39 @@ Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData)
|
||||||
alignment: const FractionalOffset(0.05, 0.09),
|
alignment: const FractionalOffset(0.05, 0.09),
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(top: 1.2.h, bottom: 1.5.h, left: 13.w, right: 5.w),
|
padding: EdgeInsets.only(
|
||||||
|
top: 1.2.h,
|
||||||
|
bottom: 1.5.h,
|
||||||
|
left: 13.w,
|
||||||
|
right: 5.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(4.r),
|
borderRadius: BorderRadius.circular(4.r),
|
||||||
color: const Color.fromRGBO(239, 242, 255, 1),
|
color: const Color.fromRGBO(
|
||||||
|
239, 242, 255, 1),
|
||||||
),
|
),
|
||||||
child: quickText(
|
child: quickText(
|
||||||
e.name,
|
e.name,
|
||||||
size: 12.sp,
|
size: 12.sp,
|
||||||
wordSpacing: 2,
|
wordSpacing: 2,
|
||||||
color: const Color.fromRGBO(80, 94, 110, 1),
|
color:
|
||||||
|
const Color.fromRGBO(80, 94, 110, 1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Stack(
|
Stack(
|
||||||
alignment: const FractionalOffset(0.52, 0.24),
|
alignment:
|
||||||
|
const FractionalOffset(0.52, 0.24),
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
const IconData(0xe63d, fontFamily: "AlibabaIcon"),
|
const IconData(0xe63d,
|
||||||
|
fontFamily: "AlibabaIcon"),
|
||||||
size: 12.sp,
|
size: 12.sp,
|
||||||
color: e.isPriority ? Theme.of(context).primaryColor : const Color.fromRGBO(164, 164, 164, 1),
|
color: e.isPriority
|
||||||
|
? Theme.of(context).primaryColor
|
||||||
|
: const Color.fromRGBO(
|
||||||
|
164, 164, 164, 1),
|
||||||
),
|
),
|
||||||
quickText('优先', size: 4.sp, color: Colors.white),
|
quickText('优先',
|
||||||
|
size: 4.sp, color: Colors.white),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -242,11 +276,17 @@ Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData)
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(bottom: 1.h),
|
padding: EdgeInsets.only(bottom: 1.h),
|
||||||
child: quickText('已阅', color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
|
child: quickText('已阅',
|
||||||
|
color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
|
||||||
),
|
),
|
||||||
quickText(data.annotatedCount, color: Theme.of(context).primaryColor, size: 12.sp, fontWeight: FontWeight.bold),
|
quickText(data.annotatedCount,
|
||||||
quickText('/', color: const Color.fromRGBO(117, 117, 117, 1), size: 12.sp),
|
color: Theme.of(context).primaryColor,
|
||||||
quickText(data.submitCount - data.annotatedCount, color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
|
size: 12.sp,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
quickText('/',
|
||||||
|
color: const Color.fromRGBO(117, 117, 117, 1), size: 12.sp),
|
||||||
|
quickText(data.submitCount - data.annotatedCount,
|
||||||
|
color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -255,7 +295,8 @@ Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 试题图片视图
|
// 试题图片视图
|
||||||
class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar> {
|
class QuestionImageView extends HookWidget
|
||||||
|
with EventBusMixin<BottomOperationBar> {
|
||||||
final double maxWidth;
|
final double maxWidth;
|
||||||
final double maxHeight;
|
final double maxHeight;
|
||||||
final double actualHeight;
|
final double actualHeight;
|
||||||
|
|
@ -263,7 +304,12 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
final ZoomState zoomState;
|
final ZoomState zoomState;
|
||||||
final HomeworkReviewState sateData;
|
final HomeworkReviewState sateData;
|
||||||
final HomeworkReviewAnnotationsControlState annotationState;
|
final HomeworkReviewAnnotationsControlState annotationState;
|
||||||
QuestionImageView(this.maxWidth, this.maxHeight, this.annotationState, this.logic, {required this.actualHeight, required this.zoomState, required this.sateData, super.key});
|
QuestionImageView(
|
||||||
|
this.maxWidth, this.maxHeight, this.annotationState, this.logic,
|
||||||
|
{required this.actualHeight,
|
||||||
|
required this.zoomState,
|
||||||
|
required this.sateData,
|
||||||
|
super.key});
|
||||||
|
|
||||||
/// 获取数组指定倒数具体值的下标
|
/// 获取数组指定倒数具体值的下标
|
||||||
int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) {
|
int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) {
|
||||||
|
|
@ -310,7 +356,6 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
// lastDrop = getLastDrop(vals, index);
|
// lastDrop = getLastDrop(vals, index);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
return lastDrop;
|
return lastDrop;
|
||||||
}
|
}
|
||||||
|
|
@ -318,10 +363,12 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theMaxHeight = useState<double>(maxHeight);
|
final theMaxHeight = useState<double>(maxHeight);
|
||||||
useValueChanged<double, void>(maxHeight, (oldValue, __) => theMaxHeight.value = maxHeight);
|
useValueChanged<double, void>(
|
||||||
|
maxHeight, (oldValue, __) => theMaxHeight.value = maxHeight);
|
||||||
|
|
||||||
var zoomKey = useState<GlobalKey>(GlobalKey());
|
var zoomKey = useState<GlobalKey>(GlobalKey());
|
||||||
useValueChanged<int?, void>(zoomState.zoomFile.value?.templateId, (old, __) {
|
useValueChanged<int?, void>(zoomState.zoomFile.value?.templateId,
|
||||||
|
(old, __) {
|
||||||
zoomKey.value = GlobalKey();
|
zoomKey.value = GlobalKey();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -340,9 +387,13 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
});
|
});
|
||||||
|
|
||||||
var streamSubscriptionSlide = sateData.slide.listen((e) {
|
var streamSubscriptionSlide = sateData.slide.listen((e) {
|
||||||
if (sateData.panQuestView != null && sateData.panQuestView == false && initPosition.value?.dy.abs().toInt().toDouble() != sateData.slide.value) {
|
if (sateData.panQuestView != null &&
|
||||||
|
sateData.panQuestView == false &&
|
||||||
|
initPosition.value?.dy.abs().toInt().toDouble() !=
|
||||||
|
sateData.slide.value) {
|
||||||
if (sateData.zoomOffset != null) {
|
if (sateData.zoomOffset != null) {
|
||||||
sateData.zoomOffset = Offset(sateData.zoomOffset!.dx, -sateData.slide.value);
|
sateData.zoomOffset =
|
||||||
|
Offset(sateData.zoomOffset!.dx, -sateData.slide.value);
|
||||||
}
|
}
|
||||||
initPosition.value = sateData.zoomOffset;
|
initPosition.value = sateData.zoomOffset;
|
||||||
}
|
}
|
||||||
|
|
@ -363,7 +414,17 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
bool? res = await showDialog<bool>(
|
bool? res = await showDialog<bool>(
|
||||||
context: Get.context ?? context,
|
context: Get.context ?? context,
|
||||||
builder: (context1) {
|
builder: (context1) {
|
||||||
return AlertDialog(content: quickText("是否撤销全部批注痕迹?"), actions: <Widget>[TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)), TextButton(child: quickText("确定", color: Theme.of(context1).primaryColor), onPressed: () => Navigator.pop(context1, true))]);
|
return AlertDialog(
|
||||||
|
content: quickText("是否撤销全部批注痕迹?"),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: quickText("取消"),
|
||||||
|
onPressed: () => Navigator.pop(context1, false)),
|
||||||
|
TextButton(
|
||||||
|
child: quickText("确定",
|
||||||
|
color: Theme.of(context1).primaryColor),
|
||||||
|
onPressed: () => Navigator.pop(context1, true))
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res == true) vnHandWritings.value = [];
|
if (res == true) vnHandWritings.value = [];
|
||||||
|
|
@ -373,33 +434,43 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
await showDialog<bool>(
|
await showDialog<bool>(
|
||||||
context: Get.context ?? context,
|
context: Get.context ?? context,
|
||||||
builder: (context1) {
|
builder: (context1) {
|
||||||
return AlertDialog(content: quickText("是否撤销上次批阅批注痕迹?"), actions: <Widget>[
|
return AlertDialog(
|
||||||
TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)),
|
content: quickText("是否撤销上次批阅批注痕迹?"),
|
||||||
TextButton(
|
actions: <Widget>[
|
||||||
child: quickText("确定", color: Theme.of(context1).primaryColor),
|
TextButton(
|
||||||
onPressed: () => easyThrottle(
|
child: quickText("取消"),
|
||||||
'REVOKE_THE_LAST_ANNOTATION_AND_SUBMIT',
|
onPressed: () => Navigator.pop(context1, false)),
|
||||||
() {
|
TextButton(
|
||||||
Navigator.pop(context1, true);
|
child: quickText("确定",
|
||||||
sateData.data.value?.zgtAnnotate = null;
|
color: Theme.of(context1).primaryColor),
|
||||||
sateData.data.value?.showZgtAnnotate = null;
|
onPressed: () => easyThrottle(
|
||||||
if (sateData.data.value != null) {
|
'REVOKE_THE_LAST_ANNOTATION_AND_SUBMIT',
|
||||||
sateData.data.update((_) {
|
() {
|
||||||
var theStudentQuestions = sateData.studentQuestions.value;
|
Navigator.pop(context1, true);
|
||||||
if (theStudentQuestions?.isNotEmpty ?? false) {
|
sateData.data.value?.zgtAnnotate = null;
|
||||||
var noMarking = theStudentQuestions?.firstWhereOrNull((e) => e.studentScore == null);
|
sateData.data.value?.showZgtAnnotate = null;
|
||||||
if (noMarking != null) {
|
if (sateData.data.value != null) {
|
||||||
ToastUtils.showInfo("未提交!请为第${noMarking.questionNo}题打分,再手动提交");
|
sateData.data.update((_) {
|
||||||
return;
|
var theStudentQuestions =
|
||||||
}
|
sateData.studentQuestions.value;
|
||||||
|
if (theStudentQuestions?.isNotEmpty ??
|
||||||
|
false) {
|
||||||
|
var noMarking =
|
||||||
|
theStudentQuestions?.firstWhereOrNull(
|
||||||
|
(e) => e.studentScore == null);
|
||||||
|
if (noMarking != null) {
|
||||||
|
ToastUtils.showInfo(
|
||||||
|
"未提交!请为第${noMarking.questionNo}题打分,再手动提交");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logic.submit(Get.context ?? context);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
logic.submit(Get.context ?? context);
|
},
|
||||||
});
|
),
|
||||||
}
|
)
|
||||||
},
|
]);
|
||||||
),
|
|
||||||
)
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -414,23 +485,29 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
await showDialog<bool>(
|
await showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context1) {
|
builder: (context1) {
|
||||||
return AlertDialog(content: quickText("是否撤销上次批阅批注痕迹?"), actions: <Widget>[
|
return AlertDialog(
|
||||||
TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)),
|
content: quickText("是否撤销上次批阅批注痕迹?"),
|
||||||
TextButton(
|
actions: <Widget>[
|
||||||
child: quickText("确定", color: Theme.of(context).primaryColor),
|
TextButton(
|
||||||
onPressed: () => easyThrottle(
|
child: quickText("取消"),
|
||||||
'REVOKE_THE_LAST_ANNOTATION_AND_SUBMIT',
|
onPressed: () => Navigator.pop(context1, false)),
|
||||||
() {
|
TextButton(
|
||||||
Navigator.pop(context1, true);
|
child: quickText("确定",
|
||||||
sateData.data.value?.zgtAnnotate = null;
|
color: Theme.of(context).primaryColor),
|
||||||
sateData.data.value?.showZgtAnnotate = null;
|
onPressed: () => easyThrottle(
|
||||||
if (sateData.data.value != null) {
|
'REVOKE_THE_LAST_ANNOTATION_AND_SUBMIT',
|
||||||
sateData.data.update((_) => logic.submit(Get.context ?? context));
|
() {
|
||||||
}
|
Navigator.pop(context1, true);
|
||||||
},
|
sateData.data.value?.zgtAnnotate = null;
|
||||||
),
|
sateData.data.value?.showZgtAnnotate = null;
|
||||||
)
|
if (sateData.data.value != null) {
|
||||||
]);
|
sateData.data.update(
|
||||||
|
(_) => logic.submit(Get.context ?? context));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -462,6 +539,7 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
|
|
||||||
// 处理单个触摸点按下的逻辑
|
// 处理单个触摸点按下的逻辑
|
||||||
_activePointers = _activePointers + 1;
|
_activePointers = _activePointers + 1;
|
||||||
|
|
||||||
/// 解决多指截屏问题后 无法进入手指抬起回调导致无法再次进行批注
|
/// 解决多指截屏问题后 无法进入手指抬起回调导致无法再次进行批注
|
||||||
toTimer(vnHandWritings);
|
toTimer(vnHandWritings);
|
||||||
sateData.panQuestView = true;
|
sateData.panQuestView = true;
|
||||||
|
|
@ -489,13 +567,17 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
Offset localPosition = event.localPosition; // 相对
|
Offset localPosition = event.localPosition; // 相对
|
||||||
var zoomFile = zoomState.zoomFile.value!;
|
var zoomFile = zoomState.zoomFile.value!;
|
||||||
// var imageHeightOffsetStart = zoomFile.imageHeightOffsetStart??0;
|
// var imageHeightOffsetStart = zoomFile.imageHeightOffsetStart??0;
|
||||||
var imageHeightOffsetStart = zoomState.zoomFile.value!.getZoomFileOffsetStart(zoomState.initScale.value ?? 1);
|
var imageHeightOffsetStart = zoomState.zoomFile.value!
|
||||||
|
.getZoomFileOffsetStart(zoomState.initScale.value ?? 1);
|
||||||
// print("位置:$localPosition; 图片所在位置:$imageHeightOffsetStart");
|
// print("位置:$localPosition; 图片所在位置:$imageHeightOffsetStart");
|
||||||
if (imageHeightOffsetStart == 0) return;
|
if (imageHeightOffsetStart == 0) return;
|
||||||
|
|
||||||
var dy = localPosition.dy;
|
var dy = localPosition.dy;
|
||||||
// print(zoomFile.getZoomFileHeightOffsetEnd(zoomState.initScale.value ?? 1));
|
// print(zoomFile.getZoomFileHeightOffsetEnd(zoomState.initScale.value ?? 1));
|
||||||
if (dy < imageHeightOffsetStart || dy > zoomFile.getZoomFileHeightOffsetEnd(zoomState.initScale.value ?? 1)) return; // 检查笔记是否超出图片范围
|
if (dy < imageHeightOffsetStart ||
|
||||||
|
dy >
|
||||||
|
zoomFile.getZoomFileHeightOffsetEnd(
|
||||||
|
zoomState.initScale.value ?? 1)) return; // 检查笔记是否超出图片范围
|
||||||
|
|
||||||
var theScale = zoomState.initScale.value ?? 1;
|
var theScale = zoomState.initScale.value ?? 1;
|
||||||
// if (theScale != 1) {
|
// if (theScale != 1) {
|
||||||
|
|
@ -516,21 +598,40 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
// }
|
// }
|
||||||
// (dy / theScale) - (max(0, imageHeightOffsetStart) / theScale) + ((sateData.zoomOffset?.dy.abs() ?? 0) / theScale),
|
// (dy / theScale) - (max(0, imageHeightOffsetStart) / theScale) + ((sateData.zoomOffset?.dy.abs() ?? 0) / theScale),
|
||||||
|
|
||||||
var zoomWtdthSpaceVal = zoomFile.getZoomFileOffsetStartWidth(zoomState.initScale.value ?? 1);
|
var zoomWtdthSpaceVal = zoomFile
|
||||||
|
.getZoomFileOffsetStartWidth(zoomState.initScale.value ?? 1);
|
||||||
|
|
||||||
localPosition = Offset(
|
localPosition = Offset(
|
||||||
(localPosition.dx - zoomFile.getZoomFileOffsetStartWidth(zoomState.initScale.value ?? 1) + ((zoomWtdthSpaceVal <= 0.1) ? (sateData.zoomOffset?.dx.abs() ?? 0) : 0)) / theScale,
|
(localPosition.dx -
|
||||||
(dy - max(0, imageHeightOffsetStart) + ((zoomFile.imageHeightOffsetStart == null || zoomFile.imageHeightOffsetStart! <= 0.1) ? (sateData.zoomOffset?.dy.abs() ?? 0) : 0)) / theScale,
|
zoomFile.getZoomFileOffsetStartWidth(
|
||||||
|
zoomState.initScale.value ?? 1) +
|
||||||
|
((zoomWtdthSpaceVal <= 0.1)
|
||||||
|
? (sateData.zoomOffset?.dx.abs() ?? 0)
|
||||||
|
: 0)) /
|
||||||
|
theScale,
|
||||||
|
(dy -
|
||||||
|
max(0, imageHeightOffsetStart) +
|
||||||
|
((zoomFile.imageHeightOffsetStart == null ||
|
||||||
|
zoomFile.imageHeightOffsetStart! <= 0.1)
|
||||||
|
? (sateData.zoomOffset?.dy.abs() ?? 0)
|
||||||
|
: 0)) /
|
||||||
|
theScale,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// 判断当前点和上一个点的距离 判断是否是多指
|
/// 判断当前点和上一个点的距离 判断是否是多指
|
||||||
var lastDrop = getLastDrop(vnHandWritings.value, vnHandWritings.value.length-1);
|
if (Platform.isAndroid) {
|
||||||
if (lastDrop != null && ((lastDrop.dx - localPosition.dx).abs() > 65 || (lastDrop.dy - localPosition.dy).abs() > 65)) {
|
var lastDrop = getLastDrop(
|
||||||
/// 当前X点和上一个x点相差 大于10判定为多个手指
|
vnHandWritings.value, vnHandWritings.value.length - 1);
|
||||||
return;
|
if (lastDrop != null &&
|
||||||
|
((lastDrop.dx - localPosition.dx).abs() > 65 ||
|
||||||
|
(lastDrop.dy - localPosition.dy).abs() > 65)) {
|
||||||
|
/// 当前X点和上一个x点相差 大于10判定为多个手指
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// print("最终位置 : $localPosition");
|
// print("最终位置 : $localPosition");
|
||||||
vnHandWritings.value = List.from(vnHandWritings.value)..add(localPosition);
|
vnHandWritings.value = List.from(vnHandWritings.value)
|
||||||
|
..add(localPosition);
|
||||||
sateData.handwritings = vnHandWritings.value;
|
sateData.handwritings = vnHandWritings.value;
|
||||||
},
|
},
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
|
|
@ -563,13 +664,15 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
$TheCachedNetworkImage(
|
$TheCachedNetworkImage(
|
||||||
imgWidth: maxWidth,
|
imgWidth: maxWidth,
|
||||||
imageUrl: sateData.data.value!.zgtAnswer,
|
imageUrl: sateData.data.value!.zgtAnswer,
|
||||||
(_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth),
|
(_, imageProvider) =>
|
||||||
|
Image(image: imageProvider, fit: BoxFit.fitWidth),
|
||||||
),
|
),
|
||||||
RepaintBoundary(
|
RepaintBoundary(
|
||||||
key: logic.pictureOverviewKey,
|
key: logic.pictureOverviewKey,
|
||||||
child: CustomPaint(
|
child: CustomPaint(
|
||||||
// isComplex: true,
|
// isComplex: true,
|
||||||
size: Size(maxWidth, zoomState.zoomFile.value!.actualHeight!),
|
size: Size(
|
||||||
|
maxWidth, zoomState.zoomFile.value!.actualHeight!),
|
||||||
foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
|
foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
|
||||||
// child: $TheCachedNetworkImage(
|
// child: $TheCachedNetworkImage(
|
||||||
// imgWidth: maxWidth,
|
// imgWidth: maxWidth,
|
||||||
|
|
@ -577,7 +680,13 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
||||||
// (_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth),
|
// (_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth),
|
||||||
|
|
||||||
// ),
|
// ),
|
||||||
child: showZgtAnnotate != null ? $TheCachedNetworkImage(imgWidth: maxWidth, imageUrl: showZgtAnnotate, (_, imageProvider) => Image(image: imageProvider, fit: BoxFit.fitWidth)) : null,
|
child: showZgtAnnotate != null
|
||||||
|
? $TheCachedNetworkImage(
|
||||||
|
imgWidth: maxWidth,
|
||||||
|
imageUrl: showZgtAnnotate,
|
||||||
|
(_, imageProvider) => Image(
|
||||||
|
image: imageProvider, fit: BoxFit.fitWidth))
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -606,7 +715,8 @@ class DrawingPainter extends CustomPainter {
|
||||||
for (int i = 0; i < pointsLength; i++) {
|
for (int i = 0; i < pointsLength; i++) {
|
||||||
Offset? offsetData = points[i];
|
Offset? offsetData = points[i];
|
||||||
Offset? nextOffsetData = pointsLength - 1 == i ? null : points[i + 1];
|
Offset? nextOffsetData = pointsLength - 1 == i ? null : points[i + 1];
|
||||||
if (offsetData != null && nextOffsetData != null) canvas.drawLine(offsetData, nextOffsetData, paintBrush);
|
if (offsetData != null && nextOffsetData != null)
|
||||||
|
canvas.drawLine(offsetData, nextOffsetData, paintBrush);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue