main
parent
7c529de846
commit
bd8033595a
|
@ -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()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,14 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:qhdkfq_regulatory_flutter/tools/my_appbar.dart';
|
||||||
|
|
||||||
class ActionTaskPage extends StatelessWidget {
|
class ActionTaskPage extends StatelessWidget {
|
||||||
const ActionTaskPage({super.key});
|
const ActionTaskPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Placeholder();
|
return Scaffold(
|
||||||
|
appBar: MyAppbar(title: "行动任务详情"),
|
||||||
|
body: SafeArea(child: SizedBox()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
|
@ -104,6 +104,7 @@ class _HomeCategroyListPageState extends State<HomeCategroyListPage>
|
||||||
elevation: 0.5,
|
elevation: 0.5,
|
||||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
|
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (isAllowSelect) {
|
if (isAllowSelect) {
|
||||||
pushPage(WorkListPage(type: widget.type), context);
|
pushPage(WorkListPage(type: widget.type), context);
|
||||||
|
@ -201,7 +202,7 @@ class _HomeCategroyListPageState extends State<HomeCategroyListPage>
|
||||||
backgroundColor: Colors.blue,
|
backgroundColor: Colors.blue,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 30),
|
padding: EdgeInsets.symmetric(horizontal: 30),
|
||||||
onPressed: () {
|
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;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +330,7 @@ class _HomeCategroyListPageState extends State<HomeCategroyListPage>
|
||||||
{"title": "上次演练", "value": "2025-05-${20 + enterprise['id'] % 10}"},
|
{"title": "上次演练", "value": "2025-05-${20 + enterprise['id'] % 10}"},
|
||||||
{
|
{
|
||||||
"title": "应急预案",
|
"title": "应急预案",
|
||||||
"value": ["已备案", "待更新", "完善中"][enterprise['id'] % 3],
|
"value": ["已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案已备案", "待更新", "完善中"][enterprise['id'] % 3],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "责任人",
|
"title": "责任人",
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import 'package:flutter/material.dart';
|
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/home/home_page.dart';
|
||||||
import 'package:qhdkfq_regulatory_flutter/tools/custom_button.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/h_colors.dart';
|
||||||
import 'package:qhdkfq_regulatory_flutter/tools/my_appbar.dart';
|
import 'package:qhdkfq_regulatory_flutter/tools/my_appbar.dart';
|
||||||
|
import 'package:qhdkfq_regulatory_flutter/tools/tools.dart';
|
||||||
import 'adaptive_list_item.dart';
|
import 'adaptive_list_item.dart';
|
||||||
|
|
||||||
class WorkListPage extends StatefulWidget {
|
class WorkListPage extends StatefulWidget {
|
||||||
|
@ -54,14 +56,13 @@ class _WorkListPageState extends State<WorkListPage> {
|
||||||
// TODO: Handle this case.
|
// TODO: Handle this case.
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
case HomeCategroyType.specialInspection:
|
case HomeCategroyType.specialInspection:
|
||||||
// TODO: Handle this case.
|
_navTitle = "专项行动彻查";
|
||||||
throw UnimplementedError();
|
|
||||||
case HomeCategroyType.disasterReduction:
|
case HomeCategroyType.disasterReduction:
|
||||||
// TODO: Handle this case.
|
// TODO: Handle this case.
|
||||||
|
_navTitle = "防灾减灾专项上报列表";
|
||||||
case HomeCategroyType.supervisionRecord:
|
case HomeCategroyType.supervisionRecord:
|
||||||
throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -93,7 +94,33 @@ class _WorkListPageState extends State<WorkListPage> {
|
||||||
|
|
||||||
List<Widget> _listItemButtons() {
|
List<Widget> _listItemButtons() {
|
||||||
List<Widget> buttons = [];
|
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;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue