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 {
INPUT_TYPE, //
RIGHT_SELECTION, //
BOTTOM_SELECTION //
BOTTOM_SELECTION, //
CLICK_TO_RATE_AND_REVIEW, //
}
//
@ -17,3 +18,12 @@ enum ScreenDirection {
HORIZONTAL_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)
MarkingCommonScoreItems? commonScores;
//
@JsonKey(name: 'clickOnScoringMethod', includeIfNull: false)
ClickOnScoringMethod? clickOnScoringMethod;
//
DoMarkingKeyboardModel({
this.hideQuestionId = false,

View File

@ -44,6 +44,10 @@ class MarkingTextQuestion extends Object {
@JsonKey(name: 'subQuestionDetailList')
List<SubQuestions> subQuestionDetailList;
//
@JsonKey(name: 'scorePosition')
List<ScorePositionModel> scorePosition;
//
// @JsonKey(name: 'questionIndex')
// int questionIndex;
@ -127,6 +131,7 @@ class MarkingTextQuestion extends Object {
this.scoreInterval = 1,
this.markingProgress,
this.completeRating = false,
this.scorePosition = const [],
this.originalPaperAbsoluteUrl = const [],
// this.totalCount = 0,
// this.currentIndex = 0,
@ -290,3 +295,21 @@ class ExceptionInfo extends Object {
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,
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:
return const SizedBox();
}

View File

@ -50,6 +50,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
late double scoreInterval; //
late int keyboardIndex; //
late bool autoSubmitToNextQuestion; //
ClickOnScoringMethod? _clickOnScoringMethod; //
late RemoveListener _markingKeyboardListener;
MarkingCommonScoreItems? _commonScoreItems;
@override
@ -57,17 +58,15 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
//
_markingKeyboardListener = ref.read(markingKeyboardProvider.notifier).addListener((state) {
MarkingCommonScoreItems? theCommonScores = state.commonScores;
if (theCommonScores != null &&
widget.questionNum == theCommonScores.questionNum &&
widget.markingUserId == theCommonScores.id) {
if (theCommonScores != null && widget.questionNum == theCommonScores.questionNum && widget.markingUserId == theCommonScores.id) {
_commonScoreItems = state.commonScores;
}
keyboardModel = state;
keyboardIndex = state.keyboard.index;
sortType = state.sort;
autoSubmitToNextQuestion = state.autoSubmitToNextQuestion;
scoreInterval = state.getScoreStepSize(
widget.markingUserId, widget.questionNum, widget.defaultScoreInterval); //
_clickOnScoringMethod = state.clickOnScoringMethod;
scoreInterval = state.getScoreStepSize(widget.markingUserId, widget.questionNum, widget.defaultScoreInterval); //
isHorizontal = state.screenDirection == ScreenDirection.HORIZONTAL_SCREEN;
keyboardTypes = KeyboardType.values.map((e) {
@ -112,54 +111,19 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
case KeyboardType.RIGHT_SELECTION:
case KeyboardType.BOTTOM_SELECTION:
//
model.setScoreStepSize(
widget.markingUserId, widget.questionNum, widget.defaultScoreInterval, scoreInterval); //
model.setScoreStepSize(widget.markingUserId, widget.questionNum, widget.defaultScoreInterval, scoreInterval); //
model.sort = sortType;
break;
case KeyboardType.CLICK_TO_RATE_AND_REVIEW:
//
model.clickOnScoringMethod = _clickOnScoringMethod;
break;
}
model.screenDirection = keyboardModel.screenDirection;
model.autoSubmitToNextQuestion = autoSubmitToNextQuestion;
if (_commonScoreItems != null) model.commonScores = _commonScoreItems!.score.isNotEmpty ? _commonScoreItems : null;
ref.read(markingKeyboardProvider.notifier).toggleKeyboard(model);
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
@ -191,9 +155,9 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
getKeyboardBox(),
getAutoNextQuestBox(),
getScoreIntervalSetBox(),
if (keyboardIndex != 0)
if (keyboardIndex != KeyboardType.CLICK_TO_RATE_AND_REVIEW.index) getAutoNextQuestBox(), //
getScoreIntervalSetBox(), //
if (![0, KeyboardType.CLICK_TO_RATE_AND_REVIEW.index].contains(keyboardIndex))
$CommonScoringList(
score: widget.questTotalScore!,
scoreInterval: scoreInterval,
@ -208,6 +172,10 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
},
),
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() {
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();
}
@ -342,9 +310,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
fontWeight: FontWeight.bold,
),
Wrap(
children: SortKeyboard.values
.where((element) => element != SortKeyboard.FULL_AND_AERO_TOP_INVERTED_ORDER)
.map((e) {
children: SortKeyboard.values.where((element) => element != SortKeyboard.FULL_AND_AERO_TOP_INVERTED_ORDER).map((e) {
String title;
switch (e) {
case SortKeyboard.INVERTED_ORDER:
@ -399,7 +365,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
//
Widget getScoreIntervalSetBox() {
if (keyboardTypes[keyboardIndex].model.keyboard == KeyboardType.INPUT_TYPE) {
if ([KeyboardType.INPUT_TYPE].contains(keyboardTypes[keyboardIndex].model.keyboard)) {
return Container();
}
@ -413,8 +379,7 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
children: [
InkWell(
onTap: () {
AchievementView(title: "分值间隔", subTitle: "设定当前题目的分数按钮的间隔分值", color: Theme.of(context).primaryColor)
.show(context);
AchievementView(title: "分值间隔", subTitle: "设定当前题目的分数按钮的间隔分值", color: Theme.of(context).primaryColor).show(context);
},
child: Row(
children: [
@ -507,8 +472,6 @@ class _MarkingSetingState extends ConsumerState<MarkingSeting> {
),
);
}
void _showPopover(BuildContext context) {}
}
class TheDoMarkingKeyboardModel {
@ -527,6 +490,9 @@ class TheDoMarkingKeyboardModel {
case KeyboardType.BOTTOM_SELECTION:
title = '底部选择型键盘';
break;
case KeyboardType.CLICK_TO_RATE_AND_REVIEW:
title = '点击打分';
break;
}
}
}
@ -551,8 +517,7 @@ Widget $commonScoringList(BuildContext context,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child:
quickText('常用打分项', size: 14.sp, color: const Color.fromRGBO(45, 56, 76, 1), fontWeight: FontWeight.bold),
child: quickText('常用打分项', size: 14.sp, color: const Color.fromRGBO(45, 56, 76, 1), fontWeight: FontWeight.bold),
),
SizedBox(height: 10.h),
Expanded(
@ -579,9 +544,7 @@ Widget $commonScoringList(BuildContext context,
decoration: BoxDecoration(
border: Border.all(
width: 1.h,
color: isSelected
? Theme.of(context).primaryColor.withOpacity(0.5)
: const Color.fromRGBO(224, 230, 255, 1),
color: isSelected ? Theme.of(context).primaryColor.withOpacity(0.5) : const Color.fromRGBO(224, 230, 255, 1),
),
color: isSelected ? Colors.white : Colors.grey[300],
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(),
)
],
);
}