no message
This commit is contained in:
parent
19c59b0bde
commit
a4dd67ddfa
|
|
@ -59,8 +59,8 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
|||
heroTag: '点击前往上一题',
|
||||
tooltip: '点击前往上一题',
|
||||
focusColor: Theme.of(context).primaryColor,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1),
|
||||
elevation: 6.r,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
||||
elevation: 10.r,
|
||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
||||
var param = sateData.param.value;
|
||||
param.studentId = lastPageVal.studentId;
|
||||
|
|
@ -82,8 +82,8 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
|||
return FloatingActionButton(
|
||||
heroTag: '点击前往下一题',
|
||||
tooltip: '点击前往下一题',
|
||||
elevation: 6.r,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1),
|
||||
elevation: 10.r,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
||||
var param = sateData.param.value;
|
||||
param.studentId = nextPageVal.studentId;
|
||||
|
|
@ -279,9 +279,9 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
|
|||
@hwidget
|
||||
Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState sateData) {
|
||||
final scrollControllerQuestion = useScrollController(); // 试题图片区域
|
||||
var vnHandWritings = useValueNotifier<List<dynamic>>([]);
|
||||
ImageStream? imageStream;
|
||||
|
||||
ImageStreamListener imageStreamListener = ImageStreamListener((ImageInfo info, bool _) {
|
||||
var imageStreamListener = useState<ImageStreamListener>(ImageStreamListener((ImageInfo info, bool _) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
sateData.imageScale.value = TestQuestionsImageInfo(
|
||||
boxWidth: maxWidth,
|
||||
|
|
@ -291,7 +291,7 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
|
|||
url: sateData.data.value!.zgtAnswer,
|
||||
);
|
||||
});
|
||||
});
|
||||
}));
|
||||
|
||||
// 可选:添加滚动监听
|
||||
useEffect(() {
|
||||
|
|
@ -301,10 +301,11 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
|
|||
});
|
||||
// 返回一个清理函数,在组件销毁时移除监听
|
||||
return () {
|
||||
imageStream?.removeListener(imageStreamListener);
|
||||
imageStream?.removeListener(imageStreamListener.value);
|
||||
};
|
||||
}, []);
|
||||
|
||||
print('这里是加载了..............');
|
||||
return Container(
|
||||
height: maxHeight,
|
||||
// padding: EdgeInsets.only(bottom: 2.h, top: 2.h),
|
||||
|
|
@ -316,25 +317,69 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
|
|||
scrollDirection: Axis.vertical, // 设置垂直滚动
|
||||
child: Obx(() {
|
||||
var imageUrl = sateData.data.value?.zgtAnswer;
|
||||
print(imageUrl);
|
||||
if (imageUrl == null) return const SizedBox();
|
||||
|
||||
// return Container(
|
||||
// color: Colors.green,
|
||||
// height: 394.45145018915514,
|
||||
// );
|
||||
return $TheCachedNetworkImage(
|
||||
return Container(
|
||||
decoration: BoxDecoration(boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
offset: Offset(-6.r, 1.r), //阴影x轴偏移量
|
||||
blurRadius: 10.r, //阴影模糊程度
|
||||
spreadRadius: 8.r //阴影扩散程度
|
||||
)
|
||||
]),
|
||||
child: Listener(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPointerUp: (PointerUpEvent details) {},
|
||||
onPointerMove: (PointerMoveEvent details) {},
|
||||
child: RepaintBoundary(
|
||||
child: CustomPaint(
|
||||
foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
|
||||
child: RepaintBoundary(
|
||||
child: $TheCachedNetworkImage(
|
||||
(context, imageProvider) {
|
||||
print('图片加载了..............');
|
||||
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
|
||||
imageStream?.removeListener(imageStreamListener);
|
||||
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener);
|
||||
imageStream?.removeListener(imageStreamListener.value);
|
||||
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener.value);
|
||||
|
||||
return imageWidget;
|
||||
},
|
||||
imageUrl: RequestConfig.imgUrl + imageUrl,
|
||||
// imageUrl: 'https://cdn3-banquan.ituchong.com/weili/image/l/2000260200787476490.jpeg',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 批注框
|
||||
class DrawingPainter extends CustomPainter {
|
||||
final ValueNotifier<List<dynamic>> ctrl;
|
||||
final Paint paintBrush = Paint()
|
||||
..color = Colors.red
|
||||
..strokeCap = StrokeCap.round
|
||||
..strokeWidth = 1.5.r;
|
||||
DrawingPainter({required this.ctrl}) : super(repaint: ctrl);
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
var points = ctrl.value;
|
||||
var pointsLength = points.length;
|
||||
// for (int i = 0; i < pointsLength; i++) {
|
||||
// GestureRecording item = points[i];
|
||||
// Offset? offsetData = item.data;
|
||||
// Offset? nextOffsetData = pointsLength - 1 == i ? null : points[i + 1].data;
|
||||
// if (offsetData != null && nextOffsetData != null) {
|
||||
// canvas.drawLine(offsetData, nextOffsetData, paintBrush);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue