|
|
|
@ -1,58 +1,65 @@
|
|
|
|
|
import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart';
|
|
|
|
|
import 'package:aku_community_manager/provider/user_provider.dart';
|
|
|
|
|
import 'package:aku_community_manager/style/app_style.dart';
|
|
|
|
|
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart';
|
|
|
|
|
import 'package:aku_ui/aku_ui.dart';
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:velocity_x/velocity_x.dart';
|
|
|
|
|
|
|
|
|
|
class InspectionManageCard extends StatefulWidget {
|
|
|
|
|
final InspectionListModel cardModel;
|
|
|
|
|
final bool extra;
|
|
|
|
|
InspectionManageCard({Key key, this.cardModel, this.extra = true})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
InspectionManageCard({
|
|
|
|
|
Key key,
|
|
|
|
|
this.cardModel,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_InspectionManageCardState createState() => _InspectionManageCardState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _InspectionManageCardState extends State<InspectionManageCard> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
TextStyle _textstyle =
|
|
|
|
|
TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp);
|
|
|
|
|
Map<int, String> _inspectionStatus = {
|
|
|
|
|
1: '待巡检',
|
|
|
|
|
2: '已巡检',
|
|
|
|
|
};
|
|
|
|
|
Color _inspectionColor(int status) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case 1:
|
|
|
|
|
return Color(0xFF4501);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
return Color(0x999999);
|
|
|
|
|
default:
|
|
|
|
|
return Colors.black;
|
|
|
|
|
}
|
|
|
|
|
TextStyle _textstyle =
|
|
|
|
|
TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp);
|
|
|
|
|
Map<int, String> _inspectionStatus = {1: '待巡检', 2: '已巡检', 3: '巡检中', 4: '未巡检'};
|
|
|
|
|
Color _inspectionColor(int status) {
|
|
|
|
|
switch (status) {
|
|
|
|
|
case 1:
|
|
|
|
|
return Color(0xFFFF4501);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
return Color(0xFF999999);
|
|
|
|
|
case 3:
|
|
|
|
|
return Color(0xFFFF4501);
|
|
|
|
|
case 4:
|
|
|
|
|
return Color(0xFFFF4501);
|
|
|
|
|
default:
|
|
|
|
|
return Colors.blue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool get isManager {
|
|
|
|
|
UserProvider userProvider = Provider.of<UserProvider>(context);
|
|
|
|
|
return userProvider.infoModel.canOperation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
16.w.heightBox,
|
|
|
|
|
AkuButton(
|
|
|
|
|
onPressed: widget.extra
|
|
|
|
|
? () {
|
|
|
|
|
Get.to(
|
|
|
|
|
InspectionManageDetailsPage(
|
|
|
|
|
inspectionStatus: widget.cardModel.status,
|
|
|
|
|
executeId: widget.cardModel.id,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: () {},
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Get.to(
|
|
|
|
|
InspectionManageDetailsPage(
|
|
|
|
|
inspectionStatus: widget.cardModel.status,
|
|
|
|
|
executeId: widget.cardModel.id,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
padding: EdgeInsets.only(left: 24.w, right: 24.w, bottom: 40.w),
|
|
|
|
@ -62,19 +69,19 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
|
|
|
|
|
color: Color(0xFFFFFFFF)),
|
|
|
|
|
child: Column(children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: widget.extra ? 93.w : 86.w,
|
|
|
|
|
height: 93.w,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'${widget.cardModel.name}',
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: AppStyle.primaryTextColor,
|
|
|
|
|
fontSize: widget.extra ? 32.sp : 36.sp,
|
|
|
|
|
fontSize: 32.sp,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
Spacer(),
|
|
|
|
|
).expand(),
|
|
|
|
|
_inspectionStatus[widget.cardModel.status]
|
|
|
|
|
.text
|
|
|
|
|
.color(_inspectionColor(widget.cardModel.status))
|
|
|
|
@ -84,9 +91,38 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
...widget.extra
|
|
|
|
|
? <Widget>[Divider(height: 1.w), 24.w.heightBox]
|
|
|
|
|
: [
|
|
|
|
|
Divider(height: 1.w),
|
|
|
|
|
24.w.heightBox,
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
|
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
|
|
|
|
width: 40.w,
|
|
|
|
|
height: 40.w,
|
|
|
|
|
),
|
|
|
|
|
4.w.widthBox,
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'巡检编号',
|
|
|
|
|
style: _textstyle,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
36.w.widthBox,
|
|
|
|
|
Text(
|
|
|
|
|
widget.cardModel.code,
|
|
|
|
|
maxLines: 2,
|
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
|
style: AppStyle().primaryStyle,
|
|
|
|
|
).expand()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
12.w.heightBox,
|
|
|
|
|
...isManager
|
|
|
|
|
? [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
@ -96,38 +132,19 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
|
|
|
|
|
),
|
|
|
|
|
4.w.widthBox,
|
|
|
|
|
Text(
|
|
|
|
|
'巡检名称',
|
|
|
|
|
'巡检人',
|
|
|
|
|
style: _textstyle,
|
|
|
|
|
),
|
|
|
|
|
Spacer(),
|
|
|
|
|
Text(
|
|
|
|
|
widget.cardModel.name,
|
|
|
|
|
widget.cardModel.inspectorName,
|
|
|
|
|
style: AppStyle().primaryStyle,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
12.w.heightBox,
|
|
|
|
|
],
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
|
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
|
|
|
|
width: 40.w,
|
|
|
|
|
height: 40.w,
|
|
|
|
|
),
|
|
|
|
|
4.w.widthBox,
|
|
|
|
|
Text(
|
|
|
|
|
'巡检编号',
|
|
|
|
|
style: _textstyle,
|
|
|
|
|
),
|
|
|
|
|
Spacer(),
|
|
|
|
|
Text(
|
|
|
|
|
widget.cardModel.code,
|
|
|
|
|
style: AppStyle().primaryStyle,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
12.w.heightBox,
|
|
|
|
|
]
|
|
|
|
|
: [SizedBox()],
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Image.asset(
|
|
|
|
@ -145,7 +162,7 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
12.w.heightBox,
|
|
|
|
|
...widget.cardModel?.actualBeginDate == null
|
|
|
|
|
...widget?.cardModel?.actualBeginDate == null
|
|
|
|
|
? [SizedBox()]
|
|
|
|
|
: [
|
|
|
|
|
Row(
|
|
|
|
@ -169,7 +186,7 @@ class _InspectionManageCardState extends State<InspectionManageCard> {
|
|
|
|
|
),
|
|
|
|
|
12.w.heightBox,
|
|
|
|
|
],
|
|
|
|
|
widget.cardModel?.actualEndDate == null
|
|
|
|
|
widget?.cardModel?.actualEndDate == null
|
|
|
|
|
? SizedBox()
|
|
|
|
|
: Row(
|
|
|
|
|
children: [
|
|
|
|
|