no message

This commit is contained in:
1147192855@qq.com 2024-05-06 08:59:21 +08:00
parent cf7870c05f
commit 84f9d7a4ea
2 changed files with 144 additions and 395 deletions

View File

@ -165,8 +165,7 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
crypto.Digest fileMd5 = crypto.md5.convert(await temFile!.readAsBytes());
RestClient _client = await getClient();
BaseStructureResult<UploadFileInterfaceConfig> resUploadConfig =
await _client.getUploadFile(UploadFileInterfaceConfigParams(
BaseStructureResult<UploadFileInterfaceConfig> resUploadConfig = await _client.getUploadFile(UploadFileInterfaceConfigParams(
fileName: '1.png',
fileMd5: fileMd5.toString(),
contentLength: temFile!.lengthSync(),
@ -179,8 +178,7 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
if (resUploadConfig.data!.uploadUri == null) {
return FileResult(myObject: '', success: true, url: resUploadConfig.data!.downloadUri);
}
FileResult? resFile =
await ref.read(uploadFileProvider.notifier).getUploadFileConfig(resUploadConfig.data!, temFile!);
FileResult? resFile = await ref.read(uploadFileProvider.notifier).getUploadFileConfig(resUploadConfig.data!, temFile!);
// FileResult? resFile = await ref
// .read(uploadFileProvider.notifier)
// .uploadFile(temFile!.path, widget.imageItems[currentIndex], ref.read(userProvider).id.toString());
@ -230,7 +228,6 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
@override
Widget build(BuildContext context) {
DoMarkingKeyboardModel _model = ref.watch(markingKeyboardProvider);
return Container(
width: double.infinity,
height: double.infinity,
@ -259,8 +256,7 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
},
imageBuilder: (context, imageProvider) {
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
if (imagInfoModel == null ||
(imagInfoModel?.boxHeight != containerHeight || imagInfoModel?.boxWidth != containerWidth)) {
if (imagInfoModel == null || (imagInfoModel?.boxHeight != containerHeight || imagInfoModel?.boxWidth != containerWidth)) {
if (_imageStreamListener != null) _imageStream?.removeListener(_imageStreamListener!);
_imageStreamListener = ImageStreamListener((ImageInfo info, bool _) {
imagInfoModel = TestQuestionsImageInfo(
@ -303,24 +299,25 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
//
class ExamPaperDrawing extends StatefulHookConsumerWidget {
String imgUrl;
// String imgUrl;
bool homework;
BoxDecoration? decoration;
AnnotationGraffitiSwitch graffitiSwitch;
List<GestureRecording>? points;
List<dynamic>? pointsPureData;
ValueNotifier<Map<String, ui.Image>> imageLoaded;
Widget child;
GlobalKey globalKey;
// Function(String) imageCall;
ExamPaperDrawing({
required this.imgUrl,
// required this.imgUrl,
required this.homework,
required this.points,
required this.pointsPureData,
required this.graffitiSwitch,
required this.globalKey,
required this.imageLoaded,
required this.child,
this.decoration,
Key? key,
}) : super(key: key);
@ -329,54 +326,17 @@ class ExamPaperDrawing extends StatefulHookConsumerWidget {
_ExamPaperDrawingState createState() => _ExamPaperDrawingState();
}
class _ExamPaperDrawingState extends ConsumerState<ExamPaperDrawing>
with EventBusMixin<BottomAnnotationSwitchCleanall> {
late Future<ui.Image?> _future; //
class _ExamPaperDrawingState extends ConsumerState<ExamPaperDrawing> with EventBusMixin<BottomAnnotationSwitchCleanall> {
//
late List<GestureRecording> points;
late List<dynamic> pointsPureData;
//
bool _isEraserPressed = false; //
Offset? _eraserPosition; //
Offset? globalPosition = null; //
Future<ui.Image?> loadImage(String url) async {
try {
Map<String, ui.Image> map = widget.imageLoaded.value;
ui.Image? image = map[url];
if (image != null) {
return image;
}
final httpClient = HttpClient();
final request = await httpClient.getUrl(Uri.parse(url));
final response = await request.close();
final bytes = await consolidateHttpClientResponseBytes(response);
final codec = await ui.instantiateImageCodec(bytes);
final frame = await codec.getNextFrame();
ui.Image theImage = frame.image;
map[url] = theImage;
return theImage;
} catch (e) {
print('请求图片报错:${e.toString()}');
}
return null;
}
// void _onPointerDown(DragDownDetails details) {
// if (widget.graffitiSwitch.openEraser) {
// _eraserPosition = (context.findRenderObject() as RenderBox).globalToLocal(details.globalPosition);
// _isEraserPressed = true;
// toUpState(setState, ()=>{}, mounted);
// }
// }
Offset? globalPosition; //
@override
void initState() {
points = widget.points ?? [];
pointsPureData = widget.pointsPureData ?? [];
print('图片地址:${widget.imgUrl}');
_future = loadImage(widget.imgUrl);
// 线
eventOn(callback: (BottomAnnotationSwitchCleanall item) {
if (item.previousStep) {
@ -434,190 +394,79 @@ class _ExamPaperDrawingState extends ConsumerState<ExamPaperDrawing>
@override
Widget build(BuildContext context) {
return MyFutureBuilder.buildFutureBuilderOfSingleInstance<ui.Image>(
context,
_future,
(ui.Image? theImage) {
if (theImage == null) return const Center(child: Text('图片加载错误'));
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
final double containerWidth = constraints.maxWidth; //
final double containerHeight = constraints.maxHeight; //
final double imageWidth = theImage.width.toDouble(); //
final double imageHeight = theImage.height.toDouble(); //
final double widthRatio = containerWidth / imageWidth; //
final double heightRatio = containerHeight / imageHeight;
final double scale = widthRatio > heightRatio ? heightRatio : widthRatio;
final double destWidth = imageWidth * scale;
final double destHeight = imageHeight * scale;
final bool homework = widget.homework;
return GestureDetector(
return Listener(
behavior: HitTestBehavior.opaque,
onPanUpdate: (DragUpdateDetails details) {
onPointerMove: (PointerMoveEvent details) {
if (globalPosition != null) {
//
double dx = globalPosition!.dx;
double dy = globalPosition!.dy;
double dxNew = details.globalPosition.dx;
double dyNew = details.globalPosition.dy;
double dxNew = details.localPosition.dx;
double dyNew = details.localPosition.dy;
if ((dxNew - dx).abs() > 22 || (dyNew - dy).abs() > 22) {
return;
}
}
globalPosition = details.globalPosition;
globalPosition = details.localPosition;
try {
if (widget.graffitiSwitch.openBrush || widget.graffitiSwitch.openEraser) {
// if (widget.graffitiSwitch.openBrush || widget.graffitiSwitch.openEraser) {
RenderBox renderBox = context.findRenderObject() as RenderBox;
Offset localPosition = renderBox.globalToLocal(details.globalPosition);
Offset localPosition = renderBox.globalToLocal(details.localPosition);
pointsPureData = List.from(pointsPureData)..add(localPosition);
points = List.from(points)
..add(GestureRecording(eraser: widget.graffitiSwitch.openEraser, data: localPosition));
_eraserPosition = localPosition;
_isEraserPressed = true;
points = List.from(points)..add(GestureRecording(eraser: widget.graffitiSwitch.openEraser, data: localPosition));
setState(() {});
}
// }
} catch (e) {
toPrint(val: '进入报错');
}
},
onPanEnd: (DragEndDetails details) {
onPointerUp: (PointerUpEvent details) {
print('离开.............');
globalPosition = null;
if (widget.graffitiSwitch.openBrush || widget.graffitiSwitch.openEraser) {
pointsPureData.add(null); // 线
points.add(GestureRecording(eraser: widget.graffitiSwitch.openEraser));
_isEraserPressed = false;
_eraserPosition = null;
}
},
child: RepaintBoundary(
key: widget.globalKey,
child: CustomPaint(
// isComplex: true,
// willChange: true,
painter: DrawingPainter(
image: theImage,
points: points,
isErasing: widget.graffitiSwitch.openEraser,
destWidth: destWidth,
destHeight: destHeight,
imageWidth: imageWidth,
imageHeight: imageHeight,
homework: homework,
containerWidth: containerWidth,
containerHeight: containerHeight,
),
// size: Size(homework ? containerWidth : destWidth, homework ? containerHeight : destHeight),
size: Size(containerWidth, containerHeight),
foregroundPainter: DrawingPainter(points: points),
child: widget.child,
),
),
);
},
);
},
);
}
}
class DrawingPainter extends CustomPainter {
final List<GestureRecording> points;
final bool isErasing;
final ui.Image image;
final bool homework;
final double containerWidth;
final double containerHeight;
double destWidth;
double destHeight;
final double imageWidth;
final double imageHeight;
DrawingPainter({required this.points}) : super();
// final Rect destRect;
// final Rect srcRect;
final bool openErasing;
DrawingPainter({
required this.homework,
required this.points,
required this.isErasing,
required this.image,
required this.destWidth,
required this.destHeight,
required this.containerWidth,
required this.containerHeight,
required this.imageWidth,
required this.imageHeight,
}) :
// destRect = Rect.fromLTWH(0, 0,destWidth,destHeight),
// srcRect = Rect.fromLTWH(0, 0, imageWidth, imageHeight),
openErasing = points.isNotEmpty && isErasing,
super();
Paint paintBrush = Paint()
final Paint paintBrush = Paint()
..color = Colors.red
..strokeCap = StrokeCap.round
..strokeWidth = 1.5;
Paint eraser = Paint()
..blendMode = BlendMode.clear
..color = Colors.transparent
..style = PaintingStyle.stroke
..strokeCap = StrokeCap.round
..strokeWidth = 100;
final emptyPaint = Paint();
final emptyPaintWithWidth = Paint()..strokeWidth = 60.0;
..strokeWidth = 1.5.r;
@override
void paint(Canvas canvas, Size size) {
double offsetX = (size.width - destWidth) / 2;
double offsetY = (size.height - destHeight) / 2;
if (destWidth < (size.width / 2)) {
destWidth = size.width / 2;
offsetX = (size.width - destWidth) / 2;
}
// final rect = Rect.fromCenter(center: center, width: destWidth, height: destHeight);
Rect srcRect = Rect.fromLTRB(0, 0, image.width.toDouble(), image.height.toDouble());
// Rect destRect = Rect.fromLTRB(offsetX, offsetY, containerWidth, containerHeight);
Rect destRect = Offset(offsetX, offsetY) & Size(destWidth, destHeight);
canvas.drawImageRect(image, srcRect, destRect, emptyPaint);
// canvas.drawImage(image, Offset.zero, emptyPaint);
if (points.isNotEmpty) {
// canvas.saveLayer(destRect, emptyPaintWithWidth); //
canvas.saveLayer(Rect.largest, emptyPaintWithWidth); //
canvas.drawColor(Colors.transparent, BlendMode.clear);
}
for (int i = 0; i < points.length - 1; i++) {
print('数据.....................');
for (int i = 0; i < points.length; i++) {
GestureRecording item = points[i];
GestureRecording nextItem = points[i + 1];
Offset? offsetData = item.data;
Offset? nextOffsetData = nextItem.data;
if (offsetData != null && nextOffsetData != null) {
canvas.drawLine(offsetData, nextOffsetData, !item.eraser ? paintBrush : eraser);
canvas.drawLine(offsetData, nextOffsetData, paintBrush);
}
}
// .
if (points.isNotEmpty) canvas.restore();
}
// @override
// bool shouldRepaint(DrawingPainter oldDelegate) {
// List<GestureRecording> thePoints = oldDelegate.points;
// // var flag = oldDelegate.points != points || oldDelegate.isErasing != isErasing;
// return thePoints != points;
// }
@override
bool shouldRepaint(DrawingPainter oldDelegate) => true;
bool shouldRepaint(DrawingPainter oldDelegate) {
return oldDelegate.points.length != points.length || oldDelegate.points != points;
}
}
/**
@ -802,9 +651,7 @@ Widget $localAndNetworkSwitch(
useValueChanged<bool, String>(drawFlag, (oldValue, oldResult) {
if (!drawFlag) {
//
_useSwitch
.createTempFile(context, theglobalKey: theglobalKey, examGlobalKey: examGlobalKey)
.then((File? theFile) {
_useSwitch.createTempFile(context, theglobalKey: theglobalKey, examGlobalKey: examGlobalKey).then((File? theFile) {
if (theFile == null) {
// TODO
// _useSwich.showZoomImg.value true还是展示的原来的绘图组件ExamPaperDrawing
@ -832,40 +679,7 @@ Widget $localAndNetworkSwitch(
}, []);
print('是否更新视图.... ${_useZoomHistory.initPosition.value}');
return _useSwitch.showZoomImg.value
?
/**
Scrollbar(
// thumbVisibility: true,
thumbVisibility: true,
controller: _useScrollController,
child: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.zero,
scrollDirection: Axis.vertical, //
child: Transform.scale(
scale: 0.4,
alignment: Alignment.topCenter,
child: $MyCachedNetworkImage(
imageUrl: imageUrl,
tempFile: _useSwitch.temFile.value,
width: containerWidth,
height: containerHeight,
),
),
),
)*/
/** */
$MyCachedNetworkImage(
imageUrl: imageUrl,
tempFile: _useSwitch.temFile.value,
width: containerWidth,
height: containerHeight,
imageBuilder: imageBuilder,
)
: ExamPaperDrawing(
imgUrl: imageUrl,
return ExamPaperDrawing(
graffitiSwitch: graffitiSwitch,
points: _useSwitch.points.value,
pointsPureData: _useSwitch.pointsPureData.value,
@ -874,7 +688,13 @@ Widget $localAndNetworkSwitch(
key: examGlobalKey,
imageLoaded: _useSwitch.imageLoaded,
homework: homework,
// imageCall: (String str) => widget.imageCall(str, currentIndex),
child: $MyCachedNetworkImage(
imageUrl: imageUrl,
tempFile: _useSwitch.temFile.value,
width: containerWidth,
height: containerHeight,
imageBuilder: imageBuilder,
),
);
}

View File

@ -44,6 +44,7 @@ import 'package:marking_app/common/model/marking/submit_exam_small_params.dart';
import 'package:marking_app/common/model/marking/switch_keyboard_to_reload_images.dart';
import 'package:marking_app/components/PictureOverview.dart';
import 'package:marking_app/components/marking/bottom_annotation_switch.dart';
import 'package:marking_app/components/marking/marking_keyboard_switch.dart';
import 'package:marking_app/components/marking/marking_question_type_drawer.dart';
import 'package:marking_app/components/marking/marking_seting.dart';
@ -174,9 +175,8 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
screenDirectionSwitch(state.screenDirection);
} else {
ScreenDirection nowScreenDirection = state.screenDirection; //
ScreenDirection theOrientation = MediaQuery.of(context).orientation == Orientation.landscape
? ScreenDirection.HORIZONTAL_SCREEN
: ScreenDirection.VERTICAL_SCREEN;
ScreenDirection theOrientation =
MediaQuery.of(context).orientation == Orientation.landscape ? ScreenDirection.HORIZONTAL_SCREEN : ScreenDirection.VERTICAL_SCREEN;
if (theOrientation != nowScreenDirection) {
screenDirectionSwitch(nowScreenDirection);
}
@ -243,8 +243,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
bool isHorizontal = direction == ScreenDirection.HORIZONTAL_SCREEN;
Future.delayed(Duration.zero, () {
SystemChrome.setPreferredOrientations(
[isHorizontal ? DeviceOrientation.landscapeLeft : DeviceOrientation.portraitUp]);
SystemChrome.setPreferredOrientations([isHorizontal ? DeviceOrientation.landscapeLeft : DeviceOrientation.portraitUp]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
setTimeOut(1000, () => toUpState(setState, () => annotationsFlag = true, mounted));
});
@ -260,8 +259,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
return null;
}
currentQuestion!.papersUrlStr = paperUrls;
currentQuestion!.papersUrl =
paperUrls.asMap().keys.map((e) => GalleryExampleItemModel(id: e.toString(), resource: paperUrls[e])).toList();
currentQuestion!.papersUrl = paperUrls.asMap().keys.map((e) => GalleryExampleItemModel(id: e.toString(), resource: paperUrls[e])).toList();
return currentQuestion!.papersUrl;
}
@ -426,8 +424,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
Future<void> submitTestQuestions(BuildContext theContext, MarkingTextQuestion data) async {
Timer timer = Timer(const Duration(milliseconds: 300), () => ToastUtils.showLoading());
try {
if (widget.markingtype == MarkingListType.NORMAL && currentQuestion!.isException)
return ToastUtils.showError('异常题,不允许再评分');
if (widget.markingtype == MarkingListType.NORMAL && currentQuestion!.isException) return ToastUtils.showError('异常题,不允许再评分');
if (currentQuestion == null) {
return ToastUtils.showError('提交失败,请退出重试。');
@ -762,8 +759,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
bool isReview = widget.isReview;
if (theId != null && _currentTab != null && theQuestionNum != _currentTab!.questionNum) {
MarkingTextQuestionTab? _foundCrrentTab =
_currentTabs.firstWhereOrNull((element) => element.questionNum == theQuestionNum);
MarkingTextQuestionTab? _foundCrrentTab = _currentTabs.firstWhereOrNull((element) => element.questionNum == theQuestionNum);
if (_foundCrrentTab != null) {
_currentTab = _foundCrrentTab;
}
@ -791,11 +787,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
// score: continueScoring hasSubtopic; cleanScore:
Future<void> synchroScore(
{required double score,
required bool continueScoring,
required bool hasSubtopic,
bool allWrong = false,
bool cleanScore = false}) async {
{required double score, required bool continueScoring, required bool hasSubtopic, bool allWrong = false, bool cleanScore = false}) async {
if (currentQuestion == null) return;
if (cleanScore) {
@ -879,8 +871,8 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
res.data = res.data!.where((element) => !(element.isFinished && element.finishCount == 0)).toList();
// 便tags key是题号
Map<String, MarkingTextQuestionTab> _currentTabsMap = Map<String, MarkingTextQuestionTab>.fromIterable(_currentTabs,
key: (item) => item.questionNum, value: (item) => item);
Map<String, MarkingTextQuestionTab> _currentTabsMap =
Map<String, MarkingTextQuestionTab>.fromIterable(_currentTabs, key: (item) => item.questionNum, value: (item) => item);
MarkingTextQuestionTab? theCurrentTab;
String currentTagQueNum = _currentTab!.questionNum;
res.data!.forEach((e) {
@ -918,31 +910,25 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
if (!widget.exceptional && _currentTabs.length <= 0 && _currentTab == null) {
// tag为空tag数据并且为对应的tag赋值上分值步长
RestClient client = await getClient();
List<BaseStructureResult> res = await Future.wait([
client.getTestQuestionsOfTab(widget.markingUserId),
client.getTestQuestionsOfTabStepSize(widget.examSubjectId)
]);
BaseStructureResult<List<MarkingTextQuestionTab>> resultTab =
res[0] as BaseStructureResult<List<MarkingTextQuestionTab>>;
BaseStructureResult<List<MarkingTextQuestionTabStepSize>> resultTabStep =
res[1] as BaseStructureResult<List<MarkingTextQuestionTabStepSize>>;
List<BaseStructureResult> res =
await Future.wait([client.getTestQuestionsOfTab(widget.markingUserId), client.getTestQuestionsOfTabStepSize(widget.examSubjectId)]);
BaseStructureResult<List<MarkingTextQuestionTab>> resultTab = res[0] as BaseStructureResult<List<MarkingTextQuestionTab>>;
BaseStructureResult<List<MarkingTextQuestionTabStepSize>> resultTabStep = res[1] as BaseStructureResult<List<MarkingTextQuestionTabStepSize>>;
if ((!resultTab.success || (resultTab.data?.isEmpty ?? true)) ||
(!resultTabStep.success || (resultTabStep.data?.isEmpty ?? true)) ||
(resultTabStep.data!.length < resultTab.data!.length)) {
throw Error();
}
Map<String, double> tabStepMap = Map<String, double>.fromIterable(resultTabStep.data!,
key: (item) => item.questionNum, value: (item) => item.scoreInterval);
Map<String, double> tabStepMap =
Map<String, double>.fromIterable(resultTabStep.data!, key: (item) => item.questionNum, value: (item) => item.scoreInterval);
resultTab.data = resultTab.data!.where((element) => !(element.isFinished && element.finishCount == 0)).toList();
resultTab.data!.forEach((element) => element.setStepSize(tabStepMap[element.questionNum] ?? 1.0));
_currentTabs = resultTab.data!;
// tabs批次下第一个没有完成数据
currentTab = resultTab.data!.firstWhere(
tabQuestionNum == null ? firstWhereCall : (e) => e.questionNum == tabQuestionNum,
orElse: () =>
MarkingTextQuestionTab(isFinished: false, questionNum: '0.0', total: 0, finishCount: 0, isExcess: false));
currentTab = resultTab.data!.firstWhere(tabQuestionNum == null ? firstWhereCall : (e) => e.questionNum == tabQuestionNum,
orElse: () => MarkingTextQuestionTab(isFinished: false, questionNum: '0.0', total: 0, finishCount: 0, isExcess: false));
if (currentTab.questionNum == '0.0') {
// tab设置为第一个
@ -1025,8 +1011,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
if (hasNext) {
// tab
return _currentTabs.firstWhere(firstWhereCall,
orElse: () => MarkingTextQuestionTab(
questionNum: '0.0', total: 0, finishCount: 0, isExcess: false, isFinished: false));
orElse: () => MarkingTextQuestionTab(questionNum: '0.0', total: 0, finishCount: 0, isExcess: false, isFinished: false));
}
if (tabQuestionNum != null) {
@ -1036,8 +1021,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
if (resetting) {
//
MarkingTextQuestionTab theMarking = _currentTabs.firstWhere(firstWhereCall,
orElse: () => MarkingTextQuestionTab(
questionNum: '0.0', total: 0, finishCount: 0, isExcess: false, isFinished: false));
orElse: () => MarkingTextQuestionTab(questionNum: '0.0', total: 0, finishCount: 0, isExcess: false, isFinished: false));
if (theMarking.questionNum != '0.0') {
currentTab = theMarking;
}
@ -1143,8 +1127,8 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
currentQuestion = result.data;
if (temTab != null) {
result.data!.scoreInterval = temTab.scoreInterval ?? 1;
MarkingZoom? markingZoom = await UseZoomImageHistoryUtils.getZoomImageInfo(
widget.markingUserId.toString() + '-' + (currentQuestion?.questionNum.toString() ?? ''));
MarkingZoom? markingZoom =
await UseZoomImageHistoryUtils.getZoomImageInfo(widget.markingUserId.toString() + '-' + (currentQuestion?.questionNum.toString() ?? ''));
if (markingZoom != null) {
imageScale = double.parse(markingZoom.scale.toStringAsFixed(2));
imagePosition = Offset(
@ -1232,8 +1216,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
if (firstComeIn) setTimeOut(2000, () => firstComeIn = false);
if (ref.read(markingSubtopicSwitchingProvider.notifier).state != activeQuestIndex) {
//
Future.delayed(
Duration.zero, () => ref.read(markingSubtopicSwitchingProvider.notifier).setVal(activeQuestIndex));
Future.delayed(Duration.zero, () => ref.read(markingSubtopicSwitchingProvider.notifier).setVal(activeQuestIndex));
}
if (currentQuestion != null && widget.markingtype == MarkingListType.EXCEPTIONAL) {
BaseStructureResult<ExceptionInfo> res = await client.getMarkingQuestionsErrorInfo(currentQuestion!.id);
@ -1435,8 +1418,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
bool isNormal = !widget.exceptional; //
bool notNextTest = data.nextId == 0; //
//
var pressedNextTest =
notNextTest ? null : () => easyThrottle('TestQuestionSwitch', () => refresh(isNext: true));
var pressedNextTest = notNextTest ? null : () => easyThrottle('TestQuestionSwitch', () => refresh(isNext: true));
bool notHasPreviousTest = data.prevId == 0;
/**
@ -1501,8 +1483,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
color: const Color.fromRGBO(148, 163, 182, 1),
),
),
if (_currentTab!.isExcess &&
_currentTab!.finishCount > _currentTab!.total)
if (_currentTab!.isExcess && _currentTab!.finishCount > _currentTab!.total)
Container(
margin: EdgeInsets.only(left: 4.w),
child: Row(
@ -1513,8 +1494,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
color: const Color.fromRGBO(148, 163, 182, 1),
),
quickText(
(_currentTab!.finishCount - _currentTab!.total)
.toString(),
(_currentTab!.finishCount - _currentTab!.total).toString(),
size: isBroadwise ? 18.sp : 14.sp,
color: Color.fromRGBO(251, 144, 84, 1),
),
@ -1540,19 +1520,16 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
),
),
SizedBox(width: 8.w),
if (model.hideQuestionId &&
model.screenDirection == ScreenDirection.HORIZONTAL_SCREEN)
if (model.hideQuestionId && model.screenDirection == ScreenDirection.HORIZONTAL_SCREEN)
InkWell(
onTap: () {
Clipboard.setData(ClipboardData(text: data.paperNum ?? ''))
.then((value) {
Clipboard.setData(ClipboardData(text: data.paperNum ?? '')).then((value) {
ToastUtils.showSuccess('试卷编号已复制');
});
},
child: Row(
children: [
quickText('试卷编号: ',
size: 16.sp, color: const Color.fromRGBO(148, 163, 182, 1)),
quickText('试卷编号: ', size: 16.sp, color: const Color.fromRGBO(148, 163, 182, 1)),
quickText(
data.paperNum ?? '',
size: 16.sp,
@ -1585,8 +1562,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
color: const Color.fromRGBO(4, 201, 208, 1),
),
),
if (isBroadwise && widget.markingtype == MarkingListType.EXCEPTIONAL ||
data.isException)
if (isBroadwise && widget.markingtype == MarkingListType.EXCEPTIONAL || data.isException)
Container(
padding: EdgeInsets.symmetric(horizontal: 2.w, vertical: 2.h),
color: const Color.fromRGBO(245, 108, 108, 0.236),
@ -1630,18 +1606,14 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
size: isBroadwise ? 15.sp : 12.sp,
),
SizedBox(width: 1.w),
quickText('继续阅卷',
color: const Color.fromRGBO(80, 87, 103, 1),
size: isBroadwise ? 15.sp : 12.sp),
quickText('继续阅卷', color: const Color.fromRGBO(80, 87, 103, 1), size: isBroadwise ? 15.sp : 12.sp),
],
),
),
SizedBox(width: 10.w),
InkWell(
onTap: () {
ref
.read(ratingProgressProvider.notifier)
.setState(EndDrawerViewEnum.REVIEW_RECORD);
ref.read(ratingProgressProvider.notifier).setState(EndDrawerViewEnum.REVIEW_RECORD);
scaffoldKey.currentState?.openEndDrawer();
},
child: Row(
@ -1652,9 +1624,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
size: isBroadwise ? 15.sp : 12.sp,
),
SizedBox(width: 1.w),
quickText('阅卷记录',
color: const Color.fromRGBO(80, 87, 103, 1),
size: isBroadwise ? 15.sp : 12.sp),
quickText('阅卷记录', color: const Color.fromRGBO(80, 87, 103, 1), size: isBroadwise ? 15.sp : 12.sp),
],
),
),
@ -1666,9 +1636,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
),
InkWell(
onTap: () {
ref
.read(ratingProgressProvider.notifier)
.setState(EndDrawerViewEnum.RATING_PROGRESS);
ref.read(ratingProgressProvider.notifier).setState(EndDrawerViewEnum.RATING_PROGRESS);
scaffoldKey.currentState?.openEndDrawer();
},
child: Row(
@ -1679,9 +1647,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
size: isBroadwise ? 15.sp : 12.sp,
),
SizedBox(width: 1.w),
quickText('评分进度',
color: const Color.fromRGBO(80, 87, 103, 1),
size: isBroadwise ? 15.sp : 12.sp),
quickText('评分进度', color: const Color.fromRGBO(80, 87, 103, 1), size: isBroadwise ? 15.sp : 12.sp),
],
),
),
@ -1690,8 +1656,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
InkWell(
onTap: () {
if (data.isException) {
return ToastUtils.getFluttertoast(
context: context, msg: '当前试题已为异常题,无需重复提交');
return ToastUtils.getFluttertoast(context: context, msg: '当前试题已为异常题,无需重复提交');
}
toUpState(setState, () => showAbnormal = true, mounted);
},
@ -1817,17 +1782,14 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
return InkWell(
onTap: () {
double? getScore = quest.subQuestionGotScore;
ref
.read(markingSubtopicSwitchingProvider.notifier)
.setVal(index);
ref.read(markingSubtopicSwitchingProvider.notifier).setVal(index);
toUpState(setState, () {
activeQuestIndex = index;
// TODO
// pictureOverviewKey.currentState?.jumpToPage(activeQuestIndex);
questScore = getScore?.toString() ?? '';
hasZeroPointFive =
questScore != '' && getScore! >= quest.subQuestionScore;
hasZeroPointFive = questScore != '' && getScore! >= quest.subQuestionScore;
}, mounted);
},
child: Container(
@ -1848,8 +1810,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
alignment: const FractionalOffset(0.5, 1.78),
children: [
Container(
padding: EdgeInsets.symmetric(
horizontal: 4.w, vertical: 8.h),
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 8.h),
alignment: Alignment.center,
decoration: BoxDecoration(
color: !activeIndex
@ -1871,9 +1832,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: activeIndex
? Colors.white
: const Color.fromRGBO(80, 87, 103, 1),
color: activeIndex ? Colors.white : const Color.fromRGBO(80, 87, 103, 1),
fontSize: 13.sp,
fontWeight: FontWeight.w500,
),
@ -1884,22 +1843,18 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
child: quickText(
'(${getDoubleRemoveZero(data.subQuestionDetailList[index].subQuestionScore)})',
size: 11.sp,
color: activeIndex
? Colors.white
: const Color.fromRGBO(
80, 87, 103, 1)),
color:
activeIndex ? Colors.white : const Color.fromRGBO(80, 87, 103, 1)),
)
],
)),
if (activeIndex)
Icon(Icons.arrow_drop_down_outlined,
color: const Color.fromRGBO(46, 91, 255, 1),
size: 20.sp)
color: const Color.fromRGBO(46, 91, 255, 1), size: 20.sp)
],
),
Container(
padding:
EdgeInsets.symmetric(horizontal: 4.w, vertical: 8.h),
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 8.h),
alignment: Alignment.center,
child: Text(
getDoubleRemoveZero(quest.subQuestionGotScore, '请评分'),
@ -1945,8 +1900,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
),
child: Text(
'>>',
style:
TextStyle(color: Theme.of(context).primaryColor, fontSize: 12.sp),
style: TextStyle(color: Theme.of(context).primaryColor, fontSize: 12.sp),
),
)),
onHorizontalDragEnd: (detail) {
@ -1976,7 +1930,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
imageItems: data.getImageData(),
),
),
//
// TODO
// if (!showSetingFlag &&
// !widget.exceptional &&
// currentQuestion != null &&
@ -1986,7 +1940,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
// Positioned(
// left: 0,
// bottom: 0,
// child: BottomAnnotationSwitch(maxWidth: maxWidth - 1.5.w),
// child: BottomAnnotationSwitch(maxWidth: ScreenUtil().screenWidth - 1.5.w),
// ),
//
if (!hasSubtopic)
@ -2000,10 +1954,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
color: data.isException ? Colors.red : const Color.fromRGBO(46, 91, 255, 1),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: (data.score == null ||
(getDoubleRemoveZero(data.score ?? 0)).length >= 2)
? 4.w
: 12.w,
horizontal: (data.score == null || (getDoubleRemoveZero(data.score ?? 0)).length >= 2) ? 4.w : 12.w,
vertical: 6.h),
alignment: Alignment.center,
child: Text(
@ -2029,15 +1980,11 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
color: data.isException ? Colors.red : const Color.fromRGBO(46, 91, 255, 1),
child: Container(
padding: EdgeInsets.symmetric(
horizontal: (data.score == null ||
(getDoubleRemoveZero(data.score ?? 0)).length >= 2)
? 4.w
: 12.w,
horizontal: (data.score == null || (getDoubleRemoveZero(data.score ?? 0)).length >= 2) ? 4.w : 12.w,
vertical: 6.h),
alignment: Alignment.center,
child: Text(
getDoubleRemoveZero(data.score,
'请评分,满分${getDoubleRemoveZero(currentQuestion?.totalScore)}'),
getDoubleRemoveZero(data.score, '请评分,满分${getDoubleRemoveZero(currentQuestion?.totalScore)}'),
style: TextStyle(
fontSize: 18.sp,
color: const Color.fromRGBO(46, 91, 255, 1),
@ -2047,22 +1994,17 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
),
),
//
if (widget.markingtype != MarkingListType.EXCEPTIONAL &&
!_theOldAnnotationGraffiti &&
!notHasPreviousTest)
if (widget.markingtype != MarkingListType.EXCEPTIONAL && !_theOldAnnotationGraffiti && !notHasPreviousTest)
Positioned(
left: 3.w,
top: ScreenUtil().setHeight(MediaQuery.of(context).size.height) / 2 * 0.87,
child: FloatingActionButton(
tooltip: '前往上一题',
backgroundColor: notHasPreviousTest
? const Color.fromRGBO(24, 32, 32, 0.04)
: const Color.fromRGBO(24, 32, 32, 0.1),
backgroundColor:
notHasPreviousTest ? const Color.fromRGBO(24, 32, 32, 0.04) : const Color.fromRGBO(24, 32, 32, 0.1),
focusColor: Theme.of(context).primaryColor,
elevation: 0,
onPressed: notHasPreviousTest
? null
: () => easyThrottle('TestQuestionSwitch', () => refresh()),
onPressed: notHasPreviousTest ? null : () => easyThrottle('TestQuestionSwitch', () => refresh()),
child: const Icon(Icons.arrow_back_ios, color: Colors.white),
heroTag: 'other',
),
@ -2075,9 +2017,8 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
child: FloatingActionButton(
elevation: 0,
tooltip: '点击前往下一题',
backgroundColor: notNextTest
? const Color.fromRGBO(24, 32, 32, 0.04)
: const Color.fromRGBO(24, 32, 32, 0.1),
backgroundColor:
notNextTest ? const Color.fromRGBO(24, 32, 32, 0.04) : const Color.fromRGBO(24, 32, 32, 0.1),
foregroundColor: Colors.white,
onPressed: pressedNextTest,
child: const Icon(Icons.arrow_forward_ios, color: Colors.white),
@ -2169,8 +2110,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
//
$AbnormalBox(
businessHandle: (bool flag, String? reasonKey, String? otherReasons) =>
initiateException(flag, reasonKey, otherReasons),
businessHandle: (bool flag, String? reasonKey, String? otherReasons) => initiateException(flag, reasonKey, otherReasons),
isBroadwise: isBroadwise,
showAbnormal: !showAbnormal,
),
@ -2202,8 +2142,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
eventFireSub(model: SwitchKeyboardToReloadImages(true));
});
ref.read(annotationGraffitiSwitchProvider.notifier).setSwitch(false);
ToastUtils.showSuccess(newOpenAuxiliary ? '开启双栏打分' : '关闭双栏打分',
duration: const Duration(milliseconds: 300));
ToastUtils.showSuccess(newOpenAuxiliary ? '开启双栏打分' : '关闭双栏打分', duration: const Duration(milliseconds: 300));
});
},
// 线
@ -2212,8 +2151,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
width: isBroadwise ? 18.w : 42.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.only(topLeft: Radius.circular(8.w), bottomLeft: Radius.circular(8.w)),
borderRadius: BorderRadius.only(topLeft: Radius.circular(8.w), bottomLeft: Radius.circular(8.w)),
color: Theme.of(context).primaryColor,
),
child: Row(
@ -2247,8 +2185,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
tabName: _currentTab?.questionNum ?? '',
tabs: _currentTabs,
direction: keyboardModel?.screenDirection ?? ScreenDirection.HORIZONTAL_SCREEN,
call: (int detailId, String selectedQuesiontNum) =>
refresh(theId: detailId, theQuestionNum: selectedQuesiontNum),
call: (int detailId, String selectedQuesiontNum) => refresh(theId: detailId, theQuestionNum: selectedQuesiontNum),
markingUserId: widget.markingUserId,
questionNum: _currentTab?.questionNum,
),
@ -2429,10 +2366,8 @@ Widget $abnormalBox(
child: TextField(
controller: controller,
textInputAction: TextInputAction.next,
onEditingComplete: () => easyThrottle(
'Abnormal_submission_confirmation_button',
() => _useAbnormal.submit(context, controller,
(reasonType, reason) => businessHandle(true, reasonType, reason))),
onEditingComplete: () => easyThrottle('Abnormal_submission_confirmation_button',
() => _useAbnormal.submit(context, controller, (reasonType, reason) => businessHandle(true, reasonType, reason))),
maxLines: 15,
keyboardType: TextInputType.multiline,
decoration: InputDecoration(
@ -2452,8 +2387,7 @@ Widget $abnormalBox(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
onTap: () => easyThrottle(
'Abnormal_submission_confirmation_button', () => businessHandle(false, null, null)),
onTap: () => easyThrottle('Abnormal_submission_confirmation_button', () => businessHandle(false, null, null)),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
margin: EdgeInsets.only(right: 16.w),
@ -2483,8 +2417,7 @@ Widget $abnormalBox(
InkWell(
onTap: () => easyThrottle(
'Abnormal_submission_confirmation_button',
() => _useAbnormal.submit(
context, controller, (reasonType, reason) => businessHandle(true, reasonType, reason)),
() => _useAbnormal.submit(context, controller, (reasonType, reason) => businessHandle(true, reasonType, reason)),
),
// () {
@ -2582,8 +2515,7 @@ class StandardAnswerRegion extends StatelessWidget {
///
@hwidget
Widget $abnormalQuestionInfo(
{required bool hasSubtopic, required bool isBroadwise, required bool show, double? score, ExceptionInfo? info}) {
Widget $abnormalQuestionInfo({required bool hasSubtopic, required bool isBroadwise, required bool show, double? score, ExceptionInfo? info}) {
final _useFlagAnimation = useState(true);
AnimationController _useAnimationHorizontal = useAnimationController(
initialValue: 300,
@ -2675,14 +2607,12 @@ Widget $abnormalQuestionInfo(
Row(
children: [
if ((info?.studentName.length ?? 0) > 0)
quickText('考生:${info!.studentName}',
color: const Color.fromRGBO(104, 104, 113, 1), size: 14.sp
quickText('考生:${info!.studentName}', color: const Color.fromRGBO(104, 104, 113, 1), size: 14.sp
// overflow: TextOverflow.clip,
),
SizedBox(width: 3.w),
if ((info?.studentExamNum.length ?? 0) > 0)
quickText('考号:${info!.studentExamNum}',
color: const Color.fromRGBO(104, 104, 113, 1), size: 14.sp
quickText('考号:${info!.studentExamNum}', color: const Color.fromRGBO(104, 104, 113, 1), size: 14.sp
// overflow: TextOverflow.clip,
),
],
@ -2716,8 +2646,7 @@ Widget $abnormalQuestionInfo(
///
@hwidget
Widget $arbitrationQuestionInfo(
{required bool show, required bool isBroadwise, required bool hasSubtopic, required List<HistoricalScoring> data}) {
Widget $arbitrationQuestionInfo({required bool show, required bool isBroadwise, required bool hasSubtopic, required List<HistoricalScoring> data}) {
final _useFlagAnimation = useState(true);
AnimationController _useAnimationHorizontal = useAnimationController(
initialValue: 300,