main
parent
d613464600
commit
744f065df1
|
@ -1,18 +1,14 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
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/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/home/work/danger_wait_list_page.dart';
|
||||||
import 'package:qhd_prevention/pages/my_appbar.dart';
|
import 'package:qhd_prevention/pages/my_appbar.dart';
|
||||||
import 'package:qhd_prevention/tools/h_colors.dart';
|
import 'package:qhd_prevention/tools/h_colors.dart';
|
||||||
import 'package:qhd_prevention/tools/tools.dart';
|
|
||||||
|
|
||||||
import '../../../customWidget/ItemWidgetFactory.dart';
|
import '../../../customWidget/ItemWidgetFactory.dart';
|
||||||
import '../../../customWidget/date_picker_dialog.dart';
|
import 'dangerTypeItems/finish/danner_repair_finish.dart';
|
||||||
import '../../../customWidget/photo_picker_row.dart';
|
|
||||||
|
|
||||||
class DangerRepairPage extends StatefulWidget {
|
class DangerRepairPage extends StatefulWidget {
|
||||||
const DangerRepairPage(this.dangerType, {Key? key}) : super(key: key);
|
const DangerRepairPage(this.dangerType, {Key? key}) : super(key: key);
|
||||||
|
@ -24,8 +20,8 @@ class DangerRepairPage extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DangerRepairPageState extends State<DangerRepairPage> {
|
class _DangerRepairPageState extends State<DangerRepairPage> {
|
||||||
|
// 是否整改
|
||||||
bool _accepted = false;
|
bool _accepted = false;
|
||||||
var _selectData = DateTime.now();
|
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -36,34 +32,42 @@ class _DangerRepairPageState extends State<DangerRepairPage> {
|
||||||
// 可滚动内容区域
|
// 可滚动内容区域
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
// 第一部分:内嵌列表
|
// 隐患详情
|
||||||
_danner_detail(),
|
DangerDetail(),
|
||||||
|
SizedBox(height: 15),
|
||||||
ListItemFactory.createYesNoSection(
|
if (widget.dangerType == DangerType.wait) // 隐患整改
|
||||||
title: '是否正常整改',
|
_danner_type_wait()
|
||||||
yesLabel: '是',
|
else if (widget.dangerType ==
|
||||||
noLabel: '否',
|
DangerType.waitAcceptance) ...[ // 已整改、待验收
|
||||||
groupValue: _accepted,
|
DannerRepairFinish(),
|
||||||
onChanged: (val) {
|
SizedBox(height: 15),
|
||||||
setState(() {
|
DangerAcceptance(),
|
||||||
_accepted = val;
|
const SizedBox(height: 20),
|
||||||
});
|
CustomButton(
|
||||||
|
text: "提交",
|
||||||
|
backgroundColor: Colors.blue,
|
||||||
|
onPressed: () {
|
||||||
|
_submitToServer();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// 整改选项
|
] else if (widget.dangerType == DangerType.acceptanced) ...[
|
||||||
_accepted ? _danner_repair() : _noAccepet_repair(_accepted),
|
DannerRepairFinish(),
|
||||||
|
SizedBox(height: 15),
|
||||||
const SizedBox(height: 20),
|
DangerAcceptanceFinish()
|
||||||
CustomButton(text: "提交", backgroundColor: Colors.blue),
|
]
|
||||||
|
else
|
||||||
|
SizedBox(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 底部警示文字,固定在页面底部
|
// 底部警示文字,固定在页面底部
|
||||||
|
if (widget.dangerType == DangerType.wait ||
|
||||||
|
widget.dangerType == DangerType.waitAcceptance)
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.all(15),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
|
@ -78,141 +82,45 @@ class _DangerRepairPageState extends State<DangerRepairPage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 整改
|
/// 隐患整改
|
||||||
Widget _danner_repair() {
|
Widget _danner_type_wait() {
|
||||||
return Container(
|
return SizedBox(
|
||||||
padding: EdgeInsets.only(bottom: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(5),
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ListItemFactory.createBuildSimpleSection("隐患整改"),
|
ListItemFactory.createYesNoSection(
|
||||||
Divider(height: 1),
|
horizontalPadding: 0,
|
||||||
Container(
|
|
||||||
height: 130,
|
title: '是否正常整改',
|
||||||
padding: EdgeInsets.all(15),
|
yesLabel: '是',
|
||||||
child: Column(
|
noLabel: '否',
|
||||||
children: [
|
groupValue: _accepted,
|
||||||
Row(
|
onChanged: (val) {
|
||||||
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(() {
|
setState(() {
|
||||||
_selectData = selected;
|
_accepted = val;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
// 整改选项
|
||||||
},
|
_accepted ? DannerRepair() : _noAccepet_repair(_accepted),
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
const SizedBox(height: 20),
|
||||||
child: ListItemFactory.createRowSpaceBetweenItem(
|
|
||||||
leftText: "整改日期",
|
|
||||||
rightText: "请选择",
|
|
||||||
isRight: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Divider(),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
child: ListItemFactory.createRowSpaceBetweenItem(
|
|
||||||
leftText: "整改后照片",
|
|
||||||
rightText: "0/4",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
child: PhotoPickerRow(
|
|
||||||
maxCount: 4,
|
|
||||||
onChanged: (List<File> images) {
|
|
||||||
// images 列表更新
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Divider(),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
CustomButton(
|
CustomButton(
|
||||||
onPressed: () {},
|
text: "提交",
|
||||||
text: "添加",
|
|
||||||
backgroundColor: Colors.blue,
|
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: () {
|
onPressed: () {
|
||||||
// 这里处理删除逻辑,比如:
|
_submitToServer();
|
||||||
// setState(() => _items.removeAt(index));
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _submitToServer() {
|
||||||
|
// Todo 发送给接口...
|
||||||
|
}
|
||||||
|
|
||||||
/// 不整改
|
// #region 不整改
|
||||||
Widget _noAccepet_repair(bool _accept) {
|
Widget _noAccepet_repair(bool _accept) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -228,7 +136,10 @@ class _DangerRepairPageState extends State<DangerRepairPage> {
|
||||||
isRight: true,
|
isRight: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Divider(height: 10,color: _accept ? Colors.black12 : Colors.transparent,),
|
Divider(
|
||||||
|
height: 10,
|
||||||
|
color: _accept ? h_backGroundColor() : Colors.transparent,
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||||
decoration: BoxDecoration(
|
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,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue