hs 2025-07-14 08:34:51 +08:00
parent 7c529de846
commit bd8033595a
6 changed files with 235 additions and 7 deletions

View File

@ -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<AttachmentWebViewer> createState() => _AttachmentWebViewerState();
}
class _AttachmentWebViewerState extends State<AttachmentWebViewer> {
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()),
],
),
);
}
}

View File

@ -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()),
);
}
}

View File

@ -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<CheckRecordListPage> createState() => _CheckRecordListPageState();
}
class _CheckRecordListPageState extends State<CheckRecordListPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppbar(title: "检查记录"),
body: SafeArea(child: SizedBox()),
);
}
}

View File

@ -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<InfoModel> _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);
}

View File

@ -104,6 +104,7 @@ class _HomeCategroyListPageState extends State<HomeCategroyListPage>
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<HomeCategroyListPage>
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<HomeCategroyListPage>
),
];
}
}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<HomeCategroyListPage>
{"title": "上次演练", "value": "2025-05-${20 + enterprise['id'] % 10}"},
{
"title": "应急预案",
"value": ["已备案", "待更新", "完善中"][enterprise['id'] % 3],
"value": ["已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案", "待更新", "完善中"][enterprise['id'] % 3],
},
{
"title": "责任人",

View File

@ -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<WorkListPage> {
// 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<WorkListPage> {
List<Widget> _listItemButtons() {
List<Widget> 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;
}