import 'package:flutter/material.dart'; import 'package:qhd_prevention/customWidget/custom_button.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 '../../../customWidget/ItemWidgetFactory.dart'; import 'dangerTypeItems/finish/danner_repair_finish.dart'; class DangerRepairPage extends StatefulWidget { const DangerRepairPage(this.dangerType, {Key? key}) : super(key: key); final DangerType dangerType; @override State createState() => _DangerRepairPageState(); } class _DangerRepairPageState extends State { // 是否整改 bool _accepted = false; Widget build(BuildContext context) { return Scaffold( appBar: MyAppbar(title: widget.dangerType.detailTitle), body: SafeArea( child: Column( children: [ // 可滚动内容区域 Expanded( child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 15), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ // 隐患详情 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(), ], ), ), ), // 底部警示文字,固定在页面底部 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_type_wait() { return SizedBox( child: Column( children: [ ListItemFactory.createYesNoSection( horizontalPadding: 0, title: '是否正常整改', yesLabel: '是', noLabel: '否', groupValue: _accepted, onChanged: (val) { setState(() { _accepted = val; }); }, ), // 整改选项 _accepted ? DannerRepair() : _noAccepet_repair(_accepted), const SizedBox(height: 20), CustomButton( text: "提交", backgroundColor: Colors.blue, onPressed: () { _submitToServer(); }, ), ], ), ); } void _submitToServer() { // Todo 发送给接口... } // #region 不整改 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, ), ), Divider( height: 10, color: _accept ? h_backGroundColor() : Colors.transparent, ), Container( padding: EdgeInsets.symmetric(horizontal: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(5), ), child: ListItemFactory.createRowSpaceBetweenItem( leftText: "整改负责人", rightText: "测试啊", isRight: true, ), ), ], ); } }