parent
b160e2a9ba
commit
7a561e3614
@ -1,141 +1,223 @@
|
|||||||
// Flutter imports:
|
// Flutter imports:
|
||||||
|
import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart';
|
||||||
|
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_card.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
import 'package:aku_community_manager/utils/extension/list_extension.dart';
|
||||||
|
import 'package:aku_community_manager/style/app_style.dart';
|
||||||
// Package imports:
|
// Package imports:
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
||||||
// Project imports:
|
// Project imports:
|
||||||
import 'package:aku_community_manager/const/resource.dart';
|
|
||||||
import 'package:aku_community_manager/mock_models/manage_models/manage_model.dart';
|
|
||||||
import 'package:aku_community_manager/style/app_style.dart';
|
|
||||||
import 'package:aku_community_manager/tools/widget_tool.dart';
|
|
||||||
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
|
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
|
||||||
|
|
||||||
class InspectionManageDetailsPage extends StatelessWidget {
|
class InspectionManageDetailsPage extends StatefulWidget {
|
||||||
final InspectionManageCardModel cardModel;
|
final InspectionListModel cardModel;
|
||||||
InspectionManageDetailsPage({Key key, this.cardModel}) : super(key: key);
|
InspectionManageDetailsPage({Key key, this.cardModel}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InspectionManageDetailsPageState createState() =>
|
||||||
|
_InspectionManageDetailsPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InspectionManageDetailsPageState
|
||||||
|
extends State<InspectionManageDetailsPage> {
|
||||||
|
bool get _isFinishInspection => widget.cardModel.status == 2;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AkuScaffold(
|
return AkuScaffold(
|
||||||
title: '巡检详情',
|
title: '巡检详情',
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
// InspectionManageCard(cardModel:cardModel, extra: false),
|
InspectionManageCard(cardModel: widget.cardModel, extra: false),
|
||||||
|
16.w.heightBox,
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
|
||||||
color: Color(0xFFFFFFFF),
|
decoration: BoxDecoration(color: Color(0xFFFFFF)),
|
||||||
margin: EdgeInsets.only(top: 16.w),
|
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: 24.w, left: 32.w, right: 86.w, bottom: 40.w),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: <Widget>[
|
||||||
children: [
|
'巡检站点'.text.black.size(32.sp).bold.make(),
|
||||||
Text(
|
_buildInspectionTile(
|
||||||
'巡检人员',
|
'',
|
||||||
style: TextStyle(
|
1,
|
||||||
color: AppStyle.primaryTextColor,
|
1,
|
||||||
fontSize: 32.sp,
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
AkuBox.h(16),
|
|
||||||
GridView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: NeverScrollableScrollPhysics(),
|
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 3,
|
|
||||||
childAspectRatio: 250 / 40,
|
|
||||||
mainAxisSpacing: 16.w),
|
|
||||||
children: cardModel.persons
|
|
||||||
.map((e) => _person(cardModel.persons.indexOf(e)))
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
],
|
].sepWidget(separate: 16.w.heightBox),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
AkuBox.h(16),
|
|
||||||
Container(
|
|
||||||
color: Color(0xFFFFFFFF),
|
|
||||||
padding: EdgeInsets.only(top: 24.w, left: 32.w, right: 32.w),
|
|
||||||
width: double.infinity,
|
|
||||||
child:
|
|
||||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
||||||
Text('巡检站点',
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppStyle.primaryTextColor,
|
|
||||||
fontSize: 32.sp,
|
|
||||||
fontWeight: FontWeight.bold)),
|
|
||||||
AkuBox.h(16),
|
|
||||||
Wrap(
|
|
||||||
runSpacing: 16.w,
|
|
||||||
children: cardModel.stations
|
|
||||||
.map((e) => _station(cardModel.stations.indexOf(e)))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
AkuBox.h(24),
|
|
||||||
Image.asset(
|
|
||||||
R.ASSETS_INSPECTION_INSPECTION_STATION_PNG,
|
|
||||||
width: 686.w,
|
|
||||||
height: 343.w,
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _station(index) {
|
Widget _buildInspectionTile(
|
||||||
|
String inspectionStation,
|
||||||
|
int inspectionCount,
|
||||||
|
int index,
|
||||||
|
) {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
children: [
|
||||||
Container(
|
CircleAvatar(
|
||||||
padding:
|
child: '巡$index'.text.color(Color(0x3F8FFE)).size(28.sp).bold.make(),
|
||||||
EdgeInsets.only(top: 16.w, left: 24.w, bottom: 15.w, right: 24.w),
|
radius: 48.w,
|
||||||
color: Color(0xFFF9F9F9),
|
backgroundColor: Color(0xE9F2FF),
|
||||||
height: 64.w,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
cardModel.stations[index],
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppStyle.primaryTextColor, fontSize: 24.sp),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
AkuBox.w(8),
|
24.w.widthBox,
|
||||||
(cardModel.stations.length - 1) != index
|
Column(
|
||||||
? Container(
|
children: [
|
||||||
width: 56.w,
|
inspectionStation.text.black.size(28.sp).bold.make(),
|
||||||
height: 3.w,
|
'$inspectionCount项检查'.text.color(kTextSubColor).size(24.sp).make()
|
||||||
color: Color(0xFFE8E8E8),
|
],
|
||||||
)
|
|
||||||
: SizedBox(),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _person(index) {
|
|
||||||
return Container(
|
|
||||||
height: 40.w,
|
|
||||||
child: Row(mainAxisSize: MainAxisSize.min, children: [
|
|
||||||
Image.asset(
|
|
||||||
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
|
|
||||||
width: 40.w,
|
|
||||||
height: 40.w,
|
|
||||||
),
|
),
|
||||||
AkuBox.w(8),
|
Spacer(),
|
||||||
Text(
|
_inspectionStatus[widget.cardModel.status]
|
||||||
cardModel.persons[index],
|
.text
|
||||||
style: TextStyle(
|
.size(24.sp)
|
||||||
color: AppStyle.primaryTextColor,
|
.bold
|
||||||
fontSize: 28.sp,
|
.color(_inspectionColor(widget.cardModel.status))
|
||||||
),
|
.make(),
|
||||||
|
14.w.widthBox,
|
||||||
|
Icon(
|
||||||
|
CupertinoIcons.chevron_right_circle,
|
||||||
|
size: 14.w,
|
||||||
),
|
),
|
||||||
]),
|
],
|
||||||
);
|
)
|
||||||
|
.box
|
||||||
|
.color(Color(0xF9F9F9))
|
||||||
|
.withRounded(value: 4.w)
|
||||||
|
.padding(EdgeInsets.all(24.w))
|
||||||
|
.make()
|
||||||
|
.onInkTap(() {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Widget _inspectionPersons(){
|
||||||
|
// return Container(
|
||||||
|
// width: double.infinity,
|
||||||
|
// color: Color(0xFFFFFFFF),
|
||||||
|
// margin: EdgeInsets.only(top: 16.w),
|
||||||
|
// padding: EdgeInsets.only(
|
||||||
|
// top: 24.w, left: 32.w, right: 86.w, bottom: 40.w),
|
||||||
|
// child: Column(
|
||||||
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// children: [
|
||||||
|
// Text(
|
||||||
|
// '巡检人员',
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: AppStyle.primaryTextColor,
|
||||||
|
// fontSize: 32.sp,
|
||||||
|
// fontWeight: FontWeight.bold),
|
||||||
|
// ),
|
||||||
|
// AkuBox.h(16),
|
||||||
|
// GridView(
|
||||||
|
// shrinkWrap: true,
|
||||||
|
// physics: NeverScrollableScrollPhysics(),
|
||||||
|
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
// crossAxisCount: 3,
|
||||||
|
// childAspectRatio: 250 / 40,
|
||||||
|
// mainAxisSpacing: 16.w),
|
||||||
|
// children: widget.cardModel.persons
|
||||||
|
// .map((e) => _person(widget.cardModel.persons.indexOf(e)))
|
||||||
|
// .toList(),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// AkuBox.h(16),
|
||||||
|
// Container(
|
||||||
|
// color: Color(0xFFFFFFFF),
|
||||||
|
// padding: EdgeInsets.only(top: 24.w, left: 32.w, right: 32.w),
|
||||||
|
// width: double.infinity,
|
||||||
|
// child:
|
||||||
|
// Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
|
// Text('巡检站点',
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: AppStyle.primaryTextColor,
|
||||||
|
// fontSize: 32.sp,
|
||||||
|
// fontWeight: FontWeight.bold)),
|
||||||
|
// AkuBox.h(16),
|
||||||
|
// Wrap(
|
||||||
|
// runSpacing: 16.w,
|
||||||
|
// children: widget.cardModel.stations
|
||||||
|
// .map((e) => _station(widget.cardModel.stations.indexOf(e)))
|
||||||
|
// .toList(),
|
||||||
|
// ),
|
||||||
|
// AkuBox.h(24),
|
||||||
|
// Image.asset(
|
||||||
|
// R.ASSETS_INSPECTION_INSPECTION_STATION_PNG,
|
||||||
|
// width: 686.w,
|
||||||
|
// height: 343.w,
|
||||||
|
// ),
|
||||||
|
// ]),
|
||||||
|
// );
|
||||||
|
|
||||||
|
// Widget _station(index) {
|
||||||
|
// return Row(
|
||||||
|
// mainAxisSize: MainAxisSize.min,
|
||||||
|
// children: [
|
||||||
|
// Container(
|
||||||
|
// padding:
|
||||||
|
// EdgeInsets.only(top: 16.w, left: 24.w, bottom: 15.w, right: 24.w),
|
||||||
|
// color: Color(0xFFF9F9F9),
|
||||||
|
// height: 64.w,
|
||||||
|
// alignment: Alignment.center,
|
||||||
|
// child: Row(
|
||||||
|
// mainAxisSize: MainAxisSize.min,
|
||||||
|
// children: [
|
||||||
|
// Text(
|
||||||
|
// widget.cardModel.stations[index],
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: AppStyle.primaryTextColor, fontSize: 24.sp),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// AkuBox.w(8),
|
||||||
|
// (widget.cardModel.stations.length - 1) != index
|
||||||
|
// ? Container(
|
||||||
|
// width: 56.w,
|
||||||
|
// height: 3.w,
|
||||||
|
// color: Color(0xFFE8E8E8),
|
||||||
|
// )
|
||||||
|
// : SizedBox(),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Widget _person(index) {
|
||||||
|
// return Container(
|
||||||
|
// height: 40.w,
|
||||||
|
// child: Row(mainAxisSize: MainAxisSize.min, children: [
|
||||||
|
// Image.asset(
|
||||||
|
// R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
|
||||||
|
// width: 40.w,
|
||||||
|
// height: 40.w,
|
||||||
|
// ),
|
||||||
|
// AkuBox.w(8),
|
||||||
|
// Text(
|
||||||
|
// widget.cardModel.persons[index],
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: AppStyle.primaryTextColor,
|
||||||
|
// fontSize: 28.sp,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ]),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
import 'package:aku_community_manager/const/api.dart';
|
||||||
|
import 'package:aku_community_manager/models/manager/inspection/inspection_list_model.dart';
|
||||||
|
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_card.dart';
|
||||||
|
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
|
||||||
|
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
|
||||||
|
class InspectionMangeView extends StatefulWidget {
|
||||||
|
final int inspectionStatus;
|
||||||
|
InspectionMangeView({Key key, this.inspectionStatus}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InspectionMangeViewState createState() => _InspectionMangeViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InspectionMangeViewState extends State<InspectionMangeView> {
|
||||||
|
EasyRefreshController _easyRefreshController;
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_easyRefreshController = EasyRefreshController();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_easyRefreshController?.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeListView(
|
||||||
|
path: API.manage.inspectionList,
|
||||||
|
controller: _easyRefreshController,
|
||||||
|
extraParams: {"inspectionStatus": widget.inspectionStatus},
|
||||||
|
convert: (models) {
|
||||||
|
return models.tableList
|
||||||
|
.map((e) => InspectionListModel.fromJson(e))
|
||||||
|
.toList();
|
||||||
|
},
|
||||||
|
builder: (items) {
|
||||||
|
return ListView.separated(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return InspectionManageCard(cardModel: items[index]);
|
||||||
|
},
|
||||||
|
separatorBuilder: (_, __) {
|
||||||
|
return 8.w.heightBox;
|
||||||
|
},
|
||||||
|
itemCount: items.length);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
|
||||||
|
extension SeparateExt on List<Widget> {
|
||||||
|
List<Widget> sepWidget({Widget separate}) {
|
||||||
|
if (this == null) return null;
|
||||||
|
if (this.isEmpty) return [];
|
||||||
|
return List.generate(this.length * 2 - 1, (index) {
|
||||||
|
if (index.isEven)
|
||||||
|
return this[index ~/ 2];
|
||||||
|
else
|
||||||
|
return separate ?? 10.w.heightBox;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue