diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart index 44aa0a6..0cd67bd 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart @@ -6,7 +6,6 @@ import 'package:get/get.dart'; import 'package:making_school_asignment_app/common/job/marking_models/do_paper_bus.dart'; import 'package:making_school_asignment_app/common/mixins/event_bus_mixin.dart'; import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart'; -import 'package:making_school_asignment_app/common/utils/utils.dart'; import '../configuration_files/index.dart'; @@ -33,7 +32,7 @@ class _BottomAnnotationSwitchJobState extends State lowerBound: 0, upperBound: 1, duration: const Duration(milliseconds: 300), - )..addListener(toUp); + ); _opControllisten = _logicControl.opControl.listen((e) { if (e) { @@ -48,170 +47,174 @@ class _BottomAnnotationSwitchJobState extends State @override void dispose() { - _animationController - ..removeListener(toUp) - ..dispose(); + _animationController.dispose(); _opControllisten?.cancel(); eventCancel(); super.dispose(); } - void toUp() => toUpState(setState, () {}, mounted); - @override Widget build(BuildContext context) { - return SafeArea( - left: false, - right: false, - top: false, - child: Container( - width: double.infinity, - height: _animationController.value * 70.h, - decoration: BoxDecoration( - color: const Color.fromRGBO(83, 83, 83, 1), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.1), - blurRadius: 8, - offset: const Offset(0, -2), - ), - ], - ), - child: Row( + final Widget barContent = Row( + children: [ + Expanded( + flex: 7, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( - flex: 7, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: Row( children: [ + // 全对按钮 Expanded( - child: Row( - children: [ - // 全对按钮 - Expanded( - child: _buildActionButton( - '全对', - Icons.check_circle_outline, - () => easyThrottle('homework_bottom_operation_bar_scoring_related', - () => _homeworkLogic.allPairs(context)), - isEnabled: !_homeworkLogic.state.submitLoading.value, - isPrimary: true, - ), - ), - Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), - // 注解笔 - Expanded( - child: Obx(() => _buildIconButton( - const IconData(0xe635, fontFamily: "AlibabaIcon"), - () => easyThrottle('homework_bottom_action_bar_annotations', () { - // 互斥:启用注解笔,禁用滑动 - _logicControl.gestureMove.value = false; - _logicControl.pen.value = true; - }), - isActive: _logicControl.pen.value, - tooltip: '注解笔', - )), - ), - Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), - // 滑动试题 - Expanded( - child: Obx(() => _buildIconButton( - const IconData(0xe636, fontFamily: "AlibabaIcon"), - () => easyThrottle('homework_bottom_action_bar_annotations', () { - // 互斥:启用滑动,禁用注解笔 - _logicControl.pen.value = false; - _logicControl.gestureMove.value = true; - }), - isActive: _logicControl.gestureMove.value, - tooltip: '滑动试题', - )), - ), - ], + child: _buildActionButton( + '全对', + Icons.check_circle_outline, + () => easyThrottle( + 'homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allPairs(context)), + isEnabled: !_homeworkLogic.state.submitLoading.value, + isPrimary: true, ), ), - Container(width: double.infinity, color: Colors.white.withOpacity(0.3), height: 0.5.h), + Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), + // 注解笔 Expanded( - child: Row( - children: [ - // 全错按钮 - Expanded( - child: _buildActionButton( - '全错', - Icons.cancel_outlined, - () => easyThrottle('homework_bottom_operation_bar_scoring_related', - () => _homeworkLogic.allWrongRating(context)), - isEnabled: !_homeworkLogic.state.submitLoading.value, - isPrimary: false, - ), - ), - Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), - // 撤销上一步 - Expanded( - child: _buildIconButton( - const IconData(0xe638, fontFamily: "AlibabaIcon"), - () => easyThrottle( - 'homework_bottom_action_bar_annotations', - () => eventFire(model: BottomOperationBar(revokeAll: false, revokePreStep: true)), - ), - tooltip: '撤销上一步', - ), - ), - Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), - // 全部撤销 - Expanded( - child: _buildIconButton( - const IconData(0xe637, fontFamily: "AlibabaIcon"), - () => easyThrottle( - 'homework_bottom_action_bar_annotations', - () => eventFire(model: BottomOperationBar(revokeAll: true, revokePreStep: false)), - ), - tooltip: '全部撤销', - ), - ), - ], + child: Obx(() => _buildIconButton( + const IconData(0xe635, fontFamily: "AlibabaIcon"), + () => easyThrottle('homework_bottom_action_bar_annotations', () { + // 互斥:启用注解笔,禁用滑动 + _logicControl.gestureMove.value = false; + _logicControl.pen.value = true; + }), + isActive: _logicControl.pen.value, + tooltip: '注解笔', + )), + ), + Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), + // 滑动试题 + Expanded( + child: Obx(() => _buildIconButton( + const IconData(0xe636, fontFamily: "AlibabaIcon"), + () => easyThrottle('homework_bottom_action_bar_annotations', () { + // 互斥:启用滑动,禁用注解笔 + _logicControl.pen.value = false; + _logicControl.gestureMove.value = true; + }), + isActive: _logicControl.gestureMove.value, + tooltip: '滑动试题', + )), + ), + ], + ), + ), + Container(width: double.infinity, color: Colors.white.withOpacity(0.3), height: 0.5.h), + Expanded( + child: Row( + children: [ + // 全错按钮 + Expanded( + child: _buildActionButton( + '全错', + Icons.cancel_outlined, + () => easyThrottle('homework_bottom_operation_bar_scoring_related', + () => _homeworkLogic.allWrongRating(context)), + isEnabled: !_homeworkLogic.state.submitLoading.value, + isPrimary: false, + ), + ), + Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), + // 撤销上一步 + Expanded( + child: _buildIconButton( + const IconData(0xe638, fontFamily: "AlibabaIcon"), + () => easyThrottle( + 'homework_bottom_action_bar_annotations', + () => eventFire(model: BottomOperationBar(revokeAll: false, revokePreStep: true)), + ), + tooltip: '撤销上一步', + ), + ), + Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), + // 全部撤销 + Expanded( + child: _buildIconButton( + const IconData(0xe637, fontFamily: "AlibabaIcon"), + () => easyThrottle( + 'homework_bottom_action_bar_annotations', + () => eventFire(model: BottomOperationBar(revokeAll: true, revokePreStep: false)), + ), + tooltip: '全部撤销', ), ), ], ), ), + ], + ), + ), + Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), + Expanded( + flex: 3, + child: Row( + children: [ + Expanded( + child: _buildActionButton( + '取消', + Icons.clear, + () => easyThrottle( + 'homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.cancelAllRatings()), + isEnabled: true, + isPrimary: false, + isSecondary: true, + ), + ), Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), Expanded( - flex: 3, - child: Row( - children: [ - Expanded( - child: _buildActionButton( - '取消', - Icons.clear, - () => easyThrottle( - 'homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.cancelAllRatings()), - isEnabled: true, - isPrimary: false, - isSecondary: true, - ), - ), - Container(width: 0.5.w, height: double.infinity, color: Colors.white.withOpacity(0.3)), - Expanded( - child: Obx(() { - final submitLoading = _homeworkLogic.state.submitLoading.value; - return _buildActionButton( - '提交', - Icons.send, - () => easyThrottle( - 'homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.submit(context)), - isEnabled: !submitLoading, - isPrimary: true, - isLoading: submitLoading, - ); - }), - ), - ], - ), + child: Obx(() { + final submitLoading = _homeworkLogic.state.submitLoading.value; + return _buildActionButton( + '提交', + Icons.send, + () => easyThrottle( + 'homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.submit(context)), + isEnabled: !submitLoading, + isPrimary: true, + isLoading: submitLoading, + ); + }), ), ], ), - )); + ), + ], + ); + + return SafeArea( + left: false, + right: false, + top: false, + child: AnimatedBuilder( + animation: _animationController, + builder: (context, _) { + return Container( + width: double.infinity, + height: _animationController.value * 70.h, + decoration: BoxDecoration( + color: const Color.fromRGBO(83, 83, 83, 1), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.1), + blurRadius: 8, + offset: const Offset(0, -2), + ), + ], + ), + child: barContent, + ); + }, + ), + ); } Widget _buildActionButton( diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_number_view.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_number_view.dart index ec0106d..f0d3a20 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_number_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_number_view.dart @@ -135,28 +135,22 @@ Widget $questionNumberScrollView({ // 移除高频日志,避免在滚动/缩放时造成不必要的 I/O 开销 - return SingleChildScrollView( + return ListView.builder( controller: scrollControllerNum, physics: const BouncingScrollPhysics(), padding: EdgeInsets.only(top: usePiddingTop.value > 0 ? usePiddingTop.value : 0), - scrollDirection: Axis.vertical, // 设置垂直滚动 - child: SizedBox( - height: (actualImgHeight.value ?? 0) * useZoom.value, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: studentQuestions - .map((e) => $ScoringQuestionsView( - key: Key('${sateData.data.value?.templateId}_${sateData.data.value?.studentId}_${e.questionNo}'), - sateData: sateData, - item: e, - logic: controller, - scaleRatio: sateZoomData.zoomFile.value!.scaleRatio, - initScale: useZoom.value, - )) - .toList(), - ), - ), + itemCount: studentQuestions.length, + itemBuilder: (context, index) { + final e = studentQuestions[index]; + return $ScoringQuestionsView( + key: Key('${sateData.data.value?.templateId}_${sateData.data.value?.studentId}_${e.questionNo}'), + sateData: sateData, + item: e, + logic: controller, + scaleRatio: sateZoomData.zoomFile.value!.scaleRatio, + initScale: useZoom.value, + ); + }, ); }