mcy_new #1

Merged
wangyang merged 179 commits from mcy_new into master 2025-08-28 10:10:45 +08:00
1 changed files with 67 additions and 22 deletions
Showing only changes of commit a4dd67ddfa - Show all commits

View File

@ -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(
(context, imageProvider) {
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
imageStream?.removeListener(imageStreamListener);
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener);
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.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',
return imageWidget;
},
imageUrl: RequestConfig.imgUrl + imageUrl,
),
),
),
),
),
);
}),
),
);
}
//
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;
}