qhd-prevention-flutter/lib/pages/home/work/danger_repair_page.dart

159 lines
5.2 KiB
Dart
Raw Permalink Normal View History

2025-07-03 09:45:15 +08:00
import 'package:flutter/material.dart';
import 'package:qhd_prevention/customWidget/custom_button.dart';
2025-07-07 16:49:37 +08:00
import 'package:qhd_prevention/pages/home/work/dangerTypeItems/danger_detail.dart';
import 'package:qhd_prevention/pages/home/work/dangerTypeItems/finish/danger_acceptance_finish.dart';
import 'package:qhd_prevention/pages/home/work/dangerTypeItems/wait/danger_acceptance.dart';
import 'package:qhd_prevention/pages/home/work/dangerTypeItems/wait/danner_repair.dart';
2025-07-03 09:45:15 +08:00
import 'package:qhd_prevention/pages/home/work/danger_wait_list_page.dart';
import 'package:qhd_prevention/pages/my_appbar.dart';
import 'package:qhd_prevention/tools/h_colors.dart';
import '../../../customWidget/ItemWidgetFactory.dart';
2025-07-07 16:49:37 +08:00
import 'dangerTypeItems/finish/danner_repair_finish.dart';
2025-07-03 09:45:15 +08:00
class DangerRepairPage extends StatefulWidget {
const DangerRepairPage(this.dangerType, {Key? key}) : super(key: key);
final DangerType dangerType;
@override
State<DangerRepairPage> createState() => _DangerRepairPageState();
}
class _DangerRepairPageState extends State<DangerRepairPage> {
2025-07-07 16:49:37 +08:00
// 是否整改
2025-07-03 09:45:15 +08:00
bool _accepted = false;
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppbar(title: widget.dangerType.detailTitle),
body: SafeArea(
child: Column(
children: [
// 可滚动内容区域
Expanded(
child: SingleChildScrollView(
2025-07-07 16:49:37 +08:00
padding: const EdgeInsets.symmetric(horizontal: 15),
2025-07-03 09:45:15 +08:00
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
2025-07-07 16:49:37 +08:00
// 隐患详情
DangerDetail(),
SizedBox(height: 15),
if (widget.dangerType == DangerType.wait) // 隐患整改
_danner_type_wait()
else if (widget.dangerType ==
DangerType.waitAcceptance) ...[ // 已整改、待验收
DannerRepairFinish(),
SizedBox(height: 15),
DangerAcceptance(),
const SizedBox(height: 20),
CustomButton(
text: "提交",
backgroundColor: Colors.blue,
onPressed: () {
_submitToServer();
},
),
] else if (widget.dangerType == DangerType.acceptanced) ...[
DannerRepairFinish(),
SizedBox(height: 15),
DangerAcceptanceFinish()
]
else
SizedBox(),
2025-07-03 09:45:15 +08:00
],
),
),
),
// 底部警示文字,固定在页面底部
2025-07-07 16:49:37 +08:00
if (widget.dangerType == DangerType.wait ||
widget.dangerType == DangerType.waitAcceptance)
Container(
padding: const EdgeInsets.all(15),
color: Colors.white,
child: Text(
' 严禁在本互联网非涉密平台处理、传输国家秘密和工作秘密,请确认扫描、传输的文件资料不涉及国家秘密和工作秘密',
style: TextStyle(fontSize: 14, color: Colors.red),
),
2025-07-03 09:45:15 +08:00
),
],
),
),
);
}
2025-07-07 16:49:37 +08:00
/// 隐患整改
Widget _danner_type_wait() {
return SizedBox(
2025-07-03 09:45:15 +08:00
child: Column(
children: [
2025-07-07 16:49:37 +08:00
ListItemFactory.createYesNoSection(
horizontalPadding: 0,
title: '是否正常整改',
yesLabel: '',
noLabel: '',
groupValue: _accepted,
onChanged: (val) {
setState(() {
_accepted = val;
});
2025-07-03 09:45:15 +08:00
},
),
2025-07-07 16:49:37 +08:00
// 整改选项
_accepted ? DannerRepair() : _noAccepet_repair(_accepted),
2025-07-03 09:45:15 +08:00
2025-07-07 16:49:37 +08:00
const SizedBox(height: 20),
CustomButton(
text: "提交",
backgroundColor: Colors.blue,
onPressed: () {
_submitToServer();
},
2025-07-03 09:45:15 +08:00
),
],
),
);
}
2025-07-07 16:49:37 +08:00
void _submitToServer() {
// Todo 发送给接口...
}
2025-07-03 09:45:15 +08:00
2025-07-07 16:49:37 +08:00
// #region 不整改
2025-07-03 09:45:15 +08:00
Widget _noAccepet_repair(bool _accept) {
return Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
),
child: ListItemFactory.createRowSpaceBetweenItem(
leftText: "整改部门",
rightText: "测试啊",
isRight: true,
),
),
2025-07-07 16:49:37 +08:00
Divider(
height: 10,
color: _accept ? h_backGroundColor() : Colors.transparent,
),
2025-07-03 09:45:15 +08:00
Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
),
child: ListItemFactory.createRowSpaceBetweenItem(
leftText: "整改负责人",
rightText: "测试啊",
isRight: true,
),
),
],
);
}
}