Commit be51012f by 吴春元

bug 修改

parent f8c76167
......@@ -7,11 +7,11 @@ class Api {
// IS_DEBUG ? "https://special.sxyztech.cn/" : "http://192.168.19.165:2212/";
///演示 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.165:2212/";
// static String URL = "http://192.168.19.165:2212/";
static String START_URL = "special/a/",
END_URL = "__ajax=true&mobileLogin=true";
......
......@@ -4,6 +4,7 @@ import 'dart:developer';
import 'package:dio/dio.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/model/app_is_open.dart';
import 'package:special_equipment_flutter/model/app_roles.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/week_control_list_sy_bo.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/toast_utils.dart';
......@@ -1238,12 +1240,41 @@ class HttpUtils {
'交卷中');
try {
BaseModel entity = BaseModel.fromJson(response);
Map<String, dynamic> resultData = entity.body;
ExamResultBo examResultBo = ExamResultBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return examResultBo;
if (entity.success!) {
Map<String, dynamic> resultData = entity.body;
ExamResultBo examResultBo = ExamResultBo.fromJson(resultData);
if (entity.errorCode == "-1") {
return examResultBo;
} else {
ToastUtils.showCenter(entity.msg!);
return;
}
} 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;
}
} catch (e) {
......
......@@ -162,7 +162,9 @@ class NetUtils {
ToastUtils.showCenter(entity.msg!);
}
} else {
ToastUtils.showCenter(entity.msg!);
if (entity.msg != '试卷已被安全监察人员删除,请查看是否有新试卷!') {
ToastUtils.showCenter(entity.msg!);
}
}
isLoading ? Loading.dismiss() : null;
return response.data;
......
......@@ -53,6 +53,8 @@ class UserLists {
String? roleNames;
bool? admin;
bool? isChecked = false;
bool? isUserSafetyDirectorChecked = true;
bool? isUserSafetyOfficerChecked = true;
UserLists copyWith({
String? id,
......
......@@ -108,158 +108,192 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return 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();
},
),
],
));
},
return WillPopScope(
onWillPop: () async {
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();
},
),
],
));
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
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像素间距
padding: EdgeInsets.zero,
///这里设置了按钮的内边距为零,可以消除默认的16像素间距
padding: EdgeInsets.zero,
),
text: '考核',
height: 50,
),
text: '考核',
height: 50,
),
///答题卡抽屉
body: SlidingUpPanel(
backdropEnabled: true,
controller: controller,
minHeight: 50,
maxHeight: 510,
///答题卡抽屉
body: SlidingUpPanel(
backdropEnabled: true,
controller: controller,
minHeight: 50,
maxHeight: 510,
///答题卡区
panel: Container(
color: Colors.grey[200],
child: Stack(
alignment: Alignment.bottomCenter,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: () {
setState(() {
if (controller!.isPanelClosed) {
controller!.open();
} else {
controller!.close();
}
});
},
child: Container(
padding: const EdgeInsets.only(top: 7, bottom: 6),
// color: Colors.grey[300],
child: Stack(
alignment: Alignment.centerRight,
children: [
Column(
///答题卡区
panel: Container(
color: Colors.grey[200],
child: Stack(
alignment: Alignment.bottomCenter,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: () {
setState(() {
if (controller!.isPanelClosed) {
controller!.open();
} else {
controller!.close();
}
});
},
child: Container(
padding: const EdgeInsets.only(top: 7, bottom: 6),
// color: Colors.grey[300],
child: Stack(
alignment: Alignment.centerRight,
children: [
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: [
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),
)
if (examQuestionDList!.isNotEmpty) ...{
buildSliverToBoxAdapter('选择题'),
buildAnswerSheetList(examQuestionDList),
},
if (examQuestionPList!.isNotEmpty) ...{
buildSliverToBoxAdapter('判断题'),
buildAnswerSheetList(examQuestionPList),
}
],
),
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: [
if (examQuestionDList!.isNotEmpty) ...{
buildSliverToBoxAdapter('选择题'),
buildAnswerSheetList(examQuestionDList),
},
if (examQuestionPList!.isNotEmpty) ...{
buildSliverToBoxAdapter('判断题'),
buildAnswerSheetList(examQuestionPList),
}
],
))
],
),
),
]),
buildSubmit()
],
]),
buildSubmit()
],
),
),
),
///内容区
body: Column(children: [buildExpanded()]),
));
///内容区
body: Column(children: [buildExpanded()]),
)),
);
}
Container buildSliverToBoxAdapter(var text) {
......@@ -519,8 +553,6 @@ class ExamPageState extends State<ExamPage> with TickerProviderStateMixin {
onPressed: () {
//关闭弹窗
Get.back();
// printLog(
// "《考核-交卷》提交json数据----->${json.encode(examineQuestionsBo)}");
HttpUtils.getExamSubmit(context, examineQuestionsBo)
.then((value) {
ExamResultBo examResultBo = value;
......
......@@ -54,137 +54,174 @@ class _ExamResultPageState extends State<ExamResultPage> {
padding: EdgeInsets.zero,
),
),
body: Container(
height: 300,
width: double.infinity,
margin: const EdgeInsets.only(top: 15, 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: [
const SizedBox(height: 10),
const Row(
mainAxisAlignment: MainAxisAlignment.center,
body: Column(
children: [
Container(
width: double.infinity,
margin:
const EdgeInsets.only(left: 15, right: 15, top: 20, bottom: 0),
padding:
const EdgeInsets.only(left: 5, right: 5, top: 3, bottom: 3),
decoration: BoxDecoration(
color: Colors.orange[50],
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(5),
topRight: Radius.circular(5),
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: [
Text(
'—————— ',
style: TextStyle(color: ColorConst.grayf5Color),
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'—————— ',
style: TextStyle(color: ColorConst.grayf5Color),
),
Text('本次考核成绩'),
Text(
' ——————',
style: TextStyle(color: ColorConst.grayf5Color),
)
],
),
Text('本次考核成绩'),
const SizedBox(height: 10),
Text(
' ——————',
style: TextStyle(color: ColorConst.grayf5Color),
)
],
),
const SizedBox(height: 10),
Text(
examResultDataBo!.score!.round().toString(),
style: TextStyle(
color:
examResultDataBo!.score! < 90 ? Colors.red : Colors.green,
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,
examResultDataBo!.score!.round().toString(),
style: TextStyle(
color: examResultDataBo!.score! < 90
? Colors.red
: Colors.green,
fontSize: 20,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "答对 ",
style:
TextStyle(fontSize: 14, color: Colors.grey)),
TextSpan(
text: "${examResultDataBo!.correct.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!.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)),
])),
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: [
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "答对 ",
style: TextStyle(
fontSize: 14, color: Colors.grey)),
TextSpan(
text:
"${examResultDataBo!.correct.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!.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';
import 'package:sliding_up_panel/sliding_up_panel.dart';
import 'package:special_equipment_flutter/common/color_const.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_setting_bo.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/utils/toast_utils.dart';
import 'package:special_equipment_flutter/widgets/app_bar/custom_app_bar_back.dart';
import 'package:special_equipment_flutter/widgets/custom_button.dart';
import '../../../common/route_string.dart';
///考核答题页面
class TestPage extends StatefulWidget {
var arguments = Get.arguments;
......@@ -85,158 +81,192 @@ class TestPageState extends State<TestPage> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return 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();
},
),
],
));
},
return WillPopScope(
onWillPop: () async {
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();
},
),
],
));
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
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像素间距
padding: EdgeInsets.zero,
///这里设置了按钮的内边距为零,可以消除默认的16像素间距
padding: EdgeInsets.zero,
),
text: '测试练习',
height: 50,
),
text: '测试练习',
height: 50,
),
///答题卡抽屉
body: SlidingUpPanel(
backdropEnabled: true,
controller: controller,
minHeight: 50,
maxHeight: 510,
///答题卡抽屉
body: SlidingUpPanel(
backdropEnabled: true,
controller: controller,
minHeight: 50,
maxHeight: 510,
///答题卡区
panel: Container(
color: Colors.grey[200],
child: Stack(
alignment: Alignment.bottomCenter,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: () {
setState(() {
if (controller!.isPanelClosed) {
controller!.open();
} else {
controller!.close();
}
});
},
child: Container(
padding: const EdgeInsets.only(top: 7, bottom: 6),
// color: Colors.grey[300],
child: Stack(
alignment: Alignment.centerRight,
children: [
Column(
///答题卡区
panel: Container(
color: Colors.grey[200],
child: Stack(
alignment: Alignment.bottomCenter,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
onTap: () {
setState(() {
if (controller!.isPanelClosed) {
controller!.open();
} else {
controller!.close();
}
});
},
child: Container(
padding: const EdgeInsets.only(top: 7, bottom: 6),
// color: Colors.grey[300],
child: Stack(
alignment: Alignment.centerRight,
children: [
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: [
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),
)
if (examQuestionDList!.isNotEmpty) ...{
buildSliverToBoxAdapter('选择题'),
buildAnswerSheetList(examQuestionDList),
},
if (examQuestionPList!.isNotEmpty) ...{
buildSliverToBoxAdapter('判断题'),
buildAnswerSheetList(examQuestionPList),
}
],
),
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: [
if (examQuestionDList!.isNotEmpty) ...{
buildSliverToBoxAdapter('选择题'),
buildAnswerSheetList(examQuestionDList),
},
if (examQuestionPList!.isNotEmpty) ...{
buildSliverToBoxAdapter('判断题'),
buildAnswerSheetList(examQuestionPList),
}
],
))
],
),
),
]),
buildSubmit()
],
]),
buildSubmit()
],
),
),
),
///内容区
body: Column(children: [buildExpanded()]),
));
///内容区
body: Column(children: [buildExpanded()]),
)),
);
}
Container buildSliverToBoxAdapter(var text) {
......
......@@ -82,6 +82,7 @@ class _HomePageState extends State<HomePage>
List<CountData>? findCountList = [];
ExaminePersonBo? mExaminePersonBo = ExaminePersonBo();
OverseerHistoryListBo? mOverseerHistoryListBo = OverseerHistoryListBo();
int mOverseerHistoryCount = 0;
List<HistoryListData>? mHistoryListData = [];
//声明,后面需要销毁
......@@ -152,6 +153,7 @@ class _HomePageState extends State<HomePage>
if (mounted) {
setState(() {
mOverseerHistoryListBo = value;
mOverseerHistoryCount = mOverseerHistoryListBo!.count!;
mHistoryListData = mOverseerHistoryListBo!.data;
});
}
......@@ -489,7 +491,9 @@ class _HomePageState extends State<HomePage>
onTap: () {
Get.toNamed(RouteString.OVERSEER_HISTORY_LIST_PAGE,
arguments: {})?.then((value) {
if (value != null && value) {}
if (value != null && value) {
getOverseerHistoryList();
}
});
},
child: Container(
......@@ -524,7 +528,7 @@ class _HomePageState extends State<HomePage>
style: TextStyle(fontSize: 12, color: Colors.orange)),
TextSpan(
text: mOverseerHistoryListBo != null
? mOverseerHistoryListBo!.count.toString()
? mOverseerHistoryCount.toString()
: '0',
style: const TextStyle(
fontSize: 16,
......@@ -544,7 +548,8 @@ class _HomePageState extends State<HomePage>
}),
] else ...[
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(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
......@@ -562,7 +567,9 @@ class _HomePageState extends State<HomePage>
arguments: {
'id': mHistoryListData![index].id,
})?.then((value) {
if (value != null && value) {}
if (value != null && value) {
getOverseerHistoryList();
}
});
},
child: Card(
......@@ -746,6 +753,7 @@ class _HomePageState extends State<HomePage>
mHistoryListData!
.removeAt(
index);
mOverseerHistoryCount--;
ToastUtils
.showCenter(
'删除成功');
......@@ -788,7 +796,9 @@ class _HomePageState extends State<HomePage>
'id': mHistoryListData![index]
.id,
})?.then((value) {
if (value != null && value) {}
if (value != null && value) {
getOverseerHistoryList();
}
});
},
width: 60,
......
......@@ -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/storage_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 '../../widgets/app_bar/custom_app_bar.dart';
......@@ -69,318 +70,327 @@ class _OverseerHistroyDetailsPageState
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: ColorConst.grayf5Color,
appBar: AppBarCustom(
text: '监察记录详情',
height: 50,
),
body: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Card(
elevation: 0,
margin: const EdgeInsets.only(
left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
buildTitleContainer(Icons.insert_drive_file_outlined,
ColorConst.blueColor, '基本信息', Colors.black54),
Container(
padding: const EdgeInsets.only(
left: 40, right: 15, top: 0, bottom: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(data != null ? data!.officeName! : '',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black54)),
return WillPopScope(
onWillPop: () async {
Get.back(result: true);
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
backgroundColor: ColorConst.grayf5Color,
appBar: AppBarCustom(
text: '监察记录详情',
height: 50,
),
body: CustomScrollView(
primary: false,
shrinkWrap: true,
slivers: <Widget>[
SliverToBoxAdapter(
child: Card(
elevation: 0,
margin: const EdgeInsets.only(
left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
buildTitleContainer(Icons.insert_drive_file_outlined,
ColorConst.blueColor, '基本信息', Colors.black54),
Container(
padding: const EdgeInsets.only(
left: 40, right: 15, top: 0, bottom: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
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: [
const Text('设备类型:',
style: TextStyle(
fontSize: 14, color: Colors.black54)),
Text(data != null ? data!.typeName! : '',
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)),
TextSpan(
text: data != null
? data!.count.toString()
: '',
style: const TextStyle(
fontSize: 18,
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) ...[
Row(children: [
const Text('设备类型:',
style: TextStyle(
fontSize: 14, color: Colors.black54)),
Text(data != null ? data!.typeName! : '',
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)),
TextSpan(
text: data != null
? data!.count.toString()
: '',
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold)),
const TextSpan(
text: " | ",
text: "",
style: TextStyle(
color: ColorConst.greyD2Color)),
fontSize: 14, color: Colors.black54)),
])),
const SizedBox(height: 5),
Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "进行中 ",
text: "考核状态:",
style: TextStyle(
color: ColorConst.red1BgColor)),
fontSize: 14, color: Colors.black54)),
const TextSpan(
text: "已完成 ",
style: TextStyle(
color: ColorConst.greenColor)),
TextSpan(
text: data != null
? data!.incomplete.toString()
? data!.complete.toString()
: '',
style: const TextStyle(
color: ColorConst.red1BgColor,
color: ColorConst.greenColor,
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: timestampToDate(
data != null ? data!.createDate! : 0),
style: const TextStyle(
fontSize: 14, color: Colors.black54)),
])),
],
),
)
],
color: ColorConst.greenColor)),
if (data != null
? data!.incomplete != 0
: true) ...[
const TextSpan(
text: " | ",
style: TextStyle(
color: ColorConst.greyD2Color)),
const TextSpan(
text: "进行中 ",
style: TextStyle(
color: ColorConst.red1BgColor)),
TextSpan(
text: data != null
? data!.incomplete.toString()
: '',
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(
child: Card(
elevation: 0,
margin: const EdgeInsets.only(
left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
buildTitleContainer(Icons.event_repeat,
ColorConst.blueColor, '考核状态', Colors.black54),
Container(
padding: const EdgeInsets.only(
left: 30, right: 15, top: 0, bottom: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
//文章列表
ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal: EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return Container(
padding: const EdgeInsets.only(
left: 10, right: 10, top: 10, bottom: 10),
margin: const EdgeInsets.only(
left: 0, right: 0, top: 0, bottom: 5),
decoration: BoxDecoration(
color: rowList![index].adopt == "0"
? ColorConst.red4BgColor
: Colors.green[50],
borderRadius: const BorderRadius.all(
Radius.circular(5)),
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(rowList![index].user!.name!,
style: const TextStyle(
fontSize: 16,
color: Colors.black54,
fontWeight: FontWeight.bold)),
Text(
rowList![index].adopt == "0"
? "进行中"
: '已完成',
style: TextStyle(
fontSize: 14,
color:
rowList![index].adopt == "0"
? ColorConst.red1BgColor
: ColorConst.greenColor,
fontWeight: FontWeight.bold)),
],
),
Container(
height: 3,
width: 48,
margin: const EdgeInsets.only(top: 2),
decoration: BoxDecoration(
color: rowList![index].adopt == "0"
? Colors.red
: Colors.green,
borderRadius: const BorderRadius.all(
Radius.circular(5)),
SliverToBoxAdapter(
child: Card(
elevation: 0,
margin: const EdgeInsets.only(
left: 0, right: 0, top: 15, bottom: 0),
color: Colors.white,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(5)),
),
child: Column(
children: [
buildTitleContainer(Icons.event_repeat,
ColorConst.blueColor, '考核状态', Colors.black54),
Container(
padding: const EdgeInsets.only(
left: 30, right: 15, top: 0, bottom: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
//文章列表
ListView.separated(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(
horizontal:
EdgeInsetsConst.padding_horizontal),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return Container(
padding: const EdgeInsets.only(
left: 10, right: 10, top: 10, bottom: 10),
margin: const EdgeInsets.only(
left: 0, right: 0, top: 0, bottom: 5),
decoration: BoxDecoration(
color: rowList![index].adopt == "0"
? ColorConst.red4BgColor
: Colors.green[50],
borderRadius: const BorderRadius.all(
Radius.circular(5)),
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(rowList![index].user!.name!,
style: const TextStyle(
fontSize: 16,
color: Colors.black54,
fontWeight: FontWeight.bold)),
Text(
rowList![index].adopt == "0"
? "进行中"
: '已完成',
style: TextStyle(
fontSize: 14,
color: rowList![index]
.adopt ==
"0"
? ColorConst.red1BgColor
: ColorConst.greenColor,
fontWeight: FontWeight.bold)),
],
),
Container(
height: 3,
width: 48,
margin: const EdgeInsets.only(top: 2),
decoration: BoxDecoration(
color: rowList![index].adopt == "0"
? Colors.red
: 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(
margin: const EdgeInsets.only(top: 5),
child: Text.rich(
softWrap: true,
TextSpan(children: [
const TextSpan(
text: "考核得分 ",
text: "考核人员身份:",
style: TextStyle(
color: Colors.black54)),
TextSpan(
text: rowList![index]
.score!
.toString(),
.positionType ==
'1'
? '安全总监'
: '安全员',
style: const TextStyle(
fontSize: 16,
color:
ColorConst.greenColor,
fontWeight:
FontWeight.bold)),
const TextSpan(
text: " 分",
style: TextStyle(
color: Colors.black54)),
color: Colors.black54))
])),
)
]
],
),
);
},
itemCount: rowList!.length,
separatorBuilder:
(BuildContext context, int index) {
return const SizedBox(
height: 0,
);
},
),
],
),
)
],
),
if (rowList![index].adopt == "1") ...[
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]
.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(
// child: Card(
// elevation: 5,
// shadowColor: ColorConst.greenColor,
// margin: const EdgeInsets.only(
// left: 0, right: 0, top: 15, bottom: 0),
// color: Colors.white,
// shape: const RoundedRectangleBorder(
// borderRadius: BorderRadius.all(Radius.circular(5)),
// ),
// child: Column(
// children: [
// buildTitleContainer(Icons.event_available,
// ColorConst.greenColor, '已完成', ColorConst.greenColor),
// Container(
// padding: const EdgeInsets.only(
// left: 40, right: 15, top: 0, bottom: 15),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
//
//
//
// ],
// ),
// )
// ],
// ),
// ),
// )
],
));
// SliverToBoxAdapter(
// child: Card(
// elevation: 5,
// shadowColor: ColorConst.greenColor,
// margin: const EdgeInsets.only(
// left: 0, right: 0, top: 15, bottom: 0),
// color: Colors.white,
// shape: const RoundedRectangleBorder(
// borderRadius: BorderRadius.all(Radius.circular(5)),
// ),
// child: Column(
// children: [
// buildTitleContainer(Icons.event_available,
// ColorConst.greenColor, '已完成', ColorConst.greenColor),
// Container(
// padding: const EdgeInsets.only(
// left: 40, right: 15, top: 0, bottom: 15),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
//
//
//
// ],
// ),
// )
// ],
// ),
// ),
// )
],
)),
);
}
Container buildTitleContainer(
......
......@@ -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/dio/http_utils.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/string_utils.dart';
import 'package:special_equipment_flutter/utils/time_util.dart';
......@@ -69,37 +70,43 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBarCustom(text: '考核列表', height: 50),
backgroundColor: Colors.grey[100],
body: Column(
children: [
Expanded(
flex: 1,
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
enableControlFinishLoad: true,
firstRefreshWidget: const FirstRefreshWidget(),
emptyWidget: mHistoryListData!.isEmpty
? EmptyImgWidget(
title: '暂无数据,点击刷新',
onTap: () {
getOverseerHistoryList();
})
: null,
controller: _controller,
onRefresh: () async {
page = 1;
getOverseerHistoryList();
},
onLoad: () async {
page++;
getOverseerHistoryList();
},
child: buildBody(),
)),
],
return WillPopScope(
onWillPop: () async {
Get.back(result: true);
return true; // 控制是否可以侧滑返回,true为允许,false为不允许
},
child: Scaffold(
appBar: AppBarCustom(text: '考核列表', height: 50),
backgroundColor: Colors.grey[100],
body: Column(
children: [
Expanded(
flex: 1,
child: EasyRefresh(
firstRefresh: true,
enableControlFinishRefresh: true,
enableControlFinishLoad: true,
firstRefreshWidget: const FirstRefreshWidget(),
emptyWidget: mHistoryListData!.isEmpty
? EmptyImgWidget(
title: '暂无数据,点击刷新',
onTap: () {
getOverseerHistoryList();
})
: null,
controller: _controller,
onRefresh: () async {
page = 1;
getOverseerHistoryList();
},
onLoad: () async {
page++;
getOverseerHistoryList();
},
child: buildBody(),
)),
],
),
),
);
}
......@@ -271,6 +278,9 @@ class _OverseerHistoryListPageState extends State<OverseerHistoryListPage> {
setState(() {
mHistoryListData!
.removeAt(index);
//发出通知
EventBusUtils.getInstance()
?.fire("2");
ToastUtils.showCenter('删除成功');
Get.back();
});
......
......@@ -512,10 +512,33 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
return GestureDetector(
onTap: () {
setState(() {
if (userSafetyDirectorList![index].isChecked!) {
userSafetyDirectorList![index].isChecked = false;
///当前状态是否禁止选中 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 {
userSafetyDirectorList![index].isChecked = true;
///禁止选中
}
});
},
......@@ -530,14 +553,70 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
child: Row(
children: [
Checkbox(
value: userSafetyDirectorList![index].isChecked,
onChanged: (value) {
setState(() {
// selectedSafetyDirectorIndex = value!;
});
},
value: userSafetyDirectorList![index]
.isUserSafetyDirectorChecked!
? userSafetyDirectorList![index].isChecked
: 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> {
itemCount: userSafetyOfficerList!.length,
// 列表项数量
itemBuilder: (context, index) {
return GestureDetector(
return InkWell(
onTap: () {
setState(() {
if (userSafetyOfficerList![index].isChecked!) {
userSafetyOfficerList![index].isChecked = false;
} else {
userSafetyOfficerList![index].isChecked = true;
///当前状态是否禁止选中 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;
}
}
}
}
});
},
child: Container(
height: 40,
// color: _selectedIndex == index
// ? Colors.grey.withOpacity(0.3)
// : Colors.transparent, // 选中时高亮背景色
decoration: BoxDecoration(
color: userSafetyOfficerList![index].isChecked!
? Colors.grey.withOpacity(0.3)
......@@ -578,14 +675,68 @@ class _OverseerSettingsState extends State<OverseerSettingsPage> {
child: Row(
children: [
Checkbox(
value: userSafetyOfficerList![index].isChecked,
onChanged: (value) {
setState(() {
// selectedSafetyDirectorIndex = value!;
});
},
value:
userSafetyOfficerList![index].isUserSafetyOfficerChecked!
? userSafetyOfficerList![index].isChecked
: 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) {
var formatter = DateFormat('yyyy-MM-dd HH:mm:ss');
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