报告饼图修改

This commit is contained in:
machuanyu 2024-03-20 17:02:15 +08:00
parent 047965aede
commit b2f50b10a6
3 changed files with 215 additions and 184 deletions

View File

@ -1,5 +1,6 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter_echart/flutter_echart.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
import 'package:marking_app/common/mixin/common.dart';
@ -235,6 +236,7 @@ class _JobReportState extends State<JobReport> with CommonMixin {
@override
Widget build(BuildContext context) {
bool isPadFlag = isPad();
return Scaffold(
backgroundColor: Color.fromRGBO(245, 245, 245, 1),
appBar: AppBar(
@ -337,7 +339,7 @@ class _JobReportState extends State<JobReport> with CommonMixin {
height: 6.r,
),
SizedBox(
height: data.kgReport.details.length > 10 ? 300.r : data.kgReport.details.length * 50.r + 20.r,
height: data.kgReport.details.length > 10 ? 300.r : data.kgReport.details.length * 50.r + (isPadFlag == true ?40.r:65.r),
child: ReportTable(
headList: ['', '作答率', '作答人数', '正确率', '标准答案', '优先批阅概况'],
bodyList: data.kgReport.details,
@ -379,7 +381,7 @@ class _JobReportState extends State<JobReport> with CommonMixin {
height: 10.r,
),
SizedBox(
height: data.zgReport.details.length > 10 ? 300.r : data.zgReport.details.length * 50.r + 20.r,
height: data.zgReport.details.length > 10 ? 300.r : data.zgReport.details.length * 50.r + 50.r,
child: ReportTable(
headList: ['', '作答率', '作答人数', '正确率', '查看原题', '优先批阅概况'],
bodyList: data.zgReport.details,
@ -1196,7 +1198,7 @@ Widget $overallPerformance(int totalNumber, List<OverallTitles> overallTitles) {
Color.fromRGBO(104, 136, 253, 1),
Color.fromRGBO(255, 186, 33, 1),
Color.fromRGBO(243, 163, 44, 1),
Color.fromRGBO(211, 211, 211, 1).withOpacity(0.5),
Color.fromRGBO(201, 201, 201, 1),
Color.fromRGBO(211, 211, 211, 1),
];
return Container(
@ -1216,7 +1218,36 @@ Widget $overallPerformance(int totalNumber, List<OverallTitles> overallTitles) {
margin: EdgeInsets.only(bottom: 20.h),
),
Expanded(
child: PieChart(
child: PieChatWidget(
dataList: overallTitles.asMap().keys.map((index) {
var e = overallTitles[index];
return EChartPieBean(
title: e.title,
number: e.count,
color: colorMap[index]);
}).toList(),
//
isBackground: true,
//线
isLineText: true,
//
bgColor: Colors.white,
//
isFrontgText: false,
//
initSelect: 1,
//
openType: OpenType.ANI,
//
loopType: LoopType.DOWN_LOOP,
//
clickCallBack: (int value) {
print("当前点击显示 $value");
},
),
/* PieChart(
PieChartData(
borderData: FlBorderData(show: false),
sectionsSpace: 0,
@ -1232,7 +1263,7 @@ Widget $overallPerformance(int totalNumber, List<OverallTitles> overallTitles) {
);
}).toList(),
),
),
),*/
)
],
),
@ -1309,10 +1340,9 @@ Widget $unitTimeAnsweringSituation(BuildContext context, int jobid, List<Questio
return false; //
}
return Container(
width: double.infinity,
height: isPad() ? 520.h : 460.h,
// height: isPad() ? 520.h : 460.h,
margin: EdgeInsets.only(top: 20.h),
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 12.w),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10.r)),
@ -1323,137 +1353,135 @@ Widget $unitTimeAnsweringSituation(BuildContext context, int jobid, List<Questio
child: quickText('整体表现', color: Color.fromRGBO(92, 92, 92, 1), size: 14.sp, fontWeight: FontWeight.bold),
margin: EdgeInsets.only(bottom: 20.h),
),
Expanded(
child: Scrollbar(
thickness: 8.w,
thumbVisibility: true,
trackVisibility: true,
radius: Radius.circular(10.r),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...mapData.entries.map((entrie) {
bool isViewButton = ['查看原题', '操作'].contains(entrie.key); //
bool isRatio = ['正确率', '错误率', '未做'].contains(entrie.key);
bool isQuestionNo = entrie.key == '题号';
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 94.r,
Scrollbar(
thickness: 8.w,
thumbVisibility: true,
trackVisibility: true,
radius: Radius.circular(10.r),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...mapData.entries.map((entrie) {
bool isViewButton = ['查看原题', '操作'].contains(entrie.key); //
bool isRatio = ['正确率', '错误率', '未做'].contains(entrie.key);
bool isQuestionNo = entrie.key == '题号';
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 94.r,
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
color: Color.fromRGBO(230, 230, 230, 1),
child: quickText(entrie.key, color: Color.fromRGBO(24, 35, 77, 1), size: 12.sp, maxLines: 2),
),
...entrie.value.map((e) {
bool noHasChineseCharacter = isQuestionNo && !containsChinese(e);
return Container(
width: 96.r,
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
color: Color.fromRGBO(230, 230, 230, 1),
child: quickText(entrie.key, color: Color.fromRGBO(24, 35, 77, 1), size: 12.sp, maxLines: 2),
),
...entrie.value.map((e) {
bool noHasChineseCharacter = isQuestionNo && !containsChinese(e);
return Container(
width: 96.r,
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
color: Color.fromRGBO(245, 245, 245, 1),
child: isViewButton
? InkWell(
onTap: () {
// e
var _qpm = e as QuestionPictureModel;
// if (entrie.key == '操作') {
// showDialog(
// context: context,
// builder: (BuildContext context1) {
// return Container(
// margin: EdgeInsets.symmetric(vertical: 150.h, horizontal: 24.w),
// padding: EdgeInsets.symmetric(vertical: 15.h),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(18.sp),
// ),
// child: Column(
// children: [
// Container(
// child: quickText('${_qpm.questionNo}',
// color: Color.fromRGBO(60, 60, 60, 1), size: 15.sp)),
// Expanded(
// child: ListView(
// padding: EdgeInsets.symmetric(horizontal: 12.w),
// children: [
// DataTable(
// sortAscending: false,
// columns: [
// DataColumn(
// label: quickText('姓名',
// color: Color.fromRGBO(114, 114, 114, 1),
// size: 14.sp,
// fontWeight: FontWeight.bold),
// ),
// ],
// rows: [],
// ),
// ]),
// )
// ],
// ),
// );
// },
// );
// return;
// }
if (_qpm.questionPicture == null) return ToastUtils.showInfo('当前试题没有原题');
Navigator.push(
context,
MaterialPageRoute(builder: (_) {
return Scaffold(
appBar: AppBar(),
body: PhotoView(imageProvider: NetworkImage(_qpm.questionPicture!)),
);
}),
);
},
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
quickText('查看', color: Color.fromRGBO(239, 135, 20, 1), size: 12.sp),
Container(
padding: EdgeInsets.only(top: 1.h),
child: Icon(
Icons.arrow_forward_ios,
size: 10.sp,
color: Color.fromRGBO(239, 135, 20, 1),
),
color: Color.fromRGBO(245, 245, 245, 1),
child: isViewButton
? InkWell(
onTap: () {
// e
var _qpm = e as QuestionPictureModel;
// if (entrie.key == '操作') {
// showDialog(
// context: context,
// builder: (BuildContext context1) {
// return Container(
// margin: EdgeInsets.symmetric(vertical: 150.h, horizontal: 24.w),
// padding: EdgeInsets.symmetric(vertical: 15.h),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(18.sp),
// ),
// child: Column(
// children: [
// Container(
// child: quickText('${_qpm.questionNo}',
// color: Color.fromRGBO(60, 60, 60, 1), size: 15.sp)),
// Expanded(
// child: ListView(
// padding: EdgeInsets.symmetric(horizontal: 12.w),
// children: [
// DataTable(
// sortAscending: false,
// columns: [
// DataColumn(
// label: quickText('姓名',
// color: Color.fromRGBO(114, 114, 114, 1),
// size: 14.sp,
// fontWeight: FontWeight.bold),
// ),
// ],
// rows: [],
// ),
// ]),
// )
// ],
// ),
// );
// },
// );
// return;
// }
if (_qpm.questionPicture == null) return ToastUtils.showInfo('当前试题没有原题');
Navigator.push(
context,
MaterialPageRoute(builder: (_) {
return Scaffold(
appBar: AppBar(),
body: PhotoView(imageProvider: NetworkImage(_qpm.questionPicture!)),
);
}),
);
},
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
quickText('查看', color: Color.fromRGBO(239, 135, 20, 1), size: 12.sp),
Container(
padding: EdgeInsets.only(top: 1.h),
child: Icon(
Icons.arrow_forward_ios,
size: 10.sp,
color: Color.fromRGBO(239, 135, 20, 1),
),
),
],
),
)
: RegExp(r'^\d+$').hasMatch(e) || (e.contains('%') && e.length < 4)
? Row(
mainAxisSize: MainAxisSize.min,
children: [
quickText(e,
color: isRatio
? Theme.of(context).primaryColor
: Color.fromRGBO(82, 82, 82, 1),
size: isRatio || noHasChineseCharacter ? 12.sp : 12.sp,
maxLines: 2),
quickText('', color: Colors.transparent, size: 12.sp),
],
),
)
: RegExp(r'^\d+$').hasMatch(e) || (e.contains('%') && e.length < 4)
? Row(
mainAxisSize: MainAxisSize.min,
children: [
quickText(e,
color: isRatio
? Theme.of(context).primaryColor
: Color.fromRGBO(82, 82, 82, 1),
size: isRatio || noHasChineseCharacter ? 12.sp : 12.sp,
maxLines: 2),
quickText('', color: Colors.transparent, size: 12.sp),
],
)
: quickText(e,
color: isRatio ? Theme.of(context).primaryColor : Color.fromRGBO(82, 82, 82, 1),
size: isRatio || noHasChineseCharacter ? 12.sp : 12.sp,
maxLines: 2),
);
}).toList(),
],
);
}).toList(),
],
),
)
: quickText(e,
color: isRatio ? Theme.of(context).primaryColor : Color.fromRGBO(82, 82, 82, 1),
size: isRatio || noHasChineseCharacter ? 12.sp : 12.sp,
maxLines: 2),
);
}).toList(),
],
);
}).toList(),
],
),
),
),
@ -1494,7 +1522,7 @@ Widget $personnelDataOverview(BuildContext context, List<StudentAnswerInfos> stu
return Container(
width: double.infinity,
height: isPad() ? 290.h : 264.h,
// height: isPad() ? 290.h : 264.h,
margin: EdgeInsets.only(top: 20.h),
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 12.w),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10.r)),
@ -1505,57 +1533,55 @@ Widget $personnelDataOverview(BuildContext context, List<StudentAnswerInfos> stu
child: quickText('人员数据概况', color: Color.fromRGBO(92, 92, 92, 1), size: 14.sp, fontWeight: FontWeight.bold),
margin: EdgeInsets.only(bottom: 20.h),
),
Expanded(
child: Scrollbar(
thickness: 8.w,
thumbVisibility: true,
trackVisibility: true,
radius: Radius.circular(10.r),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...mapData.entries.map((entrie) {
bool isTransparentChinese = ['答题时长', '正确率', '未答题数'].contains(entrie.key); //
Scrollbar(
thickness: 8.w,
thumbVisibility: true,
trackVisibility: true,
radius: Radius.circular(10.r),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...mapData.entries.map((entrie) {
bool isTransparentChinese = ['答题时长', '正确率', '未答题数'].contains(entrie.key); //
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 94.r,
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 94.r,
alignment: Alignment.center,
color: Color.fromRGBO(230, 230, 230, 1),
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
child: quickText(entrie.key, color: Color.fromRGBO(24, 35, 77, 1), size: 12.sp, maxLines: 2),
),
...entrie.value.map((e) {
bool isTransparentChineseNew = isTransparentChinese && (e?.length ?? 0) == 0;
return Container(
width: 100.r,
alignment: Alignment.center,
color: Color.fromRGBO(230, 230, 230, 1),
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
child: quickText(entrie.key, color: Color.fromRGBO(24, 35, 77, 1), size: 12.sp, maxLines: 2),
),
...entrie.value.map((e) {
bool isTransparentChineseNew = isTransparentChinese && (e?.length ?? 0) == 0;
return Container(
width: 100.r,
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 1.h, right: 1.w),
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 8.w),
color: Color.fromRGBO(245, 245, 245, 1),
child: isTransparentChineseNew
? quickText('透明', color: Colors.transparent, size: 12.sp)
: RegExp(r'^\d+$').hasMatch(e) || e.contains('%')
? Row(
mainAxisSize: MainAxisSize.min,
children: [
quickText(e, color: Color.fromRGBO(82, 82, 82, 1), size: 12.sp, maxLines: 2),
quickText('', color: Colors.transparent, size: 12.sp),
],
)
: quickText(e, color: Color.fromRGBO(82, 82, 82, 1), size: 12.sp, maxLines: 2),
);
}).toList(),
],
);
}).toList(),
],
),
color: Color.fromRGBO(245, 245, 245, 1),
child: isTransparentChineseNew
? quickText('透明', color: Colors.transparent, size: 12.sp)
: RegExp(r'^\d+$').hasMatch(e) || e.contains('%')
? Row(
mainAxisSize: MainAxisSize.min,
children: [
quickText(e, color: Color.fromRGBO(82, 82, 82, 1), size: 12.sp, maxLines: 2),
quickText('', color: Colors.transparent, size: 12.sp),
],
)
: quickText(e, color: Color.fromRGBO(82, 82, 82, 1), size: 12.sp, maxLines: 2),
);
}).toList(),
],
);
}).toList(),
],
),
),
),

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:marking_app/utils/easy_refresh/MyEmptyWidget.dart';
import 'package:marking_app/utils/index.dart';
import 'package:marking_app/utils/toast_utils.dart';
import 'package:photo_view/photo_view.dart';
@ -283,6 +284,7 @@ class _ReportTableState extends State<ReportTable> {
@override
Widget build(BuildContext context) {
bool isPadFlag = isPad();
return DataTable2(
dividerThickness: 0,
scrollController: _controller,
@ -314,7 +316,7 @@ class _ReportTableState extends State<ReportTable> {
fixedCornerColor: Colors.grey[400],
minWidth: widget.headList.length > 6
? 80.r * widget.headList.length
: MediaQuery.of(context).size.width,
: isPadFlag?MediaQuery.of(context).size.width:85.r * widget.headList.length,
fixedTopRows: widget.fixedRows!,
fixedLeftColumns: widget.fixedCols!,
sortColumnIndex: _sortColumnIndex,
@ -332,8 +334,8 @@ class _ReportTableState extends State<ReportTable> {
? 40.r
: widget.headList.length > 6
? 80.r
: (MediaQuery.of(context).size.width - 8.r) /
widget.headList.length,
: isPadFlag?(MediaQuery.of(context).size.width - 8.r) /
widget.headList.length:85.r,
);
}),
rows: List<DataRow>.generate(widget.bodyList.length,

View File

@ -112,6 +112,9 @@ dependencies:
data_table_2: ^2.5.10
syncfusion_flutter_datepicker: ^21.2.10
flutter_staggered_grid_view: ^0.6.2
# 饼图
flutter_echart: ^2.0.0
dev_dependencies:
flutter_test: