设施检查完成信息回显

hmxc
张萌 3 years ago
parent 63e3e2a72b
commit 7c5afab92b

@ -18,6 +18,7 @@ class FacilitiesCard extends StatefulWidget {
final int facilitiesType; final int facilitiesType;
final FacilitiesCheckListModel model; final FacilitiesCheckListModel model;
final VoidCallback? callRefresh; final VoidCallback? callRefresh;
FacilitiesCard( FacilitiesCard(
{Key? key, {Key? key,
required this.index, required this.index,
@ -74,6 +75,7 @@ class _FacilitiesCardState extends State<FacilitiesCard> {
await Get.to(() => FacilitiesInspectReportPage( await Get.to(() => FacilitiesInspectReportPage(
facilitiesType: widget.facilitiesType, facilitiesType: widget.facilitiesType,
id: widget.model.id!, id: widget.model.id!,
model: widget.index != 1 ? widget.model : null,
)); ));
widget.callRefresh!(); widget.callRefresh!();
}, },
@ -98,6 +100,7 @@ class _FacilitiesCardState extends State<FacilitiesCard> {
await Get.to(() => FacilitiesInspectReportPage( await Get.to(() => FacilitiesInspectReportPage(
facilitiesType: widget.facilitiesType, facilitiesType: widget.facilitiesType,
id: widget.model.id!, id: widget.model.id!,
model: widget.index != 1 ? widget.model : null,
)); ));
widget.callRefresh!(); widget.callRefresh!();
}); });

@ -3,30 +3,33 @@ import 'dart:io';
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/facilities/facilities_check_list_model.dart';
// Project imports:
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/bee_grid_image_view.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_button.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
// Project imports:
import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.dart';
import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class FacilitiesInspectReportPage extends StatefulWidget { class FacilitiesInspectReportPage extends StatefulWidget {
final int facilitiesType; final int facilitiesType;
final int id; final int id;
final FacilitiesCheckListModel? model;
FacilitiesInspectReportPage({ FacilitiesInspectReportPage({
Key? key, Key? key,
/*required*/ required this.facilitiesType, /*required*/ required this.facilitiesType,
/*required*/ required this.id, /*required*/ required this.id,
this.model,
}) : super(key: key); }) : super(key: key);
@override @override
@ -39,7 +42,9 @@ class _FacilitiesInspectReportPageState
// List<File>? _selfPhotos; // List<File>? _selfPhotos;
late List<File> _scenePhotos; late List<File> _scenePhotos;
String? _describtion; String? _describtion;
int _scene = 1;// 1 2 int _scene = 1; // 1 2
bool get editEnable => widget.model == null;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
@ -142,9 +147,7 @@ class _FacilitiesInspectReportPageState
return Column( return Column(
children: [ children: [
Row( Row(
children: [ children: ['$title'.text.color(kTextPrimaryColor).size(32.sp).make()],
'$title'.text.color(kTextPrimaryColor).size(32.sp).make()
],
), ),
32.w.heightBox, 32.w.heightBox,
Row( Row(
@ -153,20 +156,24 @@ class _FacilitiesInspectReportPageState
text: '正常', text: '正常',
value: 1, value: 1,
gropValue: _scene, gropValue: _scene,
onPressed: () { onPressed: !editEnable
_scene = 1; ? () {}
setState(() {}); : () {
}, _scene = 1;
setState(() {});
},
), ),
80.w.widthBox, 80.w.widthBox,
AkuSingleCheckButton( AkuSingleCheckButton(
text: '异常', text: '异常',
value: 2, value: 2,
gropValue: _scene, gropValue: _scene,
onPressed: () { onPressed: !editEnable
_scene = 2; ? () {}
setState(() {}); : () {
}, _scene = 2;
setState(() {});
},
), ),
], ],
), ),
@ -181,25 +188,27 @@ class _FacilitiesInspectReportPageState
color: Color(0xFFE8E8E8), color: Color(0xFFE8E8E8),
), ),
), ),
child: TextField( child: !editEnable
minLines: 5, ? (widget.model!.detail ?? '').text.size(28.sp).black.make()
maxLines: 10, : TextField(
autofocus: false, minLines: 5,
onChanged: (value) { maxLines: 10,
_describtion = value; autofocus: false,
}, onChanged: (value) {
decoration: InputDecoration( _describtion = value;
hintText: '请详细描述异常情况', },
hintStyle: TextStyle( decoration: InputDecoration(
fontSize: 28.sp, hintText: '请详细描述异常情况',
color: kTextSubColor, hintStyle: TextStyle(
), fontSize: 28.sp,
contentPadding: color: kTextSubColor,
EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w), ),
border: InputBorder.none, contentPadding:
isDense: true, EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w),
), border: InputBorder.none,
), isDense: true,
),
),
), ),
], ],
) )
@ -244,13 +253,19 @@ class _FacilitiesInspectReportPageState
// ], // ],
// ), // ),
32.w.heightBox, 32.w.heightBox,
AkuPickImageWidget( !editEnable
description: '上传现场照片', ? BeeGridImageView(
onChanged: (files) { urls: (widget.model!.imgList ?? [])
_scenePhotos = files; .map((e) => API.image(e.url ?? ''))
setState(() {}); .toList(),
}, )
) : AkuPickImageWidget(
description: '上传现场照片',
onChanged: (files) {
_scenePhotos = files;
setState(() {});
},
)
], ],
) )
.box .box

Loading…
Cancel
Save