Commit be51012f by 吴春元

bug 修改

parent f8c76167
...@@ -7,11 +7,11 @@ class Api { ...@@ -7,11 +7,11 @@ class Api {
// IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/"; // IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/";
///演示 ip ///演示 ip
// static String URL = "http://47.92.138.92:8009/"; static String URL = "http://47.92.138.92:8009/";
// static String URL = "http://192.168.19.164:8087/"; // static String URL = "http://192.168.19.164:8087/";
static String URL = "http://192.168.19.165:2212/"; // static String URL = "http://192.168.19.165:2212/";
static String START_URL = "special/a/", static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true"; END_URL = "__ajax=true&mobileLogin=true";
......
...@@ -4,6 +4,7 @@ import 'dart:developer'; ...@@ -4,6 +4,7 @@ import 'dart:developer';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/route_manager.dart';
import 'package:special_equipment_flutter/dio/dio/do_utils.dart'; import 'package:special_equipment_flutter/dio/dio/do_utils.dart';
import 'package:special_equipment_flutter/model/app_is_open.dart'; import 'package:special_equipment_flutter/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/app_roles.dart'; import 'package:special_equipment_flutter/model/app_roles.dart';
...@@ -44,6 +45,7 @@ import 'package:special_equipment_flutter/model/upload_multifile.dart'; ...@@ -44,6 +45,7 @@ import 'package:special_equipment_flutter/model/upload_multifile.dart';
import 'package:special_equipment_flutter/model/user_list.dart'; import 'package:special_equipment_flutter/model/user_list.dart';
import 'package:special_equipment_flutter/model/week_control_list_sy_bo.dart'; import 'package:special_equipment_flutter/model/week_control_list_sy_bo.dart';
import 'package:special_equipment_flutter/ui/common/data.dart'; import 'package:special_equipment_flutter/ui/common/data.dart';
import 'package:special_equipment_flutter/utils/eventbus_utils.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart'; import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart'; import 'package:special_equipment_flutter/utils/toast_utils.dart';
...@@ -1238,12 +1240,41 @@ class HttpUtils { ...@@ -1238,12 +1240,41 @@ class HttpUtils {
'交卷中'); '交卷中');
try { try {
BaseModel entity = BaseModel.fromJson(response); BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body; if (entity.success!) {
ExamResultBo examResultBo = ExamResultBo.fromJson(resultData); Map<String, dynamic> resultData = entity.body;
if (entity.errorCode == "-1") { ExamResultBo examResultBo = ExamResultBo.fromJson(resultData);
return examResultBo; if (entity.errorCode == "-1") {
return examResultBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} else { } else {
ToastUtils.showCenter(entity.msg!); showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return AlertDialog(
title: const Text("温馨提示"),
content: Text(entity.msg!),
actionsPadding: const EdgeInsets.only(
left: 0, top: 0, bottom: 10, right: 20),
contentPadding: const EdgeInsets.only(
left: 20, top: 0, bottom: 10, right: 20),
titlePadding: const EdgeInsets.only(
left: 20, top: 20, bottom: 10, right: 20),
actions: [
TextButton(
child: const Text("确定"),
onPressed: () {
//发出通知
EventBusUtils.getInstance()?.fire("1");
Get.back();
Get.back();
})
],
);
});
return; return;
} }
} catch (e) { } catch (e) {
......
...@@ -162,7 +162,9 @@ class NetUtils { ...@@ -162,7 +162,9 @@ class NetUtils {
ToastUtils.showCenter(entity.msg!); ToastUtils.showCenter(entity.msg!);
} }
} else { } else {
ToastUtils.showCenter(entity.msg!); if (entity.msg != '试卷已被安全监察人员删除,请查看是否有新试卷!') {
ToastUtils.showCenter(entity.msg!);
}
} }
isLoading ? Loading.dismiss() : null; isLoading ? Loading.dismiss() : null;
return response.data; return response.data;
......
...@@ -53,6 +53,8 @@ class UserLists { ...@@ -53,6 +53,8 @@ class UserLists {
String? roleNames; String? roleNames;
bool? admin; bool? admin;
bool? isChecked = false; bool? isChecked = false;
bool? isUserSafetyDirectorChecked = true;
bool? isUserSafetyOfficerChecked = true;
UserLists copyWith({ UserLists copyWith({
String? id, String? id,
......
...@@ -108,158 +108,192 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin { ...@@ -108,158 +108,192 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
backgroundColor: Colors.grey[100], onWillPop: () async {
appBar: AppBarCustom( Get.dialog(AlertDialog(
leading: IconButton( title: const Text("温馨提示"),
iconSize: 20, content: const Text("您确定要结束当前考试?"),
icon: const Icon(Icons.arrow_back_ios), actionsPadding:
color: ColorConst.whiteColor, const EdgeInsets.only(left: 0, top: 0, bottom: 10, right: 20),
onPressed: () { contentPadding:
Get.dialog(AlertDialog( const EdgeInsets.only(left: 20, top: 0, bottom: 10, right: 20),
title: const Text("温馨提示"), titlePadding:
content: const Text("您确定要结束当前考试?"), const EdgeInsets.only(left: 20, top: 20, bottom: 10, right: 20),
actionsPadding: const EdgeInsets.only( shape: const RoundedRectangleBorder(
left: 0, top: 0, bottom: 10, right: 20), // 这里设置shape属性
contentPadding: const EdgeInsets.only( borderRadius: BorderRadius.all(Radius.circular(10.0))),
left: 20, top: 0, bottom: 10, right: 20), actions: <Widget>[
titlePadding: const EdgeInsets.only( TextButton(
left: 20, top: 20, bottom: 10, right: 20), child: const Text("取消", style: TextStyle(fontSize: 16)),
shape: const RoundedRectangleBorder( onPressed: () {
// 这里设置shape属性 Get.back();
borderRadius: BorderRadius.all(Radius.circular(10.0))), },
actions: <Widget>[ ),
TextButton( TextButton(
child: const Text("取消", style: TextStyle(fontSize: 16)), child: const Text("确定", style: TextStyle(fontSize: 16)),
onPressed: () { onPressed: () {
Get.back(); Get.back();
}, Get.back();
), },
TextButton( ),
child: const Text("确定", style: TextStyle(fontSize: 16)), ],
onPressed: () { ));
Get.back(); return true; // 控制是否可以侧滑返回,true为允许,false为不允许
Get.back(); },
}, child: Scaffold(
), backgroundColor: Colors.grey[100],
], appBar: AppBarCustom(
)); leading: IconButton(
}, iconSize: 20,
icon: const Icon(Icons.arrow_back_ios),
color: ColorConst.whiteColor,
onPressed: () {
Get.dialog(AlertDialog(
title: const Text("温馨提示"),
content: const Text("您确定要结束当前考试?"),
actionsPadding: const EdgeInsets.only(
left: 0, top: 0, bottom: 10, right: 20),
contentPadding: const EdgeInsets.only(
left: 20, top: 0, bottom: 10, right: 20),
titlePadding: const EdgeInsets.only(
left: 20, top: 20, bottom: 10, right: 20),
shape: const RoundedRectangleBorder(
// 这里设置shape属性
borderRadius: BorderRadius.all(Radius.circular(10.0))),
actions: <Widget>[
TextButton(
child: const Text("取消", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
},
),
TextButton(
child: const Text("确定", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
Get.back();
},
),
],
));
},
///这里设置了按钮的内边距为零,可以消除默认的16像素间距 ///这里设置了按钮的内边距为零,可以消除默认的16像素间距
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
),
text: '考核',
height: 50,
), ),
text: '考核',
height: 50,
),
///答题卡抽屉 ///答题卡抽屉
body: SlidingUpPanel( body: SlidingUpPanel(
backdropEnabled: true, backdropEnabled: true,
controller: controller, controller: controller,
minHeight: 50, minHeight: 50,
maxHeight: 510, maxHeight: 510,
///答题卡区 ///答题卡区
panel: Container( panel: Container(
color: Colors.grey[200], color: Colors.grey[200],
child: Stack( child: Stack(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
if (controller!.isPanelClosed) { if (controller!.isPanelClosed) {
controller!.open(); controller!.open();
} else { } else {
controller!.close(); controller!.close();
} }
}); });
}, },
child: Container( child: Container(
padding: const EdgeInsets.only(top: 7, bottom: 6), padding: const EdgeInsets.only(top: 7, bottom: 6),
// color: Colors.grey[300], // color: Colors.grey[300],
child: Stack( child: Stack(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
children: [ children: [
Column( Column(
children: [
Image.asset(
'assets/examine/answer_sheet_black_icon.png',
width: 20,
height: 20,
),
Container(
margin: const EdgeInsets.only(top: 2)),
const Text(
'答题卡',
style: TextStyle(fontSize: 12),
)
],
),
Container(
margin: const EdgeInsets.only(right: 15),
child: Text.rich(
softWrap: true,
TextSpan(children: [
TextSpan(
text: "${_currentPage + 1}",
style: const TextStyle(
fontSize: 20,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
TextSpan(
text:
" /${examQuestionList!.length}",
style: const TextStyle(
fontSize: 15,
color: Colors.black87)),
])),
),
],
),
),
),
Container(
height: 380,
margin: const EdgeInsets.only(
top: 0, left: 10, right: 10),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Column(
children: [ children: [
Image.asset( if (examQuestionDList!.isNotEmpty) ...{
'assets/examine/answer_sheet_black_icon.png', buildSliverToBoxAdapter('选择题'),
width: 20, buildAnswerSheetList(examQuestionDList),
height: 20, },
), if (examQuestionPList!.isNotEmpty) ...{
Container( buildSliverToBoxAdapter('判断题'),
margin: const EdgeInsets.only(top: 2)), buildAnswerSheetList(examQuestionPList),
const Text( }
'答题卡',
style: TextStyle(fontSize: 12),
)
], ],
), ))
Container(
margin: const EdgeInsets.only(right: 15),
child: Text.rich(
softWrap: true,
TextSpan(children: [
TextSpan(
text: "${_currentPage + 1}",
style: const TextStyle(
fontSize: 20,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
TextSpan(
text: " /${examQuestionList!.length}",
style: const TextStyle(
fontSize: 15,
color: Colors.black87)),
])),
),
], ],
), ),
), ),
), ]),
Container( buildSubmit()
height: 380, ],
margin: ),
const EdgeInsets.only(top: 0, left: 10, right: 10),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Column(
children: [
if (examQuestionDList!.isNotEmpty) ...{
buildSliverToBoxAdapter('选择题'),
buildAnswerSheetList(examQuestionDList),
},
if (examQuestionPList!.isNotEmpty) ...{
buildSliverToBoxAdapter('判断题'),
buildAnswerSheetList(examQuestionPList),
}
],
))
],
),
),
]),
buildSubmit()
],
), ),
),
///内容区 ///内容区
body: Column(children: [buildExpanded()]), body: Column(children: [buildExpanded()]),
)); )),
);
} }
Container buildSliverToBoxAdapter(var text) { Container buildSliverToBoxAdapter(var text) {
...@@ -519,8 +553,6 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin { ...@@ -519,8 +553,6 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
onPressed: () { onPressed: () {
//关闭弹窗 //关闭弹窗
Get.back(); Get.back();
// printLog(
// "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}");
HttpUtils.getExamSubmit(context, examineQuestionsBo) HttpUtils.getExamSubmit(context, examineQuestionsBo)
.then((value) { .then((value) {
ExamResultBo examResultBo = value; ExamResultBo examResultBo = value;
......
...@@ -54,137 +54,174 @@ class _ExamResultPageState extends State<ExamResultPage> { ...@@ -54,137 +54,174 @@ class _ExamResultPageState extends State<ExamResultPage> {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
), ),
body: Container( body: Column(
height: 300, children: [
width: double.infinity, Container(
margin: const EdgeInsets.only(top: 15, left: 15, right: 15, bottom: 15), width: double.infinity,
padding: const EdgeInsets.all(10), margin:
decoration: const BoxDecoration( const EdgeInsets.only(left: 15, right: 15, top: 20, bottom: 0),
color: Colors.white, padding:
borderRadius: BorderRadius.all(Radius.circular(5)), const EdgeInsets.only(left: 5, right: 5, top: 3, bottom: 3),
), decoration: BoxDecoration(
child: Column( color: Colors.orange[50],
children: [ borderRadius: const BorderRadius.only(
const SizedBox(height: 10), topLeft: Radius.circular(5),
const Row( topRight: Radius.circular(5),
mainAxisAlignment: MainAxisAlignment.center, bottomLeft: Radius.circular(5),
bottomRight: Radius.circular(5))),
child: const Text.rich(
softWrap: true,
TextSpan(children: [
TextSpan(
text: "小提示:考核成绩 ",
style: TextStyle(fontSize: 14, color: Colors.orange)),
TextSpan(
text: '90',
style: TextStyle(
fontSize: 20,
color: Colors.green,
fontWeight: FontWeight.bold)),
TextSpan(
text: " 为合格",
style: TextStyle(fontSize: 14, color: Colors.orange))
])),
),
Container(
height: 300,
width: double.infinity,
margin:
const EdgeInsets.only(top: 5, left: 15, right: 15, bottom: 15),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [ children: [
Text( const Row(
'—————— ', mainAxisAlignment: MainAxisAlignment.center,
style: TextStyle(color: ColorConst.grayf5Color), children: [
Text(
'—————— ',
style: TextStyle(color: ColorConst.grayf5Color),
),
Text('本次考核成绩'),
Text(
' ——————',
style: TextStyle(color: ColorConst.grayf5Color),
)
],
), ),
Text('本次考核成绩'), const SizedBox(height: 10),
Text( Text(
' ——————', examResultDataBo!.score!.round().toString(),
style: TextStyle(color: ColorConst.grayf5Color), style: TextStyle(
) color: examResultDataBo!.score! < 90
], ? Colors.red
), : Colors.green,
const SizedBox(height: 10), fontSize: 20,
Text( fontWeight: FontWeight.bold),
examResultDataBo!.score!.round().toString(), ),
style: TextStyle( const SizedBox(height: 20),
color: Row(
examResultDataBo!.score! < 90 ? Colors.red : Colors.green, mainAxisAlignment: MainAxisAlignment.center,
fontSize: 20,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (examResultDataBo!.adopt == '1') ...[
Image.asset(
'assets/examine/pass_icon.png',
width: 100,
height: 100,
),
] else ...[
Image.asset(
'assets/examine/no_pass_icon.png',
width: 100,
height: 100,
),
],
Container(
height: 100,
width: 1,
color: ColorConst.grayf5Color,
margin: const EdgeInsets.only(left: 20, right: 40)),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text.rich( if (examResultDataBo!.adopt == '1') ...[
softWrap: true, Image.asset(
TextSpan(children: [ 'assets/examine/pass_icon.png',
const TextSpan( width: 100,
text: "答对 ", height: 100,
style: ),
TextStyle(fontSize: 14, color: Colors.grey)), ] else ...[
TextSpan( Image.asset(
text: "${examResultDataBo!.correct.toString()}题", 'assets/examine/no_pass_icon.png',
style: const TextStyle( width: 100,
fontSize: 14, color: Colors.black87)), height: 100,
])), ),
const SizedBox(height: 20), ],
Text.rich( Container(
softWrap: true, height: 100,
TextSpan(children: [ width: 1,
const TextSpan( color: ColorConst.grayf5Color,
text: "答错 ", margin: const EdgeInsets.only(left: 20, right: 40)),
style: Column(
TextStyle(fontSize: 14, color: Colors.grey)), crossAxisAlignment: CrossAxisAlignment.start,
TextSpan( children: [
text: "${examResultDataBo!.error.toString()}题", Text.rich(
style: const TextStyle( softWrap: true,
fontSize: 14, color: Colors.black87)), TextSpan(children: [
])), const TextSpan(
const SizedBox(height: 20), text: "答对 ",
Text.rich( style: TextStyle(
softWrap: true, fontSize: 14, color: Colors.grey)),
TextSpan(children: [ TextSpan(
const TextSpan( text:
text: "总题 ", "${examResultDataBo!.correct.toString()}题",
style: style: const TextStyle(
TextStyle(fontSize: 14, color: Colors.grey)), fontSize: 14, color: Colors.black87)),
TextSpan( ])),
text: const SizedBox(height: 20),
"${examResultDataBo!.questionNum.toString()}题", Text.rich(
style: const TextStyle( softWrap: true,
fontSize: 14, color: Colors.black87)), TextSpan(children: [
])), const TextSpan(
text: "答错 ",
style: TextStyle(
fontSize: 14, color: Colors.grey)),
TextSpan(
text:
"${examResultDataBo!.error.toString()}题",
style: const TextStyle(
fontSize: 14, color: Colors.black87)),
])),
const SizedBox(height: 20),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "总题 ",
style: TextStyle(
fontSize: 14, color: Colors.grey)),
TextSpan(
text:
"${examResultDataBo!.questionNum.toString()}题",
style: const TextStyle(
fontSize: 14, color: Colors.black87)),
])),
],
)
], ],
) ),
const SizedBox(height: 40),
GradientButton(
tapCallback: () {
if (examResultDataBo!.adopt == '1') {
//发出通知
EventBusUtils.getInstance()?.fire("1");
Get.back(result: true);
} else {
Get.back(result: true);
getClickQuestionsPerson();
}
},
width: 300,
height: 40,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(10)),
disable: false,
colors: const [ColorConst.blueColor, ColorConst.blue1Color],
child: Text(
examResultDataBo!.adopt == '1' ? "关闭" : '继续答题',
style: const TextStyle(
fontSize: 14, color: ColorConst.whiteColor),
))
], ],
), ),
const SizedBox(height: 40), ),
GradientButton( ],
tapCallback: () {
if (examResultDataBo!.adopt == '1') {
//发出通知
EventBusUtils.getInstance()?.fire("1");
Get.back(result: true);
} else {
Get.back(result: true);
getClickQuestionsPerson();
}
},
width: 300,
height: 40,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10),
topRight: Radius.circular(20),
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(10)),
disable: false,
colors: const [ColorConst.blueColor, ColorConst.blue1Color],
child: Text(
examResultDataBo!.adopt == '1' ? "关闭" : '继续答题',
style: const TextStyle(
fontSize: 14, color: ColorConst.whiteColor),
))
],
),
), ),
); );
} }
......
...@@ -3,17 +3,13 @@ import 'package:get/get.dart'; ...@@ -3,17 +3,13 @@ import 'package:get/get.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart'; import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:special_equipment_flutter/common/color_const.dart'; import 'package:special_equipment_flutter/common/color_const.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart'; import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/exam_result_bo.dart';
import 'package:special_equipment_flutter/model/exam/test_questions_bo.dart'; import 'package:special_equipment_flutter/model/exam/test_questions_bo.dart';
import 'package:special_equipment_flutter/model/exam/test_setting_bo.dart'; import 'package:special_equipment_flutter/model/exam/test_setting_bo.dart';
import 'package:special_equipment_flutter/ui/examine/test/custom/bottom_sheet.dart'; import 'package:special_equipment_flutter/ui/examine/test/custom/bottom_sheet.dart';
import 'package:special_equipment_flutter/ui/examine/test/custom/choice_item.dart'; import 'package:special_equipment_flutter/ui/examine/test/custom/choice_item.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar_back.dart'; import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar_back.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart'; import 'package:special_equipment_flutter/widgets/custom_button.dart';
import '../../../common/route_string.dart';
///考核答题页面 ///考核答题页面
class TestPage extends StatefulWidget { class TestPage extends StatefulWidget {
var arguments = Get.arguments; var arguments = Get.arguments;
...@@ -85,158 +81,192 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin { ...@@ -85,158 +81,192 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
backgroundColor: Colors.white, onWillPop: () async {
appBar: AppBarCustom( Get.dialog(AlertDialog(
leading: IconButton( title: const Text("温馨提示"),
iconSize: 20, content: const Text("您确定要结束当前练习吗?"),
icon: const Icon(Icons.arrow_back_ios), actionsPadding:
color: ColorConst.whiteColor, const EdgeInsets.only(left: 0, top: 0, bottom: 10, right: 20),
onPressed: () { contentPadding:
Get.dialog(AlertDialog( const EdgeInsets.only(left: 20, top: 0, bottom: 10, right: 20),
title: const Text("温馨提示"), titlePadding:
content: const Text("您确定要结束当前练习吗?"), const EdgeInsets.only(left: 20, top: 20, bottom: 10, right: 20),
actionsPadding: const EdgeInsets.only( shape: const RoundedRectangleBorder(
left: 0, top: 0, bottom: 10, right: 20), // 这里设置shape属性
contentPadding: const EdgeInsets.only( borderRadius: BorderRadius.all(Radius.circular(10.0))),
left: 20, top: 0, bottom: 10, right: 20), actions: <Widget>[
titlePadding: const EdgeInsets.only( TextButton(
left: 20, top: 20, bottom: 10, right: 20), child: const Text("取消", style: TextStyle(fontSize: 16)),
shape: const RoundedRectangleBorder( onPressed: () {
// 这里设置shape属性 Get.back();
borderRadius: BorderRadius.all(Radius.circular(10.0))), },
actions: <Widget>[ ),
TextButton( TextButton(
child: const Text("取消", style: TextStyle(fontSize: 16)), child: const Text("确定", style: TextStyle(fontSize: 16)),
onPressed: () { onPressed: () {
Get.back(); Get.back();
}, Get.back();
), },
TextButton( ),
child: const Text("确定", style: TextStyle(fontSize: 16)), ],
onPressed: () { ));
Get.back(); return true; // 控制是否可以侧滑返回,true为允许,false为不允许
Get.back(); },
}, child: Scaffold(
), backgroundColor: Colors.white,
], appBar: AppBarCustom(
)); leading: IconButton(
}, iconSize: 20,
icon: const Icon(Icons.arrow_back_ios),
color: ColorConst.whiteColor,
onPressed: () {
Get.dialog(AlertDialog(
title: const Text("温馨提示"),
content: const Text("您确定要结束当前练习吗?"),
actionsPadding: const EdgeInsets.only(
left: 0, top: 0, bottom: 10, right: 20),
contentPadding: const EdgeInsets.only(
left: 20, top: 0, bottom: 10, right: 20),
titlePadding: const EdgeInsets.only(
left: 20, top: 20, bottom: 10, right: 20),
shape: const RoundedRectangleBorder(
// 这里设置shape属性
borderRadius: BorderRadius.all(Radius.circular(10.0))),
actions: <Widget>[
TextButton(
child: const Text("取消", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
},
),
TextButton(
child: const Text("确定", style: TextStyle(fontSize: 16)),
onPressed: () {
Get.back();
Get.back();
},
),
],
));
},
///这里设置了按钮的内边距为零,可以消除默认的16像素间距 ///这里设置了按钮的内边距为零,可以消除默认的16像素间距
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
),
text: '测试练习',
height: 50,
), ),
text: '测试练习',
height: 50,
),
///答题卡抽屉 ///答题卡抽屉
body: SlidingUpPanel( body: SlidingUpPanel(
backdropEnabled: true, backdropEnabled: true,
controller: controller, controller: controller,
minHeight: 50, minHeight: 50,
maxHeight: 510, maxHeight: 510,
///答题卡区 ///答题卡区
panel: Container( panel: Container(
color: Colors.grey[200], color: Colors.grey[200],
child: Stack( child: Stack(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
if (controller!.isPanelClosed) { if (controller!.isPanelClosed) {
controller!.open(); controller!.open();
} else { } else {
controller!.close(); controller!.close();
} }
}); });
}, },
child: Container( child: Container(
padding: const EdgeInsets.only(top: 7, bottom: 6), padding: const EdgeInsets.only(top: 7, bottom: 6),
// color: Colors.grey[300], // color: Colors.grey[300],
child: Stack( child: Stack(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
children: [ children: [
Column( Column(
children: [
Image.asset(
'assets/examine/answer_sheet_black_icon.png',
width: 20,
height: 20,
),
Container(
margin: const EdgeInsets.only(top: 2)),
const Text(
'答题卡',
style: TextStyle(fontSize: 12),
)
],
),
Container(
margin: const EdgeInsets.only(right: 15),
child: Text.rich(
softWrap: true,
TextSpan(children: [
TextSpan(
text: "${_currentPage + 1}",
style: const TextStyle(
fontSize: 20,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
TextSpan(
text:
" /${examQuestionList!.length}",
style: const TextStyle(
fontSize: 15,
color: Colors.black87)),
])),
),
],
),
),
),
Container(
height: 380,
margin: const EdgeInsets.only(
top: 0, left: 10, right: 10),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Column(
children: [ children: [
Image.asset( if (examQuestionDList!.isNotEmpty) ...{
'assets/examine/answer_sheet_black_icon.png', buildSliverToBoxAdapter('选择题'),
width: 20, buildAnswerSheetList(examQuestionDList),
height: 20, },
), if (examQuestionPList!.isNotEmpty) ...{
Container( buildSliverToBoxAdapter('判断题'),
margin: const EdgeInsets.only(top: 2)), buildAnswerSheetList(examQuestionPList),
const Text( }
'答题卡',
style: TextStyle(fontSize: 12),
)
], ],
), ))
Container(
margin: const EdgeInsets.only(right: 15),
child: Text.rich(
softWrap: true,
TextSpan(children: [
TextSpan(
text: "${_currentPage + 1}",
style: const TextStyle(
fontSize: 20,
color: ColorConst.blueColor,
fontWeight: FontWeight.bold)),
TextSpan(
text: " /${examQuestionList!.length}",
style: const TextStyle(
fontSize: 15,
color: Colors.black87)),
])),
),
], ],
), ),
), ),
), ]),
Container( buildSubmit()
height: 380, ],
margin: ),
const EdgeInsets.only(top: 0, left: 10, right: 10),
padding: const EdgeInsets.all(10),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Column(
children: [
if (examQuestionDList!.isNotEmpty) ...{
buildSliverToBoxAdapter('选择题'),
buildAnswerSheetList(examQuestionDList),
},
if (examQuestionPList!.isNotEmpty) ...{
buildSliverToBoxAdapter('判断题'),
buildAnswerSheetList(examQuestionPList),
}
],
))
],
),
),
]),
buildSubmit()
],
), ),
),
///内容区 ///内容区
body: Column(children: [buildExpanded()]), body: Column(children: [buildExpanded()]),
)); )),
);
} }
Container buildSliverToBoxAdapter(var text) { Container buildSliverToBoxAdapter(var text) {
......
...@@ -82,6 +82,7 @@ class _HomePageState extends State<HomePage> ...@@ -82,6 +82,7 @@ class _HomePageState extends State<HomePage>
List<CountData>? findCountList = []; List<CountData>? findCountList = [];
ExaminePersonBo? mExaminePersonBo = ExaminePersonBo(); ExaminePersonBo? mExaminePersonBo = ExaminePersonBo();
OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo(); OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo();
int mOverseerHistoryCount = 0;
List<HistoryListData>? mHistoryListData = []; List<HistoryListData>? mHistoryListData = [];
//声明,后面需要销毁 //声明,后面需要销毁
...@@ -152,6 +153,7 @@ class _HomePageState extends State<HomePage> ...@@ -152,6 +153,7 @@ class _HomePageState extends State<HomePage>
if (mounted) { if (mounted) {
setState(() { setState(() {
mOverseerHistoryListBo = value; mOverseerHistoryListBo = value;
mOverseerHistoryCount = mOverseerHistoryListBo!.count!;
mHistoryListData = mOverseerHistoryListBo!.data; mHistoryListData = mOverseerHistoryListBo!.data;
}); });
} }
...@@ -489,7 +491,9 @@ class _HomePageState extends State<HomePage> ...@@ -489,7 +491,9 @@ class _HomePageState extends State<HomePage>
onTap: () { onTap: () {
Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE, Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE,
arguments: {})?.then((value) { arguments: {})?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
child: Container( child: Container(
...@@ -524,7 +528,7 @@ class _HomePageState extends State<HomePage> ...@@ -524,7 +528,7 @@ class _HomePageState extends State<HomePage>
style: TextStyle(fontSize: 12, color: Colors.orange)), style: TextStyle(fontSize: 12, color: Colors.orange)),
TextSpan( TextSpan(
text: mOverseerHistoryListBo != null text: mOverseerHistoryListBo != null
? mOverseerHistoryListBo!.count.toString() ? mOverseerHistoryCount.toString()
: '0', : '0',
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
...@@ -544,7 +548,8 @@ class _HomePageState extends State<HomePage> ...@@ -544,7 +548,8 @@ class _HomePageState extends State<HomePage>
}), }),
] else ...[ ] else ...[
Container( Container(
margin: const EdgeInsets.only(left: 5, right: 5, top: 0, bottom: 0), margin:
const EdgeInsets.only(left: 5, right: 5, top: 0, bottom: 30),
child: ListView.separated( child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
...@@ -562,7 +567,9 @@ class _HomePageState extends State<HomePage> ...@@ -562,7 +567,9 @@ class _HomePageState extends State<HomePage>
arguments: { arguments: {
'id': mHistoryListData![index].id, 'id': mHistoryListData![index].id,
})?.then((value) { })?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
child: Card( child: Card(
...@@ -746,6 +753,7 @@ class _HomePageState extends State<HomePage> ...@@ -746,6 +753,7 @@ class _HomePageState extends State<HomePage>
mHistoryListData! mHistoryListData!
.removeAt( .removeAt(
index); index);
mOverseerHistoryCount--;
ToastUtils ToastUtils
.showCenter( .showCenter(
'删除成功'); '删除成功');
...@@ -788,7 +796,9 @@ class _HomePageState extends State<HomePage> ...@@ -788,7 +796,9 @@ class _HomePageState extends State<HomePage>
'id': mHistoryListData![index] 'id': mHistoryListData![index]
.id, .id,
})?.then((value) { })?.then((value) {
if (value != null && value) {} if (value != null && value) {
getOverseerHistoryList();
}
}); });
}, },
width: 60, width: 60,
......
...@@ -8,6 +8,7 @@ import 'package:special_equipment_flutter/model/exam/overseer_history_informatio ...@@ -8,6 +8,7 @@ import 'package:special_equipment_flutter/model/exam/overseer_history_informatio
import 'package:special_equipment_flutter/utils/size_config.dart'; import 'package:special_equipment_flutter/utils/size_config.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart'; import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/time_util.dart'; import 'package:special_equipment_flutter/utils/time_util.dart';
import 'package:special_equipment_flutter/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/divider_custom.dart'; import 'package:special_equipment_flutter/widgets/divider_custom.dart';
import '../../widgets/app_bar/custom_app_bar.dart'; import '../../widgets/app_bar/custom_app_bar.dart';
...@@ -69,318 +70,327 @@ class _OverseerHistroyDetailsPageState ...@@ -69,318 +70,327 @@ class _OverseerHistroyDetailsPageState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
backgroundColor: ColorConst.grayf5Color, onWillPop: () async {
appBar: AppBarCustom( Get.back(result: true);
text: '监察记录详情', return true; // 控制是否可以侧滑返回,true为允许,false为不允许
height: 50, },
), child: Scaffold(
body: CustomScrollView( backgroundColor: ColorConst.grayf5Color,
primary: false, appBar: AppBarCustom(
shrinkWrap: true, text: '监察记录详情',
slivers: <Widget>[ height: 50,
SliverToBoxAdapter( ),
child: Card( body: CustomScrollView(
elevation: 0, primary: false,
margin: const EdgeInsets.only( shrinkWrap: true,
left: 0, right: 0, top: 15, bottom: 0), slivers: <Widget>[
color: Colors.white, SliverToBoxAdapter(
shape: const RoundedRectangleBorder( child: Card(
borderRadius: BorderRadius.all(Radius.circular(5)), elevation: 0,
), margin: const EdgeInsets.only(
child: Column( left: 0, right: 0, top: 15, bottom: 0),
children: [ color: Colors.white,
buildTitleContainer(Icons.insert_drive_file_outlined, shape: const RoundedRectangleBorder(
ColorConst.blueColor, '基本信息', Colors.black54), borderRadius: BorderRadius.all(Radius.circular(5)),
Container( ),
padding: const EdgeInsets.only( child: Column(
left: 40, right: 15, top: 0, bottom: 15), children: [
child: Column( buildTitleContainer(Icons.insert_drive_file_outlined,
crossAxisAlignment: CrossAxisAlignment.start, ColorConst.blueColor, '基本信息', Colors.black54),
children: <Widget>[ Container(
Text(data != null ? data!.officeName! : '', padding: const EdgeInsets.only(
style: const TextStyle( left: 40, right: 15, top: 0, bottom: 15),
fontWeight: FontWeight.bold, child: Column(
fontSize: 16, crossAxisAlignment: CrossAxisAlignment.start,
color: Colors.black54)), children: <Widget>[
Text(data != null ? data!.officeName! : '',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black54)),
///分割线 ///分割线
DividerCustom(Colors.grey[300], 8, 8, 0, 0), DividerCustom(Colors.grey[300], 8, 8, 0, 0),
Row(children: [ Row(children: [
const Text('设备类型:', const Text('设备类型:',
style: TextStyle( style: TextStyle(
fontSize: 14, color: Colors.black54)), fontSize: 14, color: Colors.black54)),
Text(data != null ? data!.typeName! : '', Text(data != null ? data!.typeName! : '',
style: TextStyle( style: TextStyle(
fontSize: 14, color: Colors.black54)), fontSize: 14, color: Colors.black54)),
]), ]),
const SizedBox(height: 5), const SizedBox(height: 5),
Text.rich( Text.rich(
softWrap: true, softWrap: true,
TextSpan(children: [ TextSpan(children: [
const TextSpan( const TextSpan(
text: "考核人数:", text: "考核人数:",
style: TextStyle( style: TextStyle(
fontSize: 14, color: Colors.black54)), fontSize: 14, color: Colors.black54)),
TextSpan( TextSpan(
text: data != null text: data != null
? data!.count.toString() ? data!.count.toString()
: '', : '',
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
const TextSpan(
text: "人",
style: TextStyle(
fontSize: 14, color: Colors.black54)),
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核状态:",
style: TextStyle(
fontSize: 14, color: Colors.black54)),
const TextSpan(
text: "已完成 ",
style: TextStyle(
color: ColorConst.greenColor)),
TextSpan(
text: data != null
? data!.complete.toString()
: '',
style: const TextStyle(
color: ColorConst.greenColor,
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " 人",
style: TextStyle(
color: ColorConst.greenColor)),
if (data != null
? data!.incomplete != 0
: true) ...[
const TextSpan( const TextSpan(
text: " | ", text: "",
style: TextStyle( style: TextStyle(
color: ColorConst.greyD2Color)), fontSize: 14, color: Colors.black54)),
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan( const TextSpan(
text: "进行中 ", text: "考核状态:",
style: TextStyle( style: TextStyle(
color: ColorConst.red1BgColor)), fontSize: 14, color: Colors.black54)),
const TextSpan(
text: "已完成 ",
style: TextStyle(
color: ColorConst.greenColor)),
TextSpan( TextSpan(
text: data != null text: data != null
? data!.incomplete.toString() ? data!.complete.toString()
: '', : '',
style: const TextStyle( style: const TextStyle(
color: ColorConst.red1BgColor, color: ColorConst.greenColor,
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
const TextSpan( const TextSpan(
text: " 人", text: " 人",
style: TextStyle( style: TextStyle(
color: ColorConst.red1BgColor)), color: ColorConst.greenColor)),
] if (data != null
])), ? data!.incomplete != 0
const SizedBox(height: 5), : true) ...[
Text.rich( const TextSpan(
softWrap: true, text: " | ",
TextSpan(children: [ style: TextStyle(
const TextSpan( color: ColorConst.greyD2Color)),
text: "考核时间:", const TextSpan(
style: TextStyle( text: "进行中 ",
fontSize: 14, color: Colors.black54)), style: TextStyle(
TextSpan( color: ColorConst.red1BgColor)),
text: timestampToDate( TextSpan(
data != null ? data!.createDate! : 0), text: data != null
style: const TextStyle( ? data!.incomplete.toString()
fontSize: 14, color: Colors.black54)), : '',
])), style: const TextStyle(
], color: ColorConst.red1BgColor,
), fontSize: 18,
) fontWeight: FontWeight.bold)),
], const TextSpan(
text: " 人",
style: TextStyle(
color: ColorConst.red1BgColor)),
]
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核时间:",
style: TextStyle(
fontSize: 14, color: Colors.black54)),
TextSpan(
text: timestampToDate2(
data != null ? data!.createDate! : 0),
style: const TextStyle(
fontSize: 14, color: Colors.black54)),
])),
],
),
)
],
),
), ),
), ),
), SliverToBoxAdapter(
SliverToBoxAdapter( child: Card(
child: Card( elevation: 0,
elevation: 0, margin: const EdgeInsets.only(
margin: const EdgeInsets.only( left: 0, right: 0, top: 15, bottom: 0),
left: 0, right: 0, top: 15, bottom: 0), color: Colors.white,
color: Colors.white, shape: const RoundedRectangleBorder(
shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(5)),
borderRadius: BorderRadius.all(Radius.circular(5)), ),
), child: Column(
child: Column( children: [
children: [ buildTitleContainer(Icons.event_repeat,
buildTitleContainer(Icons.event_repeat, ColorConst.blueColor, '考核状态', Colors.black54),
ColorConst.blueColor, '考核状态', Colors.black54), Container(
Container( padding: const EdgeInsets.only(
padding: const EdgeInsets.only( left: 30, right: 15, top: 0, bottom: 15),
left: 30, right: 15, top: 0, bottom: 15), child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ //文章列表
//文章列表 ListView.separated(
ListView.separated( shrinkWrap: true,
shrinkWrap: true, padding: const EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric( horizontal:
horizontal: EdgeInsetsConst.padding_horizontal), EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Container( return Container(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 10, right: 10, top: 10, bottom: 10), left: 10, right: 10, top: 10, bottom: 10),
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
left: 0, right: 0, top: 0, bottom: 5), left: 0, right: 0, top: 0, bottom: 5),
decoration: BoxDecoration( decoration: BoxDecoration(
color: rowList![index].adopt == "0" color: rowList![index].adopt == "0"
? ColorConst.red4BgColor ? ColorConst.red4BgColor
: Colors.green[50], : Colors.green[50],
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(
Radius.circular(5)), Radius.circular(5)),
), ),
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
children: [ CrossAxisAlignment.start,
Row( children: [
mainAxisAlignment: Row(
MainAxisAlignment.spaceBetween, mainAxisAlignment:
crossAxisAlignment: MainAxisAlignment.spaceBetween,
CrossAxisAlignment.start, crossAxisAlignment:
children: [ CrossAxisAlignment.start,
Text(rowList![index].user!.name!, children: [
style: const TextStyle( Text(rowList![index].user!.name!,
fontSize: 16, style: const TextStyle(
color: Colors.black54, fontSize: 16,
fontWeight: FontWeight.bold)), color: Colors.black54,
Text( fontWeight: FontWeight.bold)),
rowList![index].adopt == "0" Text(
? "进行中" rowList![index].adopt == "0"
: '已完成', ? "进行中"
style: TextStyle( : '已完成',
fontSize: 14, style: TextStyle(
color: fontSize: 14,
rowList![index].adopt == "0" color: rowList![index]
? ColorConst.red1BgColor .adopt ==
: ColorConst.greenColor, "0"
fontWeight: FontWeight.bold)), ? ColorConst.red1BgColor
], : ColorConst.greenColor,
), fontWeight: FontWeight.bold)),
Container( ],
height: 3, ),
width: 48, Container(
margin: const EdgeInsets.only(top: 2), height: 3,
decoration: BoxDecoration( width: 48,
color: rowList![index].adopt == "0" margin: const EdgeInsets.only(top: 2),
? Colors.red decoration: BoxDecoration(
: Colors.green, color: rowList![index].adopt == "0"
borderRadius: const BorderRadius.all( ? Colors.red
Radius.circular(5)), : Colors.green,
borderRadius: const BorderRadius.all(
Radius.circular(5)),
),
), ),
),
Container(
margin: const EdgeInsets.only(top: 5),
child: Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核人员身份:",
style: TextStyle(
color: Colors.black54)),
TextSpan(
text: rowList![index]
.positionType ==
'1'
? '安全总监'
: '安全员',
style: const TextStyle(
color: Colors.black54))
])),
),
if (rowList![index].adopt == "1") ...[
Container( Container(
margin: const EdgeInsets.only(top: 5), margin: const EdgeInsets.only(top: 5),
child: Text.rich( child: Text.rich(
softWrap: true, softWrap: true,
TextSpan(children: [ TextSpan(children: [
const TextSpan( const TextSpan(
text: "考核得分 ", text: "考核人员身份:",
style: TextStyle( style: TextStyle(
color: Colors.black54)), color: Colors.black54)),
TextSpan( TextSpan(
text: rowList![index] text: rowList![index]
.score! .positionType ==
.toString(), '1'
? '安全总监'
: '安全员',
style: const TextStyle( style: const TextStyle(
fontSize: 16, color: Colors.black54))
color:
ColorConst.greenColor,
fontWeight:
FontWeight.bold)),
const TextSpan(
text: " 分",
style: TextStyle(
color: Colors.black54)),
])), ])),
) ),
] if (rowList![index].adopt == "1") ...[
], Container(
), margin: const EdgeInsets.only(top: 5),
); child: Text.rich(
}, softWrap: true,
itemCount: rowList!.length, TextSpan(children: [
separatorBuilder: const TextSpan(
(BuildContext context, int index) { text: "考核得分 ",
return const SizedBox( style: TextStyle(
height: 0, color: Colors.black54)),
); TextSpan(
}, text: rowList![index]
), .score!
], .toString(),
), style: const TextStyle(
) fontSize: 16,
], color: ColorConst
.greenColor,
fontWeight:
FontWeight.bold)),
const TextSpan(
text: " 分",
style: TextStyle(
color: Colors.black54)),
])),
)
]
],
),
);
},
itemCount: rowList!.length,
separatorBuilder:
(BuildContext context, int index) {
return const SizedBox(
height: 0,
);
},
),
],
),
)
],
),
), ),
), ),
), // SliverToBoxAdapter(
// SliverToBoxAdapter( // child: Card(
// child: Card( // elevation: 5,
// elevation: 5, // shadowColor: ColorConst.greenColor,
// shadowColor: ColorConst.greenColor, // margin: const EdgeInsets.only(
// margin: const EdgeInsets.only( // left: 0, right: 0, top: 15, bottom: 0),
// left: 0, right: 0, top: 15, bottom: 0), // color: Colors.white,
// color: Colors.white, // shape: const RoundedRectangleBorder(
// shape: const RoundedRectangleBorder( // borderRadius: BorderRadius.all(Radius.circular(5)),
// borderRadius: BorderRadius.all(Radius.circular(5)), // ),
// ), // child: Column(
// child: Column( // children: [
// children: [ // buildTitleContainer(Icons.event_available,
// buildTitleContainer(Icons.event_available, // ColorConst.greenColor, '已完成', ColorConst.greenColor),
// ColorConst.greenColor, '已完成', ColorConst.greenColor), // Container(
// Container( // padding: const EdgeInsets.only(
// padding: const EdgeInsets.only( // left: 40, right: 15, top: 0, bottom: 15),
// left: 40, right: 15, top: 0, bottom: 15), // child: Column(
// child: Column( // crossAxisAlignment: CrossAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.start, // children: <Widget>[
// children: <Widget>[ //
// //
// //
// // ],
// ], // ),
// ), // )
// ) // ],
// ], // ),
// ), // ),
// ), // )
// ) ],
], )),
)); );
} }
Container buildTitleContainer( Container buildTitleContainer(
......
...@@ -6,6 +6,7 @@ import 'package:special_equipment_flutter/common/edgeInsets_const.dart'; ...@@ -6,6 +6,7 @@ import 'package:special_equipment_flutter/common/edgeInsets_const.dart';
import 'package:special_equipment_flutter/common/route_string.dart'; import 'package:special_equipment_flutter/common/route_string.dart';
import 'package:special_equipment_flutter/dio/http_utils.dart'; import 'package:special_equipment_flutter/dio/http_utils.dart';
import 'package:special_equipment_flutter/model/exam/overseer_history_list_bo.dart'; import 'package:special_equipment_flutter/model/exam/overseer_history_list_bo.dart';
import 'package:special_equipment_flutter/utils/eventbus_utils.dart';
import 'package:special_equipment_flutter/utils/storage_util.dart'; import 'package:special_equipment_flutter/utils/storage_util.dart';
import 'package:special_equipment_flutter/utils/string_utils.dart'; import 'package:special_equipment_flutter/utils/string_utils.dart';
import 'package:special_equipment_flutter/utils/time_util.dart'; import 'package:special_equipment_flutter/utils/time_util.dart';
...@@ -69,37 +70,43 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> { ...@@ -69,37 +70,43 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return WillPopScope(
appBar: AppBarCustom(text: '考核列表', height: 50), onWillPop: () async {
backgroundColor: Colors.grey[100], Get.back(result: true);
body: Column( return true; // 控制是否可以侧滑返回,true为允许,false为不允许
children: [ },
Expanded( child: Scaffold(
flex: 1, appBar: AppBarCustom(text: '考核列表', height: 50),
child: EasyRefresh( backgroundColor: Colors.grey[100],
firstRefresh: true, body: Column(
enableControlFinishRefresh: true, children: [
enableControlFinishLoad: true, Expanded(
firstRefreshWidget: const FirstRefreshWidget(), flex: 1,
emptyWidget: mHistoryListData!.isEmpty child: EasyRefresh(
? EmptyImgWidget( firstRefresh: true,
title: '暂无数据,点击刷新', enableControlFinishRefresh: true,
onTap: () { enableControlFinishLoad: true,
getOverseerHistoryList(); firstRefreshWidget: const FirstRefreshWidget(),
}) emptyWidget: mHistoryListData!.isEmpty
: null, ? EmptyImgWidget(
controller: _controller, title: '暂无数据,点击刷新',
onRefresh: () async { onTap: () {
page = 1; getOverseerHistoryList();
getOverseerHistoryList(); })
}, : null,
onLoad: () async { controller: _controller,
page++; onRefresh: () async {
getOverseerHistoryList(); page = 1;
}, getOverseerHistoryList();
child: buildBody(), },
)), onLoad: () async {
], page++;
getOverseerHistoryList();
},
child: buildBody(),
)),
],
),
), ),
); );
} }
...@@ -271,6 +278,9 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> { ...@@ -271,6 +278,9 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
setState(() { setState(() {
mHistoryListData! mHistoryListData!
.removeAt(index); .removeAt(index);
//发出通知
EventBusUtils.getInstance()
?.fire("2");
ToastUtils.showCenter('删除成功'); ToastUtils.showCenter('删除成功');
Get.back(); Get.back();
}); });
......
...@@ -512,10 +512,33 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> { ...@@ -512,10 +512,33 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
if (userSafetyDirectorList![index].isChecked!) { ///当前状态是否禁止选中 true 可选 可以操作
userSafetyDirectorList![index].isChecked = false; if (userSafetyDirectorList![index].isUserSafetyDirectorChecked!) {
///如果当前选择状态为 true,选中
if (userSafetyDirectorList![index].isChecked!) {
userSafetyDirectorList![index].isChecked = false;
for (var i = 0; i < userSafetyOfficerList!.length; i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyDirectorList![index].id ==
userSafetyOfficerList![i].id) {
userSafetyOfficerList![i].isUserSafetyOfficerChecked =
true;
}
}
} else {
///未选中
userSafetyDirectorList![index].isChecked = true;
for (var i = 0; i < userSafetyOfficerList!.length; i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyDirectorList![index].id ==
userSafetyOfficerList![i].id) {
userSafetyOfficerList![i].isUserSafetyOfficerChecked =
false;
}
}
}
} else { } else {
userSafetyDirectorList![index].isChecked = true; ///禁止选中
} }
}); });
}, },
...@@ -530,14 +553,70 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> { ...@@ -530,14 +553,70 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
child: Row( child: Row(
children: [ children: [
Checkbox( Checkbox(
value: userSafetyDirectorList![index].isChecked, value: userSafetyDirectorList![index]
onChanged: (value) { .isUserSafetyDirectorChecked!
setState(() { ? userSafetyDirectorList![index].isChecked
// selectedSafetyDirectorIndex = value!; : false,
}); side: MaterialStateBorderSide.resolveWith(
}, (Set<MaterialState> states) {
//设置未选中为灰色
return userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? null
: const BorderSide(width: 2, color: Colors.black12);
},
),
onChanged: userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? (value) {
if (value != null) {
setState(() {
///当前状态是否禁止选中 true 可选 可以操作
if (userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!) {
///如果当前选择状态为 true,选中
if (userSafetyDirectorList![index].isChecked!) {
userSafetyDirectorList![index].isChecked =
false;
for (var i = 0;
i < userSafetyOfficerList!.length;
i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyDirectorList![index].id ==
userSafetyOfficerList![i].id) {
userSafetyOfficerList![i]
.isUserSafetyOfficerChecked = true;
}
}
} else {
///未选中
userSafetyDirectorList![index].isChecked =
true;
for (var i = 0;
i < userSafetyOfficerList!.length;
i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyDirectorList![index].id ==
userSafetyOfficerList![i].id) {
userSafetyOfficerList![i]
.isUserSafetyOfficerChecked = false;
}
}
}
} else {
///禁止选中
}
});
}
}
: null,
), ),
Text(userSafetyDirectorList![index].name!) Text(userSafetyDirectorList![index].name!,
style: TextStyle(
color: userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? Colors.black
: Colors.black12))
], ],
), ),
), ),
...@@ -554,21 +633,39 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> { ...@@ -554,21 +633,39 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
itemCount: userSafetyOfficerList!.length, itemCount: userSafetyOfficerList!.length,
// 列表项数量 // 列表项数量
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
if (userSafetyOfficerList![index].isChecked!) { ///当前状态是否禁止选中 true 可选 可以操作
userSafetyOfficerList![index].isChecked = false; if (userSafetyOfficerList![index].isUserSafetyOfficerChecked!) {
} else { ///如果当前选择状态为 true,选中
userSafetyOfficerList![index].isChecked = true; if (userSafetyOfficerList![index].isChecked!) {
userSafetyOfficerList![index].isChecked = false;
for (var i = 0; i < userSafetyDirectorList!.length; i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyOfficerList![index].id ==
userSafetyDirectorList![i].id) {
userSafetyDirectorList![i].isUserSafetyDirectorChecked =
true;
}
}
} else {
///未选中
userSafetyOfficerList![index].isChecked = true;
for (var i = 0; i < userSafetyDirectorList!.length; i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyOfficerList![index].id ==
userSafetyDirectorList![i].id) {
userSafetyDirectorList![i].isUserSafetyDirectorChecked =
false;
}
}
}
} }
}); });
}, },
child: Container( child: Container(
height: 40, height: 40,
// color: _selectedIndex == index
// ? Colors.grey.withOpacity(0.3)
// : Colors.transparent, // 选中时高亮背景色
decoration: BoxDecoration( decoration: BoxDecoration(
color: userSafetyOfficerList![index].isChecked! color: userSafetyOfficerList![index].isChecked!
? Colors.grey.withOpacity(0.3) ? Colors.grey.withOpacity(0.3)
...@@ -578,14 +675,68 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> { ...@@ -578,14 +675,68 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
child: Row( child: Row(
children: [ children: [
Checkbox( Checkbox(
value: userSafetyOfficerList![index].isChecked, value:
onChanged: (value) { userSafetyOfficerList![index].isUserSafetyOfficerChecked!
setState(() { ? userSafetyOfficerList![index].isChecked
// selectedSafetyDirectorIndex = value!; : false,
}); side: MaterialStateBorderSide.resolveWith(
}, (Set<MaterialState> states) {
//设置未选中为灰色
return userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!
? null
: const BorderSide(width: 2, color: Colors.black12);
},
),
onChanged: userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!
? (value) {
if (value != null) {
setState(() {
///当前状态是否禁止选中 true 可选 可以操作
if (userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!) {
///如果当前选择状态为 true,选中
if (userSafetyOfficerList![index].isChecked!) {
userSafetyOfficerList![index].isChecked =
false;
for (var i = 0;
i < userSafetyDirectorList!.length;
i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyOfficerList![index].id ==
userSafetyDirectorList![i].id) {
userSafetyDirectorList![i]
.isUserSafetyDirectorChecked = true;
}
}
} else {
///未选中
userSafetyOfficerList![index].isChecked =
true;
for (var i = 0;
i < userSafetyDirectorList!.length;
i++) {
///安全总监--->判断安全员是否有相同人员
if (userSafetyOfficerList![index].id ==
userSafetyDirectorList![i].id) {
userSafetyDirectorList![i]
.isUserSafetyDirectorChecked = false;
}
}
}
}
});
}
}
: null,
), ),
Text(userSafetyOfficerList![index].name!) Text(userSafetyOfficerList![index].name!,
style: TextStyle(
color: userSafetyOfficerList![index]
.isUserSafetyOfficerChecked!
? Colors.black
: Colors.black12))
], ],
), ),
), ),
......
...@@ -54,3 +54,9 @@ String timestampToDate(int timestamp) { ...@@ -54,3 +54,9 @@ String timestampToDate(int timestamp) {
var formatter = DateFormat('yyyy-MM-dd HH:mm:ss'); var formatter = DateFormat('yyyy-MM-dd HH:mm:ss');
return formatter.format(date); return formatter.format(date);
} }
String timestampToDate2(int timestamp) {
var date = DateTime.fromMillisecondsSinceEpoch(timestamp);
var formatter = DateFormat('yyyy-MM-dd');
return formatter.format(date);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment