hs 2025-07-07 16:49:37 +08:00
parent d613464600
commit 744f065df1
1 changed files with 72 additions and 215 deletions

View File

@ -1,18 +1,14 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
import 'package:photo_view/photo_view_gallery.dart';
import 'package:qhd_prevention/customWidget/custom_button.dart';
import 'package:qhd_prevention/customWidget/single_image_viewer.dart';
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';
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 'package:qhd_prevention/tools/tools.dart';
import '../../../customWidget/ItemWidgetFactory.dart';
import '../../../customWidget/date_picker_dialog.dart';
import '../../../customWidget/photo_picker_row.dart';
import 'dangerTypeItems/finish/danner_repair_finish.dart';
class DangerRepairPage extends StatefulWidget {
const DangerRepairPage(this.dangerType, {Key? key}) : super(key: key);
@ -24,8 +20,8 @@ class DangerRepairPage extends StatefulWidget {
}
class _DangerRepairPageState extends State<DangerRepairPage> {
//
bool _accepted = false;
var _selectData = DateTime.now();
Widget build(BuildContext context) {
return Scaffold(
@ -36,183 +32,95 @@ class _DangerRepairPageState extends State<DangerRepairPage> {
//
Expanded(
child: SingleChildScrollView(
padding: const EdgeInsets.all(15),
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
//
_danner_detail(),
ListItemFactory.createYesNoSection(
title: '是否正常整改',
yesLabel: '',
noLabel: '',
groupValue: _accepted,
onChanged: (val) {
setState(() {
_accepted = val;
});
},
),
//
_accepted ? _danner_repair() : _noAccepet_repair(_accepted),
const SizedBox(height: 20),
CustomButton(text: "提交", backgroundColor: Colors.blue),
//
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(),
],
),
),
),
//
Container(
padding: const EdgeInsets.all(15),
color: Colors.white,
child: Text(
' 严禁在本互联网非涉密平台处理、传输国家秘密和工作秘密,请确认扫描、传输的文件资料不涉及国家秘密和工作秘密',
style: TextStyle(fontSize: 14, color: Colors.red),
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),
),
),
),
],
),
),
);
}
///
Widget _danner_repair() {
return Container(
padding: EdgeInsets.only(bottom: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
),
///
Widget _danner_type_wait() {
return SizedBox(
child: Column(
children: [
ListItemFactory.createBuildSimpleSection("隐患整改"),
Divider(height: 1),
Container(
height: 130,
padding: EdgeInsets.all(15),
child: Column(
children: [
Row(
children: [HhTextStyleUtils.mainTitle("隐患描述", fontSize: 15)],
),
TextField(
keyboardType: TextInputType.multiline,
maxLines: null, //
style: TextStyle(fontSize: 15),
decoration: InputDecoration(
hintText: '请对隐患进行详细描述(必填项)',
border: InputBorder.none,
),
),
],
),
),
Divider(height: 1),
GestureDetector(
onTap: () {
showDialog(
context: context,
builder:
(_) => HDatePickerDialog(
initialDate: DateTime.now(),
onCancel: () => Navigator.of(context).pop(),
onConfirm: (selected) {
print('选中日期: $selected');
Navigator.of(context).pop();
setState(() {
_selectData = selected;
});
},
),
);
ListItemFactory.createYesNoSection(
horizontalPadding: 0,
title: '是否正常整改',
yesLabel: '',
noLabel: '',
groupValue: _accepted,
onChanged: (val) {
setState(() {
_accepted = val;
});
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: ListItemFactory.createRowSpaceBetweenItem(
leftText: "整改日期",
rightText: "请选择",
isRight: true,
),
),
),
Divider(),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: ListItemFactory.createRowSpaceBetweenItem(
leftText: "整改后照片",
rightText: "0/4",
),
//
_accepted ? DannerRepair() : _noAccepet_repair(_accepted),
const SizedBox(height: 20),
CustomButton(
text: "提交",
backgroundColor: Colors.blue,
onPressed: () {
_submitToServer();
},
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: PhotoPickerRow(
maxCount: 4,
onChanged: (List<File> images) {
// images
},
),
),
Divider(),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
CustomButton(
onPressed: () {},
text: "添加",
backgroundColor: Colors.blue,
borderRadius: 17,
height: 34,
padding: EdgeInsets.symmetric(horizontal: 20),
),
],
),
_departmentItem(1),
_departmentItem(2),
Divider(),
// ListItemFactory.createYesNoSection(title: "是否有整改方案", yesLabel: "", noLabel: noLabel, groupValue: groupValue, onChanged: onChanged)
],
),
);
}
Widget _departmentItem(int index) {
return Padding(
padding: const EdgeInsets.all(10),
child: Stack(
clipBehavior: Clip.none,
children: [
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black12, width: 1),
),
child: _noAccepet_repair(false),
),
// index > 1
if (index > 1)
Positioned(
top: -20,
left: -20,
child: IconButton(
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
icon: const Icon(Icons.cancel, color: Colors.red, size: 25),
onPressed: () {
//
// setState(() => _items.removeAt(index));
},
),
),
],
),
);
void _submitToServer() {
// Todo ...
}
///
// #region
Widget _noAccepet_repair(bool _accept) {
return Column(
children: [
@ -228,7 +136,10 @@ class _DangerRepairPageState extends State<DangerRepairPage> {
isRight: true,
),
),
Divider(height: 10,color: _accept ? Colors.black12 : Colors.transparent,),
Divider(
height: 10,
color: _accept ? h_backGroundColor() : Colors.transparent,
),
Container(
padding: EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
@ -244,58 +155,4 @@ class _DangerRepairPageState extends State<DangerRepairPage> {
],
);
}
///
Widget _danner_detail() {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),
),
padding: const EdgeInsets.all(12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: 16,
itemBuilder: (context, index) {
if (index == 0) {
return ListItemFactory.createAloneTextItem(
text: "地坪漆漆未分配全皮肤期漆未分配全皮肤期漆未分配全皮肤期未分配全皮肤期间哦飞机哦脾气金佛怕",
);
} else if ((index > 0 && index < 4) ||
index == 5 ||
(index > 6 && index < 15)) {
return ListItemFactory.createRowSpaceBetweenItem(
leftText: "隐患来源",
rightText: "隐患排查",
);
} else if (index == 4 || index == 6) {
return ListItemFactory.createColumnTextItem(
topText: "存在风险",
bottomText: "哦IQ好然后前后hi前后哦i",
);
}
return ListItemFactory.createTextImageItem(
text: "隐患照片",
imageUrl:
"https://pic.rmb.bdstatic.com/bjh/news/100b8b78cbd136ede03249d9f3b3f5c42221.jpeg",
onImageTapped: () {
pushPage(
SingleImageViewer(
imageUrl:
"https://pic.rmb.bdstatic.com/bjh/news/100b8b78cbd136ede03249d9f3b3f5c42221.jpeg",
),
context,
);
},
);
},
),
],
),
);
}
}