Compare commits

..

No commits in common. "3666bea6bde2f01834eb57f98225e2892be813e3" and "23bd9501ffbf5e141fb44cdf6e96ccfe95be24d9" have entirely different histories.

6 changed files with 218 additions and 322 deletions

View File

@ -21,7 +21,12 @@ class TrajectoryView extends StatefulHookConsumerWidget {
final double boxHeight;
final String questionNumber;
final JobNoteTakingTrajectory trajectory;
const TrajectoryView({required this.trajectory, required this.questionNumber, required this.boxHeight, required this.boxWidth, super.key});
const TrajectoryView(
{required this.trajectory,
required this.questionNumber,
required this.boxHeight,
required this.boxWidth,
super.key});
@override
TrajectoryViewState createState() => TrajectoryViewState();
@ -147,11 +152,15 @@ class TrajectoryViewState extends ConsumerState<TrajectoryView> {
///
trajectorys
..add(GestureRecording(data: Offset(2.w, trajectory.pictureQuestionTop), scopeBox: true, annotationSwitch: false, eraser: false))
..add(GestureRecording(
data: Offset(2.w, trajectory.pictureQuestionTop), scopeBox: true, annotationSwitch: false, eraser: false))
///
..add(GestureRecording(
data: Offset(imagInfoModel!.scaleWidth! - 4.w, trajectory.pictureQuestionTop), scopeBox: true, annotationSwitch: false, eraser: false))
data: Offset(imagInfoModel!.scaleWidth! - 4.w, trajectory.pictureQuestionTop),
scopeBox: true,
annotationSwitch: false,
eraser: false))
///
..add(GestureRecording(
@ -162,7 +171,8 @@ class TrajectoryViewState extends ConsumerState<TrajectoryView> {
///
..add(GestureRecording(
data: Offset(imagInfoModel!.scaleWidth! - 4.w, trajectory.pictureQuestionTop + trajectory.pictureQuestionHeight),
data: Offset(
imagInfoModel!.scaleWidth! - 4.w, trajectory.pictureQuestionTop + trajectory.pictureQuestionHeight),
scopeBox: true,
annotationSwitch: false,
eraser: false));
@ -171,19 +181,12 @@ class TrajectoryViewState extends ConsumerState<TrajectoryView> {
ref.read(jobDrawingTrajectoryProvider.notifier).setVal(trajectorys);
});
if (lattices.isNotEmpty) {
// Map<int, List<Lattices>> map = new Map.fromIterable(lattices,
// key: (key) => key.stroke,
// value: (value) {
// return lattices.where((item) => item.stroke == value.stroke).toList()
// ..sort((a, b) => a.time.compareTo(b.time));
// });
var map = Map<int, List<Lattices>>();
for (var i = 0; i < lattices.length; i++) {
Lattices item = lattices[i];
if (!map.containsKey(item.stroke)) map[item.stroke] = [];
map[item.stroke]!.add(item); //
}
Map<int, List<Lattices>> map = new Map.fromIterable(lattices,
key: (key) => key.stroke,
value: (value) {
return lattices.where((item) => item.stroke == value.stroke).toList()
..sort((a, b) => a.time.compareTo(b.time));
});
List<int> keys = map.keys.toList();
for (var i = 0; i < keys.length; i++) {
@ -196,7 +199,8 @@ class TrajectoryViewState extends ConsumerState<TrajectoryView> {
double theX = e.x * imagInfoModel!.scale!;
double theY = e.y * imagInfoModel!.scale! + spacingHeight;
return GestureRecording(eraser: false, data: Offset(theX, theY), usageTime: e.time.toInt(), annotationSwitch: false);
return GestureRecording(
eraser: false, data: Offset(theX, theY), usageTime: e.time.toInt(), annotationSwitch: false);
}).toList()
..add(GestureRecording(eraser: false, annotationSwitch: false));
//
@ -226,7 +230,8 @@ class TrajectoryViewState extends ConsumerState<TrajectoryView> {
if (duration2 == null && nextStrokesData != null) {
//
Lattices minLattices = nextStrokesData.reduce((e1, e2) => e1.time < e2.time ? e1 : e2);
differenceInMilliseconds = (Duration(milliseconds: minLattices.time.toInt()) - duration1).inMilliseconds;
differenceInMilliseconds =
(Duration(milliseconds: minLattices.time.toInt()) - duration1).inMilliseconds;
await Future.delayed(Duration(milliseconds: differenceInMilliseconds)); //
}
};

View File

@ -366,55 +366,37 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
Expanded(flex: 1, child: SizedBox()),
Expanded(
flex: 4,
child: Stack(
children: [
Container(
padding: EdgeInsets.only(left: 10.w),
decoration: BoxDecoration(
color: Color.fromRGBO(244, 244, 244, 1),
borderRadius: BorderRadius.circular(4.r),
),
child: DropdownButton(
onTap: () {
//
_useSwitchStudentAndType.getDataForStudents(taskId: taskId);
},
padding: EdgeInsets.only(right: 4.w),
icon: Icon(Icons.keyboard_arrow_down_rounded),
value: _useSwitchStudentAndType.currentStudent.value?.studentId,
underline: Container(),
isExpanded: true,
items: _useSwitchStudentAndType.studentData.value.map((e) {
return DropdownMenuItem(
child: quickText(e.studentName, color: Color.fromRGBO(79, 79, 79, 1), size: 14.sp),
value: e.studentId,
);
}).toList(),
hint: Text('请选择学生'), //
onChanged: (value) {
JobConcernedWithStudent? currentStudent = _useSwitchStudentAndType.currentStudent.value;
if (currentStudent?.studentId == value) return;
_useSwitchStudentAndType.studentBusInfo.value = null; // BUS通知记录
_useSwitchStudentAndType.currentStudent.value =
_useSwitchStudentAndType.studentData.value.firstWhereOrNull((element) => element.studentId == value);
},
),
),
Positioned(
left: 2.w,
child: Stack(
alignment: const FractionalOffset(0.52, 0.24),
children: [
Icon(
const IconData(0xe63d, fontFamily: "AlibabaIcon"),
size: 12.sp,
color: _useSwitchStudentAndType.isFirst.value ? Color.fromRGBO(76, 199, 147, 1) : Color.fromRGBO(164, 164, 164, 1),
),
quickText('优先', size: 4.sp, color: Colors.white),
],
),
),
],
child: Container(
padding: EdgeInsets.only(left: 10.w),
decoration: BoxDecoration(
color: Color.fromRGBO(244, 244, 244, 1),
borderRadius: BorderRadius.circular(4.r),
),
child: DropdownButton(
onTap: () {
//
_useSwitchStudentAndType.getDataForStudents(taskId: taskId);
},
padding: EdgeInsets.only(right: 4.w),
icon: Icon(Icons.keyboard_arrow_down_rounded),
value: _useSwitchStudentAndType.currentStudent.value?.studentId,
underline: Container(),
isExpanded: true,
items: _useSwitchStudentAndType.studentData.value.map((e) {
return DropdownMenuItem(
child: quickText(e.studentName, color: Color.fromRGBO(79, 79, 79, 1), size: 14.sp),
value: e.studentId,
);
}).toList(),
hint: Text('请选择学生'), //
onChanged: (value) {
JobConcernedWithStudent? currentStudent = _useSwitchStudentAndType.currentStudent.value;
if (currentStudent?.studentId == value) return;
_useSwitchStudentAndType.studentBusInfo.value = null; // BUS通知记录
_useSwitchStudentAndType.currentStudent.value =
_useSwitchStudentAndType.studentData.value.firstWhereOrNull((element) => element.studentId == value);
},
),
),
),
Expanded(flex: 1, child: SizedBox()),
@ -476,6 +458,17 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
),
),
),
Stack(
alignment: const FractionalOffset(0.52, 0.24),
children: [
Icon(
const IconData(0xe63d, fontFamily: "AlibabaIcon"),
size: 12.sp,
color: _useSwitchStudentAndType.isFirst.value ? Color.fromRGBO(76, 199, 147, 1) : Color.fromRGBO(164, 164, 164, 1),
),
quickText('优先', size: 4.sp, color: Colors.white),
],
),
],
),
),

