Marking.Client.Moblie/marking_app/lib/components/review_item_view.dart

165 lines
6.1 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: wangyang 1147192855@qq.com
* @Date: 2022-07-21 16:16:27
* @LastEditors: wangyang 1147192855@qq.com
* @LastEditTime: 2022-07-28 18:13:22
* @FilePath: \marking_app\lib\components\review_item_view.dart
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:marking_app/common/model/review/review_item.dart';
import 'package:marking_app/routes/RouterManager.dart';
import 'package:marking_app/utils/index.dart';
import 'package:marking_app/utils/my_text.dart';
class ReviewItemView extends StatelessWidget {
final int markingUserId;
final int examSubjectId;
final ReviewItem item;
final bool exceptional;
final bool isHomeworkCorrection;
const ReviewItemView(this.markingUserId, this.item, this.examSubjectId,
{this.exceptional = false, this.isHomeworkCorrection = false, Key? key})
: super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (isHomeworkCorrection) {
// 作业跳转
RouterManager.router.navigateTo(
context,
'${RouterManager.markingHomeworkDoPath}?taskId=$markingUserId&detailId=${item.markingUserDetailId}&tabQuestionNum=${item.questionNo}',
transition: getTransition(),
);
return;
}
RouterManager.router.navigateTo(
context,
'${RouterManager.markingDoPath}?questionNum=${Uri.encodeComponent(item.questionNum)}&markingUserId=$markingUserId&examSubjectId=$examSubjectId&detailId=${item.markingUserDetailId}&pageOper=${2}&isReview=${1}&exceptional=${exceptional ? 1 : ''}',
transition: getTransition(),
);
},
child: Container(
padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 16.h, bottom: 10.h),
margin: EdgeInsets.only(top: 14.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.w),
),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color.fromRGBO(46, 91, 255, 0.2),
offset: Offset(2.w, 2.h), //阴影y轴偏移量
blurRadius: 14, //阴影模糊程度
spreadRadius: 0.5, //阴影扩散程度
)
],
),
child: Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (item.isException)
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.only(right: 2.w),
padding: EdgeInsets.only(bottom: 2.h),
child: Icon(
Icons.warning_amber_rounded,
color: const Color.fromRGBO(215, 74, 74, 1),
size: 18.sp,
),
),
Text(
'异常',
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14.sp,
color: const Color.fromRGBO(215, 74, 74, 1),
),
)
],
)
else
Text(
'评分:【${item.score}',
style: TextStyle(
fontSize: 14.sp,
color: const Color.fromRGBO(45, 56, 76, 1),
),
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: quickText(
isHomeworkCorrection ? '学生: ' + item.studentName! : 'ID: ${item.markingUserDetailId}',
color: const Color.fromRGBO(148, 163, 182, 1),
size: 12.sp,
maxLines: 1,
),
),
)
],
),
Container(
width: double.infinity,
margin: EdgeInsets.only(top: 10.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4.w)),
boxShadow: [
BoxShadow(
color: const Color.fromRGBO(46, 91, 255, 0.2),
offset: Offset(4.w, 6.h), //阴影y轴偏移量
blurRadius: 8, //阴影模糊程度
spreadRadius: 0.2, //阴影扩散程度
)
],
),
child: ClipRRect(
//是ClipRRect不是ClipRect
borderRadius: BorderRadius.circular(5.w),
child: FadeInImage.assetNetwork(
height: 100.h,
width: double.infinity,
placeholder: "assets/images/review_loding.png",
image: item.studentAnswerList[0],
fit: BoxFit.cover,
imageErrorBuilder: (context, error, stackTrace) {
return ClipRRect(
//是ClipRRect不是ClipRect
borderRadius: BorderRadius.circular(5.w),
child: Image.asset(
width: double.infinity,
height: 100.h,
fit: BoxFit.cover,
"assets/images/review_error.png",
),
);
},
),
),
),
Container(
width: double.infinity,
margin: EdgeInsets.only(top: 12.h),
alignment: Alignment.centerRight,
child: Text(
item.finishedTime,
style: TextStyle(
fontSize: 12.sp,
color: const Color.fromRGBO(148, 163, 182, 1),
),
),
),
]),
),
);
}
}