diff --git a/lib/Custom/attachment_webViewer.dart b/lib/Custom/attachment_webViewer.dart new file mode 100644 index 0000000..e246a78 --- /dev/null +++ b/lib/Custom/attachment_webViewer.dart @@ -0,0 +1,59 @@ +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:webview_flutter/webview_flutter.dart'; + +class AttachmentWebViewer extends StatefulWidget { + final String fileUrl; // 文件的网络地址 + final String fileName; // 显示在 AppBar 上的名称(可选) + + const AttachmentWebViewer({ + super.key, + required this.fileUrl, + this.fileName = '附件预览', + }); + + @override + State createState() => _AttachmentWebViewerState(); +} + +class _AttachmentWebViewerState extends State { + late final WebViewController _controller; + bool _isLoading = true; + + @override + void initState() { + super.initState(); + + // 初始化 WebView 控制器 + _controller = WebViewController() + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setNavigationDelegate(NavigationDelegate( + onPageFinished: (_) => setState(() => _isLoading = false), + )) + ..loadRequest(Uri.parse(_buildPreviewUrl(widget.fileUrl))); + } + + /// 构造预览链接(pdf 直接打开,其它用 Google Docs) + String _buildPreviewUrl(String url) { + final lower = url.toLowerCase(); + if (lower.endsWith('.pdf')) { + return url; + } else { + return 'https://docs.google.com/gview?embedded=true&url=$url'; + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text(widget.fileName)), + body: Stack( + children: [ + WebViewWidget(controller: _controller), + if (_isLoading) + const Center(child: CircularProgressIndicator()), + ], + ), + ); + } +} diff --git a/lib/home/action/action_task_page.dart b/lib/home/action/action_task_page.dart index 77c927d..bf091ec 100644 --- a/lib/home/action/action_task_page.dart +++ b/lib/home/action/action_task_page.dart @@ -1,10 +1,14 @@ import 'package:flutter/material.dart'; +import 'package:qhdkfq_regulatory_flutter/tools/my_appbar.dart'; class ActionTaskPage extends StatelessWidget { const ActionTaskPage({super.key}); @override Widget build(BuildContext context) { - return const Placeholder(); + return Scaffold( + appBar: MyAppbar(title: "行动任务详情"), + body: SafeArea(child: SizedBox()), + ); } } diff --git a/lib/home/check_record_list_page.dart b/lib/home/check_record_list_page.dart new file mode 100644 index 0000000..2ecdedc --- /dev/null +++ b/lib/home/check_record_list_page.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:qhdkfq_regulatory_flutter/tools/my_appbar.dart'; + +class CheckRecordListPage extends StatefulWidget { + const CheckRecordListPage({super.key}); + + @override + State createState() => _CheckRecordListPageState(); +} + +class _CheckRecordListPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppbar(title: "检查记录"), + body: SafeArea(child: SizedBox()), + ); + } +} diff --git a/lib/home/disaster_eduction_detail_page.dart b/lib/home/disaster_eduction_detail_page.dart new file mode 100644 index 0000000..fb0b950 --- /dev/null +++ b/lib/home/disaster_eduction_detail_page.dart @@ -0,0 +1,97 @@ +import 'package:flutter/material.dart'; +import 'package:qhdkfq_regulatory_flutter/tools/my_appbar.dart'; + +import '../Custom/dashed_line_text.dart'; +import '../Custom/edit_list_items.dart'; +import '../Custom/read_only_table.dart'; +import '../tools/h_colors.dart'; + +class DisasterEductionDetailPage extends StatelessWidget { + const DisasterEductionDetailPage({super.key}); + + @override + Widget build(BuildContext context) { + final List _infoList = [ + InfoModel("公司名称", "测试1"), + InfoModel("地址", "测试2"), + InfoModel("姓名", "测试3"), + InfoModel("联系电话", "测试4"), + InfoModel("编号", "测试5"), + InfoModel("场所", "测试6"), + InfoModel("类型", "测试7"), + InfoModel("帮扶时间", "测试8"), + InfoModel("现场照片", "测试9"), + ]; + return Scaffold( + appBar: MyAppbar(title: "防灾减灾专项详情"), + body: SafeArea( + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 15), + children: [ + SizedBox(height: 20), + DashedLineText( + text: "防灾减灾专项行动", + lineColor: h_mainBlueColor(), + textStyle: TextStyle(fontSize: 16, color: h_mainBlueColor()), + ), + ListView.separated( + shrinkWrap: true, + physics: const ClampingScrollPhysics(), // 嵌套listview关闭回弹 + separatorBuilder: + (_, __) => const Divider(height: 0.5, color: Colors.black12), + itemCount: _infoList.length, + itemBuilder: (context, index) { + final InfoModel item = _infoList[index]; + return EditListItems.createRowSpaceBetweenItem( + horizontalPadding: 10, + verticalPadding: 15, + leftText: item.title, + rightText: item.discript, + ); + }, + ), + DashedLineText( + text: "帮扶内容", + lineColor: h_mainBlueColor(), + textStyle: TextStyle(fontSize: 16, color: h_mainBlueColor()), + ), + SizedBox(height: 20), + + ReadOnlyTable( + headers: ['序号', '所属帮扶', '隐患描述', '操作'], + columnWidths: [ + const FixedColumnWidth(50), + const FlexColumnWidth(2), + const FlexColumnWidth(3), + const FlexColumnWidth(1.5), + ], + data: [ + ['1', '政府部门', '测试文本测,试文本测试文本测试文本,测试文本测试文本', '合格'], + ['2', '社会组织', '试文本测试文本测试文本', '不合格'], + ], + onTapAction: (row) { + print('点击操作:第\$row 行'); + }, + ), + SizedBox(height: 20), + DashedLineText( + text: "帮扶隐患", + lineColor: h_mainBlueColor(), + textStyle: TextStyle(fontSize: 16, color: h_mainBlueColor()), + ), + SizedBox(height: 20), + + ReadOnlyTable(headers: ['序号', '来源', '内容', '操作'], data: []), + ], + ), + ), + ); + } +} + +class InfoModel { + final String title; + final String discript; + + InfoModel(this.title, this.discript); +} diff --git a/lib/home/home_categroy_list_page.dart b/lib/home/home_categroy_list_page.dart index d375915..d44cb47 100644 --- a/lib/home/home_categroy_list_page.dart +++ b/lib/home/home_categroy_list_page.dart @@ -104,6 +104,7 @@ class _HomeCategroyListPageState extends State elevation: 0.5, shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), child: GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { if (isAllowSelect) { pushPage(WorkListPage(type: widget.type), context); @@ -201,7 +202,7 @@ class _HomeCategroyListPageState extends State backgroundColor: Colors.blue, padding: EdgeInsets.symmetric(horizontal: 30), onPressed: () { - pushPage(ActionTaskPage(), context); + pushPage(WorkListPage(type: widget.type), context); }, ), ]; @@ -236,6 +237,27 @@ class _HomeCategroyListPageState extends State ), ]; } + }else if (widget.type == HomeCategroyType.disasterReduction) { + buttons = [ + CustomButton( + height: 40, + text: "查看", + backgroundColor: Colors.blue, + padding: EdgeInsets.symmetric(horizontal: 30), + onPressed: () { + pushPage(HelpRecordPage(), context); + }, + ), + CustomButton( + height: 40, + text: "上报情况", + backgroundColor: Colors.blue, + padding: EdgeInsets.symmetric(horizontal: 30), + onPressed: () { + pushPage(WorkListPage(type: widget.type), context); + }, + ), + ]; } return buttons; } @@ -308,7 +330,7 @@ class _HomeCategroyListPageState extends State {"title": "上次演练", "value": "2025-05-${20 + enterprise['id'] % 10}"}, { "title": "应急预案", - "value": ["已备案", "待更新", "完善中"][enterprise['id'] % 3], + "value": ["已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案", "待更新", "完善中"][enterprise['id'] % 3], }, { "title": "责任人", diff --git a/lib/home/work_list_page.dart b/lib/home/work_list_page.dart index 0667062..fcaaf5e 100644 --- a/lib/home/work_list_page.dart +++ b/lib/home/work_list_page.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:qhdkfq_regulatory_flutter/home/check_record_list_page.dart'; import 'package:qhdkfq_regulatory_flutter/home/home_page.dart'; import 'package:qhdkfq_regulatory_flutter/tools/custom_button.dart'; import 'package:qhdkfq_regulatory_flutter/tools/h_colors.dart'; import 'package:qhdkfq_regulatory_flutter/tools/my_appbar.dart'; +import 'package:qhdkfq_regulatory_flutter/tools/tools.dart'; import 'adaptive_list_item.dart'; class WorkListPage extends StatefulWidget { @@ -54,14 +56,13 @@ class _WorkListPageState extends State { // TODO: Handle this case. throw UnimplementedError(); case HomeCategroyType.specialInspection: - // TODO: Handle this case. - throw UnimplementedError(); + _navTitle = "专项行动彻查"; case HomeCategroyType.disasterReduction: // TODO: Handle this case. + _navTitle = "防灾减灾专项上报列表"; case HomeCategroyType.supervisionRecord: throw UnimplementedError(); } - } @override @@ -93,7 +94,33 @@ class _WorkListPageState extends State { List _listItemButtons() { List buttons = []; - if (widget.type == HomeCategroyType.supervisionSupport) {} + if (widget.type == HomeCategroyType.disasterReduction) { + buttons = [ + CustomButton( + height: 40, + text: "查看", + backgroundColor: Colors.blue, + padding: EdgeInsets.symmetric(horizontal: 30), + onPressed: () { + // pushPage(HelpRecordPage(), context); + }, + ), + + ]; + }else if (widget.type == HomeCategroyType.specialInspection) { + buttons = [ + CustomButton( + height: 40, + text: "查看", + backgroundColor: Colors.blue, + padding: EdgeInsets.symmetric(horizontal: 30), + onPressed: () { + pushPage(CheckRecordListPage(), context); + }, + ), + + ]; + } return buttons; }