View File

@ -9,6 +9,7 @@ import 'package:marking_app/components/ReturnToHomepage.dart';
import 'package:marking_app/pages/homework_correction/widget/student_kg_table.dart';
import 'package:marking_app/pages/homework_correction/widget/student_zg_table.dart';
import 'package:marking_app/routes/RouterManager.dart';
import 'package:marking_app/utils/common_utils.dart';
import 'package:marking_app/utils/request/rest_client.dart';
import 'package:marking_app/utils/toast_utils.dart';
@ -178,11 +179,6 @@ class _QuickCheckPersonalState extends ConsumerState<QuickCheckPersonal> with Co
child: StudentKgTable(
headList: ['题号', '学生答案', '标准答案'],
bodyList: studentInfo!.kgDetails,
questionNumCall: (no) {
showAnswerHandwriting(context, jobId: widget.jobId, studentId: widget.studentId, questionNo: int.parse(no)).then((value) {
ref.read(jobHandwritingDrawingTrajectoryProvider.notifier).setVal([]);
});
},
),
)
],
@ -226,11 +222,6 @@ class _QuickCheckPersonalState extends ConsumerState<QuickCheckPersonal> with Co
child: StudentZgTable(
headList: ['题号', '用时', '学生答案', '批注结果', '批注'],
bodyList: studentInfo!.zgDetails,
questionNumCall: (no) {
showAnswerHandwriting(context, jobId: widget.jobId, studentId: widget.studentId, questionNo: int.parse(no)).then((value) {
ref.read(jobHandwritingDrawingTrajectoryProvider.notifier).setVal([]);
});
},
),
)
],

