no message

This commit is contained in:
1147192855@qq.com 2024-06-14 09:45:36 +08:00
parent 19c59b0bde
commit a4dd67ddfa
1 changed files with 67 additions and 22 deletions

View File

@ -59,8 +59,8 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
heroTag: '点击前往上一题', heroTag: '点击前往上一题',
tooltip: '点击前往上一题', tooltip: '点击前往上一题',
focusColor: Theme.of(context).primaryColor, focusColor: Theme.of(context).primaryColor,
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1), backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
elevation: 6.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;
@ -82,8 +82,8 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
return FloatingActionButton( return FloatingActionButton(
heroTag: '点击前往下一题', heroTag: '点击前往下一题',
tooltip: '点击前往下一题', tooltip: '点击前往下一题',
elevation: 6.r, elevation: 10.r,
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1), backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
onPressed: () => easyThrottle('TestQuestionSwitch', () { onPressed: () => easyThrottle('TestQuestionSwitch', () {
var param = sateData.param.value; var param = sateData.param.value;
param.studentId = nextPageVal.studentId; param.studentId = nextPageVal.studentId;
@ -279,9 +279,9 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
@hwidget @hwidget
Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState sateData) { Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState sateData) {
final scrollControllerQuestion = useScrollController(); // final scrollControllerQuestion = useScrollController(); //
var vnHandWritings = useValueNotifier<List<dynamic>>([]);
ImageStream? imageStream; ImageStream? imageStream;
var imageStreamListener = useState<ImageStreamListener>(ImageStreamListener((ImageInfo info, bool _) {
ImageStreamListener imageStreamListener = ImageStreamListener((ImageInfo info, bool _) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
sateData.imageScale.value = TestQuestionsImageInfo( sateData.imageScale.value = TestQuestionsImageInfo(
boxWidth: maxWidth, boxWidth: maxWidth,
@ -291,7 +291,7 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
url: sateData.data.value!.zgtAnswer, url: sateData.data.value!.zgtAnswer,
); );
}); });
}); }));
// //
useEffect(() { useEffect(() {
@ -301,10 +301,11 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
}); });
// //
return () { return () {
imageStream?.removeListener(imageStreamListener); imageStream?.removeListener(imageStreamListener.value);
}; };
}, []); }, []);
print('这里是加载了..............');
return Container( return Container(
height: maxHeight, height: maxHeight,
// padding: EdgeInsets.only(bottom: 2.h, top: 2.h), // padding: EdgeInsets.only(bottom: 2.h, top: 2.h),
@ -316,25 +317,69 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
scrollDirection: Axis.vertical, // scrollDirection: Axis.vertical, //
child: Obx(() { child: Obx(() {
var imageUrl = sateData.data.value?.zgtAnswer; var imageUrl = sateData.data.value?.zgtAnswer;
print(imageUrl);
if (imageUrl == null) return const SizedBox(); if (imageUrl == null) return const SizedBox();
// return Container( return Container(
// color: Colors.green, decoration: BoxDecoration(boxShadow: [
// height: 394.45145018915514, BoxShadow(
// ); color: Colors.grey.withOpacity(0.2),
return $TheCachedNetworkImage( 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) { (context, imageProvider) {
print('图片加载了..............');
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth); Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
imageStream?.removeListener(imageStreamListener); imageStream?.removeListener(imageStreamListener.value);
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener); imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener.value);
return imageWidget; return imageWidget;
}, },
imageUrl: RequestConfig.imgUrl + imageUrl, 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;
}