no message

This commit is contained in:
1147192855@qq.com 2024-06-13 09:29:40 +08:00
parent 6a3601df9b
commit 1104862e84
5 changed files with 121 additions and 63 deletions

View File

@ -2,7 +2,8 @@
enum KeyboardType { enum KeyboardType {
INPUT_TYPE, // INPUT_TYPE, //
RIGHT_SELECTION, // RIGHT_SELECTION, //
BOTTOM_SELECTION // BOTTOM_SELECTION, //
CLICK_TO_RATE_AND_REVIEW, //
} }
// //
@ -17,3 +18,12 @@ enum ScreenDirection {
HORIZONTAL_SCREEN, // HORIZONTAL_SCREEN, //
VERTICAL_SCREEN // VERTICAL_SCREEN //
} }
//
enum ClickOnScoringMethod {
INCREMENTAL(title: '点击递增'),
DECREASING(title: '点击递减');
const ClickOnScoringMethod({required this.title});
final String title;
}

View File

@ -166,6 +166,10 @@ class DoMarkingKeyboardModel extends Object {
@JsonKey(name: 'commonScores', includeIfNull: false) @JsonKey(name: 'commonScores', includeIfNull: false)
MarkingCommonScoreItems? commonScores; MarkingCommonScoreItems? commonScores;
//
@JsonKey(name: 'clickOnScoringMethod', includeIfNull: false)
ClickOnScoringMethod? clickOnScoringMethod;
// //
DoMarkingKeyboardModel({ DoMarkingKeyboardModel({
this.hideQuestionId = false, this.hideQuestionId = false,

View File

@ -44,6 +44,10 @@ class MarkingTextQuestion extends Object {
@JsonKey(name: 'subQuestionDetailList') @JsonKey(name: 'subQuestionDetailList')
List<SubQuestions> subQuestionDetailList; List<SubQuestions> subQuestionDetailList;
//
@JsonKey(name: 'scorePosition')
List<ScorePositionModel> scorePosition;
// //
// @JsonKey(name: 'questionIndex') // @JsonKey(name: 'questionIndex')
// int questionIndex; // int questionIndex;
@ -127,6 +131,7 @@ class MarkingTextQuestion extends Object {
this.scoreInterval = 1, this.scoreInterval = 1,
this.markingProgress, this.markingProgress,
this.completeRating = false, this.completeRating = false,
this.scorePosition = const [],
this.originalPaperAbsoluteUrl = const [], this.originalPaperAbsoluteUrl = const [],
// this.totalCount = 0, // this.totalCount = 0,
// this.currentIndex = 0, // this.currentIndex = 0,
@ -290,3 +295,21 @@ class ExceptionInfo extends Object {
Map<String, dynamic> toJson() => _$ExceptionInfoToJson(this); Map<String, dynamic> toJson() => _$ExceptionInfoToJson(this);
} }
@JsonSerializable()
class ScorePositionModel extends Object {
@JsonKey(name: 'position')
List<dynamic> position;
@JsonKey(name: 'questionNum')
String questionNum;
@JsonKey(name: 'subQuestionNum')
String? subQuestionNum;
ScorePositionModel({required this.position, required this.questionNum, this.subQuestionNum});
factory ScorePositionModel.fromJson(Map<String, dynamic> srcJson) => _$ScorePositionModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$ScorePositionModelToJson(this);
}

View File

@ -56,6 +56,16 @@ class MarkingKeyboardSwitch extends ConsumerWidget {
submitCall: submitCall, submitCall: submitCall,
synchroScore: synchroScore, synchroScore: synchroScore,
); );
case KeyboardType.CLICK_TO_RATE_AND_REVIEW:
return SelectableKeyboard(
data: data,
markingUserId: markingUserId,
subtopicIndex: subtopicIndex,
questScore: questScore,
totalScore: data.totalScore,
submitCall: submitCall,
synchroScore: synchroScore,
);
case KeyboardType.BOTTOM_SELECTION: case KeyboardType.BOTTOM_SELECTION:
return const SizedBox(); return const SizedBox();
} }

View File

@ -50,6 +50,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
late double scoreInterval; // late double scoreInterval; //
late int keyboardIndex; // late int keyboardIndex; //
late bool autoSubmitToNextQuestion; // late bool autoSubmitToNextQuestion; //
ClickOnScoringMethod? _clickOnScoringMethod; //
late RemoveListener _markingKeyboardListener; late RemoveListener _markingKeyboardListener;
MarkingCommonScoreItems? _commonScoreItems; MarkingCommonScoreItems? _commonScoreItems;
@override @override
@ -57,17 +58,15 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
// //
_markingKeyboardListener = ref.read(markingKeyboardProvider.notifier).addListener((state) { _markingKeyboardListener = ref.read(markingKeyboardProvider.notifier).addListener((state) {
MarkingCommonScoreItems? theCommonScores = state.commonScores; MarkingCommonScoreItems? theCommonScores = state.commonScores;
if (theCommonScores != null && if (theCommonScores != null && widget.questionNum == theCommonScores.questionNum && widget.markingUserId == theCommonScores.id) {
widget.questionNum == theCommonScores.questionNum &&
widget.markingUserId == theCommonScores.id) {
_commonScoreItems = state.commonScores; _commonScoreItems = state.commonScores;
} }
keyboardModel = state; keyboardModel = state;
keyboardIndex = state.keyboard.index; keyboardIndex = state.keyboard.index;
sortType = state.sort; sortType = state.sort;
autoSubmitToNextQuestion = state.autoSubmitToNextQuestion; autoSubmitToNextQuestion = state.autoSubmitToNextQuestion;
scoreInterval = state.getScoreStepSize( _clickOnScoringMethod = state.clickOnScoringMethod;
widget.markingUserId, widget.questionNum, widget.defaultScoreInterval); // scoreInterval = state.getScoreStepSize(widget.markingUserId, widget.questionNum, widget.defaultScoreInterval); //
isHorizontal = state.screenDirection == ScreenDirection.HORIZONTAL_SCREEN; isHorizontal = state.screenDirection == ScreenDirection.HORIZONTAL_SCREEN;
keyboardTypes = KeyboardType.values.map((e) { keyboardTypes = KeyboardType.values.map((e) {
@ -112,54 +111,19 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
case KeyboardType.RIGHT_SELECTION: case KeyboardType.RIGHT_SELECTION:
case KeyboardType.BOTTOM_SELECTION: case KeyboardType.BOTTOM_SELECTION:
// //
model.setScoreStepSize( model.setScoreStepSize(widget.markingUserId, widget.questionNum, widget.defaultScoreInterval, scoreInterval); //
widget.markingUserId, widget.questionNum, widget.defaultScoreInterval, scoreInterval); //
model.sort = sortType; model.sort = sortType;
break; break;
case KeyboardType.CLICK_TO_RATE_AND_REVIEW:
//
model.clickOnScoringMethod = _clickOnScoringMethod;
break;
} }
model.screenDirection = keyboardModel.screenDirection; model.screenDirection = keyboardModel.screenDirection;
model.autoSubmitToNextQuestion = autoSubmitToNextQuestion; model.autoSubmitToNextQuestion = autoSubmitToNextQuestion;
if (_commonScoreItems != null) model.commonScores = _commonScoreItems!.score.isNotEmpty ? _commonScoreItems : null; if (_commonScoreItems != null) model.commonScores = _commonScoreItems!.score.isNotEmpty ? _commonScoreItems : null;
ref.read(markingKeyboardProvider.notifier).toggleKeyboard(model); ref.read(markingKeyboardProvider.notifier).toggleKeyboard(model);
setTimeOut(300, () => widget.close(true)); setTimeOut(300, () => widget.close(true));
///
// showDialog(
// //
// barrierDismissible: false,
// context: context,
// builder: (context1) {
// return AlertDialog(content: quickText("请确定当前阅卷习惯配置?"), actions: <Widget>[
// TextButton(
// child: quickText("取消"),
// onPressed: () {
// Navigator.pop(context1, 'Cancle');
// },
// ),
// TextButton(
// child: quickText("确定", color: Theme.of(context).primaryColor),
// onPressed: () {
// TheDoMarkingKeyboardModel theCurrent = keyboardTypes[keyboardIndex]; //
// DoMarkingKeyboardModel model = theCurrent.model;
// switch (model.keyboard) {
// case KeyboardType.INPUT_TYPE:
// //
// break;
// case KeyboardType.RIGHT_SELECTION:
// case KeyboardType.BOTTOM_SELECTION:
// //
// model.setScoreStepSize(widget.markingUserId, widget.questionNum, widget.defaultScoreInterval, scoreInterval); //
// model.sort = sortType;
// break;
// }
// model.screenDirection = keyboardModel.screenDirection;
// model.autoSubmitToNextQuestion = autoSubmitToNextQuestion;
// ref.read(markingKeyboardProvider.notifier).toggleKeyboard(model);
// Navigator.pop(context1, 'Cancle');
// setTimeOut(300, () => widget.close(true));
// })
// ]);
// });
} }
@override @override
@ -191,9 +155,9 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
getKeyboardBox(), getKeyboardBox(),
getAutoNextQuestBox(), if (keyboardIndex != KeyboardType.CLICK_TO_RATE_AND_REVIEW.index) getAutoNextQuestBox(), //
getScoreIntervalSetBox(), getScoreIntervalSetBox(), //
if (keyboardIndex != 0) if (![0, KeyboardType.CLICK_TO_RATE_AND_REVIEW.index].contains(keyboardIndex))
$CommonScoringList( $CommonScoringList(
score: widget.questTotalScore!, score: widget.questTotalScore!,
scoreInterval: scoreInterval, scoreInterval: scoreInterval,
@ -208,6 +172,10 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
}, },
), ),
getSetScoringRulesBox(), getSetScoringRulesBox(),
$ClickOnScoringMethod(keyboardTypes[keyboardIndex].model.keyboard, _clickOnScoringMethod, (ClickOnScoringMethod mode) {
_clickOnScoringMethod = mode;
toUpState(setState, () {}, mounted);
}),
], ],
), ),
), ),
@ -323,7 +291,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
// //
Widget getSetScoringRulesBox() { Widget getSetScoringRulesBox() {
if (keyboardTypes[keyboardIndex].model.keyboard == KeyboardType.INPUT_TYPE) { if ([KeyboardType.INPUT_TYPE, KeyboardType.CLICK_TO_RATE_AND_REVIEW].contains(keyboardTypes[keyboardIndex].model.keyboard)) {
return Container(); return Container();
} }
@ -342,9 +310,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
Wrap( Wrap(
children: SortKeyboard.values children: SortKeyboard.values.where((element) => element != SortKeyboard.FULL_AND_AERO_TOP_INVERTED_ORDER).map((e) {
.where((element) => element != SortKeyboard.FULL_AND_AERO_TOP_INVERTED_ORDER)
.map((e) {
String title; String title;
switch (e) { switch (e) {
case SortKeyboard.INVERTED_ORDER: case SortKeyboard.INVERTED_ORDER:
@ -399,7 +365,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
// //
Widget getScoreIntervalSetBox() { Widget getScoreIntervalSetBox() {
if (keyboardTypes[keyboardIndex].model.keyboard == KeyboardType.INPUT_TYPE) { if ([KeyboardType.INPUT_TYPE].contains(keyboardTypes[keyboardIndex].model.keyboard)) {
return Container(); return Container();
} }
@ -413,8 +379,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
AchievementView(title: "分值间隔", subTitle: "设定当前题目的分数按钮的间隔分值", color: Theme.of(context).primaryColor) AchievementView(title: "分值间隔", subTitle: "设定当前题目的分数按钮的间隔分值", color: Theme.of(context).primaryColor).show(context);
.show(context);
}, },
child: Row( child: Row(
children: [ children: [
@ -507,8 +472,6 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
), ),
); );
} }
void _showPopover(BuildContext context) {}
} }
class TheDoMarkingKeyboardModel { class TheDoMarkingKeyboardModel {
@ -527,6 +490,9 @@ class TheDoMarkingKeyboardModel {
case KeyboardType.BOTTOM_SELECTION: case KeyboardType.BOTTOM_SELECTION:
title = '底部选择型键盘'; title = '底部选择型键盘';
break; break;
case KeyboardType.CLICK_TO_RATE_AND_REVIEW:
title = '点击打分';
break;
} }
} }
} }
@ -551,8 +517,7 @@ Widget $commonScoringList(BuildContext context,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
child: child: quickText('常用打分项', size: 14.sp, color: const Color.fromRGBO(45, 56, 76, 1), fontWeight: FontWeight.bold),
quickText('常用打分项', size: 14.sp, color: const Color.fromRGBO(45, 56, 76, 1), fontWeight: FontWeight.bold),
), ),
SizedBox(height: 10.h), SizedBox(height: 10.h),
Expanded( Expanded(
@ -579,9 +544,7 @@ Widget $commonScoringList(BuildContext context,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
width: 1.h, width: 1.h,
color: isSelected color: isSelected ? Theme.of(context).primaryColor.withOpacity(0.5) : const Color.fromRGBO(224, 230, 255, 1),
? Theme.of(context).primaryColor.withOpacity(0.5)
: const Color.fromRGBO(224, 230, 255, 1),
), ),
color: isSelected ? Colors.white : Colors.grey[300], color: isSelected ? Colors.white : Colors.grey[300],
borderRadius: BorderRadius.all(Radius.circular(2.w)), borderRadius: BorderRadius.all(Radius.circular(2.w)),
@ -600,3 +563,51 @@ Widget $commonScoringList(BuildContext context,
), ),
); );
} }
//
@swidget
Widget $clickOnScoringMethod(
BuildContext context, KeyboardType keyboard, ClickOnScoringMethod? clickOnScoringMethod, Function(ClickOnScoringMethod) call) {
if (keyboard != KeyboardType.CLICK_TO_RATE_AND_REVIEW) return SizedBox();
List<ClickOnScoringMethod> modes = ClickOnScoringMethod.values;
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 50.h),
quickText(
'计分方式',
size: 14.sp,
fontWeight: FontWeight.bold,
color: const Color.fromRGBO(45, 56, 76, 1),
),
SizedBox(height: 12.h),
Row(
mainAxisSize: MainAxisSize.min,
children: modes.map((e) {
return InkWell(
onTap: () => call(e),
child: Container(
margin: EdgeInsets.only(right: 20.w),
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 4.h),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(4.r), boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
offset: Offset(1, 1), //
blurRadius: 6.r, //
spreadRadius: 1.r,
),
]),
child: quickText(
e.title,
size: 14.sp,
color: clickOnScoringMethod == e ? Theme.of(context).primaryColor : const Color.fromRGBO(80, 87, 103, 1),
),
),
);
}).toList(),
)
],
);
}