View File

@ -1,6 +1,5 @@
import 'dart:async';
import 'package:json_annotation/json_annotation.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
@ -49,14 +48,13 @@ class AnswerHandwriting extends Dialog {
}
}
Future<void> showAnswerHandwriting(BuildContext context, {required int jobId, required int studentId, int? pageNum, int? questionNo}) async {
Future<void> showAnswerHandwriting(BuildContext context, {required int jobId, required int studentId, int? pageNum}) async {
return showDialog(
context: context,
builder: (BuildContext context) => AnswerHandwriting(
jobId: jobId,
studentId: studentId,
pageNum: pageNum,
questionNo: questionNo,
closeCall: () => Navigator.of(context).pop(),
),
);
@ -96,10 +94,7 @@ class AnswerHandwritingMainBox extends HookWidget {
});
useValueChanged<int?, void>(_useStateModel.pageNum.value, (oldVal, __) {
if (oldVal != null && oldVal != _useStateModel.pageNum.value) {
_useStateModel.questionNo = null;
_useStateModel.getData().catchError((e) => closeCall());
}
if (oldVal != null && oldVal != _useStateModel.pageNum.value) _useStateModel.getData().catchError((e) => closeCall());
});
useEffect(() {
@ -111,6 +106,7 @@ class AnswerHandwritingMainBox extends HookWidget {
HandwritingInfo? _dataDetail = _useStateModel.handwritingDetail.value;
if (_data == null || _dataDetail == null) return Container();
print('数据长度:${_data.lattices.length}');
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
@ -138,7 +134,7 @@ class AnswerHandwritingMainBox extends HookWidget {
),
],
),
$BottomPlaybar(_dataDetail.timeConsuming, _dataDetail.pauseCount, _dataDetail.pauseInterval),
$BottomPlaybar(_dataDetail.timeConsuming, _dataDetail.pauseCount),
],
);
}
@ -147,7 +143,7 @@ class AnswerHandwritingMainBox extends HookWidget {
class UseMainBoxState with CommonMixin {
final int jobId;
final int studentId;
int? questionNo;
final int? questionNo;
final ValueNotifier<int?> pageNum;
final ValueNotifier<int> pageCount;
final ValueNotifier<JobHandwriting?> handwritingData;
@ -227,6 +223,7 @@ class UseMainBoxState with CommonMixin {
lattices[item.stroke]!.add(item); //
}
print('分组时间:${DateTime.now().millisecondsSinceEpoch}');
List<int> latticeKeys = lattices.keys.toList();
int timeConsuming = 0;
if (latticeKeys.isNotEmpty) {
@ -245,8 +242,8 @@ class UseMainBoxState with CommonMixin {
}
timeConsuming = lastTime - firstTime;
}
print('获取数据总时间:${DateTime.now().millisecondsSinceEpoch}');
var pauseCount = 0; //
List<PauseIntervalTime> pauseInterval = [];
for (var i = 0; i < latticeKeys.length; i++) {
var currentLattices = lattices[latticeKeys[i]]!; //
var prevLattices = i == 0 ? null : lattices[latticeKeys[i - 1]]!; //
@ -257,38 +254,35 @@ class UseMainBoxState with CommonMixin {
if (j != 0) {
var prevItem = currentLattices[j - 1];
var adjacentSpacingTime = lattice.time - prevItem.time;
intervalTime = adjacentSpacingTime + prevItem.intervalTime;
if (adjacentSpacingTime > 5000) {
// 5
pauseCount++;
pauseInterval.add(PauseIntervalTime(startTime: prevItem.intervalTime, endTime: intervalTime));
}
intervalTime = adjacentSpacingTime + prevItem.intervalTime;
} else {
if (i != 0 && prevLattices != null) {
var prevLatticeLastItem = prevLattices[prevLattices.length - 1];
var adjacentSpacingTime = lattice.time - prevLatticeLastItem.time;
intervalTime = adjacentSpacingTime + prevLatticeLastItem.intervalTime;
if (adjacentSpacingTime > 5000) {
// 5
pauseCount++;
pauseInterval.add(PauseIntervalTime(startTime: prevLatticeLastItem.intervalTime, endTime: intervalTime));
}
intervalTime = adjacentSpacingTime + prevLatticeLastItem.intervalTime;
}
}
lattice.intervalTime = intervalTime;
}
}
return HandwritingInfo(pauseCount, timeConsuming, lattices, pauseInterval);
return HandwritingInfo(pauseCount, timeConsuming, lattices);
}
}
class HandwritingInfo {
int pauseCount; //
List<PauseIntervalTime> pauseInterval;
int timeConsuming; //
Map<int, List<Lattices>> strokeMap; //
HandwritingInfo(this.pauseCount, this.timeConsuming, this.strokeMap, this.pauseInterval);
HandwritingInfo(this.pauseCount, this.timeConsuming, this.strokeMap);
}
//
@ -380,7 +374,6 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
List<Timer> timers = [];
int handwritingTime = 0;
int handwritingDuration = 0;
double speed = 1; //
@override
void initState() {
super.initState();
@ -411,13 +404,6 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
toGoPause();
}
break;
case PlaybackSpeedBus:
//
var _model = (e as PlaybackSpeedBus);
speed = _model.speed;
toGoPause(); //
dragProgressBarInitData(handwritingTime, handwritingDuration);
break;
default:
}
});
@ -470,7 +456,6 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
///
/// @param startTime
Future<void> dragProgressBarInitData(int startTime, int totalDuration) async {
eventFire(model: JobHandwritingPlaybarBus(false));
timers.forEach((e) {
if (e.isActive) e.cancel();
});
@ -489,25 +474,24 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
for (var i = 0; i < _packagedHandwritingDataAll.length; i++) {
var item = _packagedHandwritingDataAll[i];
if (item.intervalTime < startTime) {
if (item.intervalTime <= startTime) {
//
executeImmediately.add(item);
} else {
var intervalTime = item.intervalTime - startTime;
//
waitingExecution.add(GestureHandwritingRecording(
stroke: item.stroke,
data: item.data,
usageTime: item.usageTime,
intervalTime: intervalTime < 0 ? 0 : intervalTime,
intervalTime: item.intervalTime - startTime,
));
}
}
pendingData = waitingExecution;
ref.read(jobHandwritingDrawingTrajectoryProvider.notifier).setVal(executeImmediately);
eventFire(model: JobHandwritingPlaybarBus(true));
}
eventFire(model: JobHandwritingPlaybarBus(true));
}
Future<void> zhixinCall(GestureHandwritingRecording e) async {
@ -534,7 +518,7 @@ class _HandwritingDrawBoxState extends ConsumerState<HandwritingDrawBox> with Ev
if (e.intervalTime == 0) {
zhixinCall(e);
} else {
var ter = Timer(Duration(milliseconds: e.intervalTime ~/ speed), () => zhixinCall(e));
var ter = Timer(Duration(milliseconds: e.intervalTime), () => zhixinCall(e));
timers.add(ter);
}
});
@ -657,7 +641,7 @@ Widget $pageNumberBox(int pageNum) {
}
@hwidget
Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, List<PauseIntervalTime> pauseIntervals) {
Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount) {
var usePlaybar = UseBottomPlaybar.use(timeConsuming);
useValueChanged<int, void>(timeConsuming, (_, __) {
@ -672,9 +656,6 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
//
useValueChanged<PlaybackSpeed, void>(usePlaybar.constantFastSpeed.value, (_, __) {
usePlaybar.eventFire(model: PlaybackSpeedBus(usePlaybar.constantFastSpeed.value.speed));
//
usePlaybar.playTimingSuspend();
usePlaybar.playTimingStarts();
});
//
useValueChanged<int, void>(usePlaybar.useTime.value, (_, __) {
@ -687,6 +668,7 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
useEffect(() {
usePlaybar.eventOn(callback: (e) {
// TODO
switch (e.runtimeType) {
case JobHandwritingPlaybarBus:
//
@ -694,17 +676,23 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
if (_val.play) {
//
usePlaybar.playTimingStarts();
if (!usePlaybar.playPause.value) usePlaybar.playPause.value = true;
if (!usePlaybar.playPause.value) {
usePlaybar.playPause.value = true;
}
} else {
//
usePlaybar.playTimingSuspend();
if (usePlaybar.playPause.value) usePlaybar.playPause.value = false;
if (usePlaybar.playPause.value) {
usePlaybar.playPause.value = false;
}
}
break;
case JobHandwritingGetReadyBus:
//
Future.delayed(Duration.zero, () => (usePlaybar.handWritingReady.value = true));
break;
case PlaybackSpeedBus:
break;
default:
}
});
@ -723,7 +711,7 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
height: 60.h,
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 10.h),
alignment: Alignment.center,
color: Color.fromRGBO(0, 0, 0, 0.4),
color: Color.fromRGBO(0, 0, 0, 0.5),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@ -743,92 +731,55 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
SpinKitPouringHourGlassRefined(size: 40.sp, color: Colors.white),
SizedBox(width: 6.w),
Expanded(
child: LayoutBuilder(
builder: (context, constraints) {
final double containerWidth = constraints.maxWidth; //
// print('总刻度:$timeConsuming,宽度:$containerWidth');
// print('总时长:${pauseIntervals.map((e) => e.toJson()).toList()}');
var unitScale = containerWidth / timeConsuming; //
var pauseIntervalsLength = pauseIntervals.length;
List<Widget> pauseTickMarks = pauseIntervals.asMap().keys.map((e) {
bool isLast = e == pauseIntervalsLength - 1;
bool isFirst = e == 0;
var item = pauseIntervals[e];
return Positioned(
top: 0,
left: unitScale * item.startTime,
child: Container(
width: unitScale * (item.apart ?? 0),
height: 8.h,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: isFirst
? BorderRadius.only(topLeft: Radius.circular(8.r), bottomLeft: Radius.circular(10.r))
: (isLast ? BorderRadius.only(topRight: Radius.circular(8.r), bottomRight: Radius.circular(10.r)) : null),
),
),
);
}).toList();
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
height: 20.h,
// color: Theme.of(context).primaryColor,
child: Slider(
///
value: (usePlaybar.handwritingDuration.value - usePlaybar.useTime.value).toDouble(),
return Column(
mainAxisSize: MainAxisSize.min,
/// 0
min: 0.0,
/// 1
max: usePlaybar.handwritingDuration.value.toDouble(),
// divisions:1,
///
// activeColor: Colors.red,
///
inactiveColor: Color.fromRGBO(217, 217, 217, 1),
/// onChanged null Slider
onChangeEnd: (value) {
usePlaybar.playTimingSuspend(); //
usePlaybar.eventFire(model: JobHandwritingDragProgressBarBus(value.toInt(), usePlaybar.handwritingDuration.value));
usePlaybar.useTime.value = usePlaybar.handwritingDuration.value - value.toInt();
},
onChanged: (double value) {
usePlaybar.useTime.value = usePlaybar.handwritingDuration.value - value.toInt();
},
),
// ///
// onChangeStart: (value) => log('onChangeStart: $value'),
// ///
// onChangeEnd: (value) => log('onChangeEnd: $value'),
),
SizedBox(height: 4.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Stack(
children: [
Container(
height: 8.h,
width: containerWidth,
decoration: BoxDecoration(
// color: Color.fromRGBO(146, 146, 146, 1),
color: Color.fromRGBO(202, 201, 201, 1),
borderRadius: BorderRadius.circular(50.r),
),
),
...pauseTickMarks,
Container(
height: 8.h,
// color: Theme.of(context).primaryColor,
child: SliderTheme(
data: SliderTheme.of(context).copyWith(
trackHeight: 8.h, //
trackShape: RoundedRectSliderTrackShape(), //
activeTrackColor: Theme.of(context).primaryColor, //
inactiveTrackColor: Colors.transparent, //
thumbShape: RoundSliderThumbShape(enabledThumbRadius: 0, disabledThumbRadius: 0),
thumbColor: Colors.white, //
overlayShape: RoundSliderOverlayShape(overlayRadius: 0),
overlayColor: Colors.black54, //
// valueIndicatorShape: PaddleSliderValueIndicatorShape(), //
),
child: Slider(
value: (usePlaybar.handwritingDuration.value - usePlaybar.useTime.value).toDouble(),
min: 0.0,
max: usePlaybar.handwritingDuration.value.toDouble(),
inactiveColor: Colors.transparent,
onChangeEnd: (value) {
usePlaybar.playTimingSuspend(); //
usePlaybar.eventFire(model: JobHandwritingDragProgressBarBus(value.toInt(), usePlaybar.handwritingDuration.value));
usePlaybar.useTime.value = usePlaybar.handwritingDuration.value - value.toInt();
},
onChanged: (double value) {
usePlaybar.useTime.value = usePlaybar.handwritingDuration.value - value.toInt();
},
),
),
),
],
),
SizedBox(height: 4.h),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
quickText('累计停顿:$pauseCount次', color: Colors.white, size: 7.sp),
quickText(convertSeconds(usePlaybar.useTime.value)?.toString() ?? '', color: Colors.white, size: 7.sp),
],
)
quickText('累计停顿:$pauseCount次', color: Colors.white, size: 7.sp),
quickText(convertSeconds(usePlaybar.useTime.value)?.toString() ?? '', color: Colors.white, size: 7.sp),
],
);
},
)
],
),
),
SizedBox(width: 16.w),
@ -847,7 +798,7 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
child: quickText(
'${usePlaybar.constantFastSpeed.value.name}',
color: Color.fromRGBO(79, 114, 244, 1),
size: 8.sp,
size: 10.sp,
align: TextAlign.center,
),
),
@ -857,11 +808,6 @@ Widget $bottomPlaybar(BuildContext context, int timeConsuming, int pauseCount, L
);
}
@swidget
Widget $pauseTickMark() {
return Container();
}
class UseBottomPlaybar with EventBusMixin {
final ValueNotifier<int> handwritingDuration; //
final ValueNotifier<bool> playPause; //
@ -898,8 +844,7 @@ class UseBottomPlaybar with EventBusMixin {
void playTimingStarts() {
if (useTime.value > 0) {
timer.value?.cancel();
timer.value = Timer.periodic(Duration(milliseconds: 1000 ~/ constantFastSpeed.value.speed), (theTime) {
timer.value = Timer.periodic(Duration(seconds: 1), (theTime) {
useTime.value -= 1;
if (useTime.value < 0) {
timer.value?.cancel();
@ -953,26 +898,9 @@ enum PlaybackSpeed {
ORIGINAL_SPEED(name: '原速播放', speed: 1),
ONE_POINT_FIVE_SPEED(name: '1.5x播放', speed: 1.5),
DOUBLE_SPEED(name: '2.0x播放', speed: 2),
TRIPLE_SPEED(name: '3.0x播放', speed: 3),
FOUR_SPEED(name: '4.0x播放', speed: 4),
FIVE_SPEED(name: '5.0x播放', speed: 5),
SIX_SPEED(name: '6.0x播放', speed: 6);
TRIPLE_SPEED(name: '3.0x播放', speed: 3);
const PlaybackSpeed({required this.name, required this.speed});
final double speed;
final String name;
}
@JsonSerializable()
class PauseIntervalTime extends Object {
int? apart;
int startTime;
int endTime;
PauseIntervalTime({required this.startTime, required this.endTime}) {
apart = endTime - startTime;
}
factory PauseIntervalTime.fromJson(Map<String, dynamic> srcJson) => _$PauseIntervalTimeFromJson(srcJson);
Map<String, dynamic> toJson() => _$PauseIntervalTimeToJson(this);
}

View File

@ -8,7 +8,6 @@ class StudentKgTable extends StatefulWidget {
final List bodyList;
final int? fixedRows;
final int? fixedCols;
final Function(String)? questionNumCall;
const StudentKgTable({
Key? key,
@ -16,7 +15,6 @@ class StudentKgTable extends StatefulWidget {
required this.bodyList,
this.fixedCols = 0,
this.fixedRows = 0,
this.questionNumCall,
}) : super(key: key);
@override
@ -31,51 +29,34 @@ class _StudentKgTableState extends State<StudentKgTable> {
String sortString(String str) {
return String.fromCharCodes(str.codeUnits.toList()..sort());
}
DataRow _getRow(int index, [Color? color]) {
assert(index >= 0);
KgDetails item = widget.bodyList[index];
return DataRow2.byIndex(
index: index,
color: color != null ? MaterialStateProperty.all(color) : null,
color: color != null ? MaterialStateProperty.all(color): null,
cells: [
DataCell(
InkWell(
onTap: () {
if (widget.questionNumCall != null) {
widget.questionNumCall!(item.questionNo);
}
},
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.questionNo, style: TextStyle(fontSize: 12.sp, color: Color(0xFF6888FD))),
),
),
),
),
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(
item.studentAnswer == null ? '未作答' : item.studentAnswer!,
style: TextStyle(
fontSize: 12.sp,
color: item.studentAnswer == null
? Color(0xFF525252)
: item.state == 2
? Color(0xFF4CC793)
: item.state == 1
? Color(0xFFFF7474)
: item.state == 0
? Color(0xFFD3D3D3)
: Colors.white),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.questionNo,
style: TextStyle(fontSize: 12.sp, color: Color(0xFF6888FD))),
),
)),
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.studentAnswer == null?'未作答':item.studentAnswer!,
style: TextStyle(fontSize: 12.sp, color: item.studentAnswer == null?Color(0xFF525252):
item.state == 2?Color(0xFF4CC793):
item.state == 1?Color(0xFFFF7474):item.state == 0?Color(0xFFD3D3D3):Colors.white),
),
))),
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.questionAnswer == null ? '' : item.questionAnswer!, style: TextStyle(fontSize: 12.sp, color: Color(0xFF525252))),
child: Text(item.questionAnswer == null ?'':item.questionAnswer!,
style: TextStyle(fontSize: 12.sp, color: Color(0xFF525252))),
),
)),
],
@ -93,10 +74,14 @@ class _StudentKgTableState extends State<StudentKgTable> {
dataRowHeight: 40.r,
headingRowHeight: 40.r,
border: TableBorder(
horizontalInside: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid),
bottom: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid),
verticalInside: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid)),
headingRowColor: MaterialStateProperty.resolveWith((states) => widget.fixedCols! > 0 ? Colors.white : Colors.transparent),
horizontalInside: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid),
bottom: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid),
verticalInside: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid)),
headingRowColor: MaterialStateProperty.resolveWith((states) =>
widget.fixedCols! > 0 ? Colors.white : Colors.transparent),
headingRowDecoration: BoxDecoration(color: Color(0xFFE6E6E6)),
fixedColumnsColor: Color(0xFFE6E6E6),
fixedCornerColor: Colors.grey[400],
@ -110,12 +95,14 @@ class _StudentKgTableState extends State<StudentKgTable> {
var item = widget.headList[index];
return DataColumn2(
label: Center(
child: Text(item, style: TextStyle(fontSize: 12.sp, color: Color(0xFF505767))),
child: Text(item,
style: TextStyle(fontSize: 12.sp, color: Color(0xFF505767))),
),
// size: ColumnSize.S,
fixedWidth: (MediaQuery.of(context).size.width - 20.r - 28.r) / 3,
fixedWidth: (MediaQuery.of(context).size.width - 20.r - 28.r)/3,
);
}),
rows: List<DataRow>.generate(widget.bodyList.length, (index) => _getRow(index, Color(0xFFF5F5F5))));
rows: List<DataRow>.generate(widget.bodyList.length,
(index) => _getRow(index, Color(0xFFF5F5F5))));
}
}

