Compare commits

...

2 Commits

Author SHA1 Message Date
DESKTOP-I3JPKHK\wy 4a03e92468 Merge branch 'mcy_new' of https://gitea.23544.com/marking/Making.School.Asignment.app into mcy_new 2025-04-24 15:11:21 +08:00
DESKTOP-I3JPKHK\wy a35f8f5572 111 2025-04-24 15:11:12 +08:00
1 changed files with 14 additions and 4 deletions

View File

@ -61,7 +61,9 @@ Widget $questionNumberScrollView({
usePiddingTop.value = sateZoomData.zoomFile.value?.imageHeightOffsetStart ?? 0;
});
useEffect(() {
var studentQuestionsStream = sateData.studentQuestions.listen((e) => studentQuestions.value = e ?? []);
var studentQuestionsStream = sateData.studentQuestions.listen((e) {
studentQuestions.value = e ?? [];
});
var stream = sateZoomData.initScale.listen((e) {
// print("initScale : $e");
@ -155,9 +157,9 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
///
studentScoreListener() {
item.studentScore = studentScore.value;
var theVal = sateData.studentQuestions.value?.firstWhereOrNull((e)=>e.questionNo==e.questionNo);
if(theVal!=null) theVal.studentScore = studentScore.value;
var theVal = sateData.studentQuestions.value?.firstWhereOrNull((e) => e.questionNo == e.questionNo);
if (theVal != null) theVal.studentScore = studentScore.value;
var studentQuestions = sateData.studentQuestions.value;
if (item.studentScore == null) return;
@ -171,7 +173,15 @@ Widget $scoringQuestionsView(BuildContext context, HomeworkReviewState sateData,
studentScore.addListener(studentScoreListener);
var studentQuestionsStream = sateData.studentQuestions.listen((e) {
var itemVal = (e ?? []).firstWhereOrNull((e1) => e1.questionNo == item.questionNo);
if (itemVal != null && studentScore.value != itemVal.studentScore) {
studentScore.value = itemVal.studentScore;
}
});
return () {
studentQuestionsStream.cancel();
studentScore.removeListener(studentScoreListener);
};
}, []);