View File

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:marking_app/common/model/job/job_data_report.dart';
import 'package:marking_app/pages/homework_correction/components/imgDialog.dart';
import 'package:marking_app/pages/homework_correction/widget/answer_handwriting.dart';
import 'package:marking_app/utils/common_utils.dart';
import 'package:marking_app/utils/easy_refresh/MyEmptyWidget.dart';
import 'package:photo_view/photo_view.dart';
@ -13,7 +12,6 @@ class StudentZgTable extends StatefulWidget {
final List bodyList;
final int? fixedRows;
final int? fixedCols;
final Function(String)? questionNumCall;
const StudentZgTable({
Key? key,
@ -21,7 +19,6 @@ class StudentZgTable extends StatefulWidget {
required this.bodyList,
this.fixedCols = 0,
this.fixedRows = 0,
this.questionNumCall,
}) : super(key: key);
@override
@ -32,7 +29,7 @@ class _StudentZgTableState extends State<StudentZgTable> {
final ScrollController _controller = ScrollController();
int? _sortColumnIndex;
bool _sortAscending = true;
/*void showImgDialog(BuildContext context,String imgUrl){
Navigator.push(
context,
@ -40,8 +37,8 @@ class _StudentZgTableState extends State<StudentZgTable> {
return Scaffold(
appBar: AppBar(),
body: SizedBox(
*/ /* width: MediaQuery.of(context).size.width * 0.6,
height: MediaQuery.of(context).size.height * 0.6,*/ /*
*//* width: MediaQuery.of(context).size.width * 0.6,
height: MediaQuery.of(context).size.height * 0.6,*//*
child: PhotoView(
imageProvider:
NetworkImage(imgUrl)),
@ -73,68 +70,57 @@ class _StudentZgTableState extends State<StudentZgTable> {
KgDetails item = widget.bodyList[index];
return DataRow2.byIndex(
index: index,
color: color != null ? MaterialStateProperty.all(color) : null,
color: color != null ? MaterialStateProperty.all(color): null,
cells: [
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.questionNo,
style: TextStyle(fontSize: 12.sp, color: Color(0xFF6888FD))),
),
)),
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(CommonUtils.second2HMS(item.useTime!),
style: TextStyle(fontSize: 12.sp, color: Color(0xFF525252))),
),
)),
DataCell(InkWell(
onTap: () {
if (widget.questionNumCall != null) {
widget.questionNumCall!(item.questionNo);
}
onTap: (){
if(item.state != 0){
ImageDialog.showImgDialog(context,item.studentAnswer!);
}
},
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.questionNo, style: TextStyle(fontSize: 12.sp, color: Color(0xFF6888FD))),
child: Text(item.state!=0 ?'查看':'--',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF3661FE))),
),
),
)),
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(CommonUtils.second2HMS(item.useTime!), style: TextStyle(fontSize: 12.sp, color: Color(0xFF525252))),
child: item.state == 2?
Image.asset('assets/images/job_personal_correct_icon.png',width: 18.r,height: 18.r,):item.state == 1?
Image.asset('assets/images/job_personal_error_icon.png',width: 10.r,height: 10.r,):Text('', style: TextStyle(fontSize: 12.sp, color: Color(0xFF525252))),
),
)),
DataCell(InkWell(
onTap: () {
if (item.state != 0) {
ImageDialog.showImgDialog(context, item.studentAnswer!);
onTap: (){
if(item.state==1 || item.state==2){
ImageDialog.showImgDialog(context,item.annotateAnswers!);
}
},
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.state != 0 ? '查看' : '--', style: TextStyle(fontSize: 12.sp, color: Color(0xFF3661FE))),
),
),
)),
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: item.state == 2
? Image.asset(
'assets/images/job_personal_correct_icon.png',
width: 18.r,
height: 18.r,
)
: item.state == 1
? Image.asset(
'assets/images/job_personal_error_icon.png',
width: 10.r,
height: 10.r,
)
: Text('', style: TextStyle(fontSize: 12.sp, color: Color(0xFF525252))),
),
)),
DataCell(InkWell(
onTap: () {
if (item.state == 1 || item.state == 2) {
ImageDialog.showImgDialog(context, item.annotateAnswers!);
}
},
child: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.state == 1 || item.state == 2 ? '查看' : '--', style: TextStyle(fontSize: 12.sp, color: Color(0xFF3661FE))),
child: Text(item.state==1 || item.state==2?'查看':'--',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF3661FE))),
),
),
)),
@ -153,10 +139,14 @@ class _StudentZgTableState extends State<StudentZgTable> {
headingRowHeight: 40.r,
dataRowHeight: 40.r,
border: TableBorder(
horizontalInside: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid),
bottom: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid),
verticalInside: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid)),
headingRowColor: MaterialStateProperty.resolveWith((states) => widget.fixedCols! > 0 ? Colors.white : Colors.transparent),
horizontalInside: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid),
bottom: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid),
verticalInside: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid)),
headingRowColor: MaterialStateProperty.resolveWith((states) =>
widget.fixedCols! > 0 ? Colors.white : Colors.transparent),
headingRowDecoration: BoxDecoration(color: Color(0xFFE6E6E6)),
fixedColumnsColor: Color(0xFFE6E6E6),
fixedCornerColor: Colors.grey[400],
@ -170,12 +160,14 @@ class _StudentZgTableState extends State<StudentZgTable> {
var item = widget.headList[index];
return DataColumn2(
label: Center(
child: Text(item, style: TextStyle(fontSize: 12.sp, color: Color(0xFF505767))),
child: Text(item,
style: TextStyle(fontSize: 12.sp, color: Color(0xFF505767))),
),
// size: ColumnSize.S,
fixedWidth: (MediaQuery.of(context).size.width - 20.r - 28.r) / 5,
fixedWidth: (MediaQuery.of(context).size.width - 20.r - 28.r)/5,
);
}),
rows: List<DataRow>.generate(widget.bodyList.length, (index) => _getRow(index, Color(0xFFF5F5F5))));
rows: List<DataRow>.generate(widget.bodyList.length,
(index) => _getRow(index, Color(0xFFF5F5F5))));
}
}