parent
5edf491898
commit
ebf7e230d0
@ -0,0 +1,21 @@
|
||||
class HouseKeepingBuildingModel {
|
||||
int value;
|
||||
String label;
|
||||
|
||||
HouseKeepingBuildingModel({this.value, this.label});
|
||||
|
||||
HouseKeepingBuildingModel.fromJson(Map<String, dynamic> json) {
|
||||
value = json['value'];
|
||||
label = json['label'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['value'] = this.value;
|
||||
data['label'] = this.label;
|
||||
return data;
|
||||
}
|
||||
|
||||
factory HouseKeepingBuildingModel.init() =>
|
||||
HouseKeepingBuildingModel(value: -1, label: '');
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
class HouseKeepingListModel {
|
||||
int id;
|
||||
String roomName;
|
||||
int num;
|
||||
String leaderName;
|
||||
String leaderTel;
|
||||
String content;
|
||||
String createName;
|
||||
String createDate;
|
||||
|
||||
HouseKeepingListModel(
|
||||
{this.id,
|
||||
this.roomName,
|
||||
this.num,
|
||||
this.leaderName,
|
||||
this.leaderTel,
|
||||
this.content,
|
||||
this.createName,
|
||||
this.createDate});
|
||||
|
||||
HouseKeepingListModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
roomName = json['roomName'];
|
||||
num = json['num'];
|
||||
leaderName = json['leaderName'];
|
||||
leaderTel = json['leaderTel'];
|
||||
content = json['content'];
|
||||
createName = json['createName'];
|
||||
createDate = json['createDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['roomName'] = this.roomName;
|
||||
data['num'] = this.num;
|
||||
data['leaderName'] = this.leaderName;
|
||||
data['leaderTel'] = this.leaderTel;
|
||||
data['content'] = this.content;
|
||||
data['createName'] = this.createName;
|
||||
data['createDate'] = this.createDate;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,343 @@
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:aku_community_manager/models/manager/house_keeping/house_keeping_building_model.dart';
|
||||
import 'package:aku_community_manager/style/app_style.dart';
|
||||
import 'package:aku_community_manager/tools/aku_divider.dart';
|
||||
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
|
||||
import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart';
|
||||
import 'package:aku_community_manager/utils/network/base_model.dart';
|
||||
import 'package:aku_community_manager/utils/network/net_util.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart' hide Response;
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart';
|
||||
|
||||
class HouseKeepingAddPage extends StatefulWidget {
|
||||
HouseKeepingAddPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HouseKeepingAddPageState createState() => _HouseKeepingAddPageState();
|
||||
}
|
||||
|
||||
class _HouseKeepingAddPageState extends State<HouseKeepingAddPage> {
|
||||
HouseKeepingBuildingModel _buidling = HouseKeepingBuildingModel.init();
|
||||
HouseKeepingBuildingModel _united = HouseKeepingBuildingModel.init();
|
||||
HouseKeepingBuildingModel _houseProperty = HouseKeepingBuildingModel.init();
|
||||
TextEditingController _nameController;
|
||||
TextEditingController _telController;
|
||||
TextEditingController _numController;
|
||||
TextEditingController _contentController;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_nameController = TextEditingController();
|
||||
_telController = TextEditingController();
|
||||
_numController = TextEditingController();
|
||||
_contentController = TextEditingController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
_telController.dispose();
|
||||
_numController.dispose();
|
||||
_contentController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AkuScaffold(
|
||||
title: '添加',
|
||||
body: ListView(
|
||||
children: [
|
||||
24.w.heightBox,
|
||||
_slectEstate(),
|
||||
40.w.heightBox,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(color: Colors.white),
|
||||
padding: EdgeInsets.all(32.w),
|
||||
child: Column(
|
||||
children: [
|
||||
_inputRowTile('负责人名称', _nameController),
|
||||
_inputRowTile('负责人手机号', _telController),
|
||||
_inputRowTile('人数', _numController),
|
||||
_inputRowTile('内容', _contentController),
|
||||
].sepWidget(separate: 40.w.heightBox),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
bottom: AkuBottomButton(
|
||||
title: '立即提交',
|
||||
onTap: () async {
|
||||
await _submit();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future _submit() async {
|
||||
BaseModel baseModel = await NetUtil().post(
|
||||
API.manage.addHouseKeeping,
|
||||
params: {
|
||||
"estateId": _houseProperty.value,
|
||||
"num": int.parse(_numController.text),
|
||||
"leaderName": _nameController.text,
|
||||
"leaderTel": _telController.text,
|
||||
"content": _contentController.text,
|
||||
},
|
||||
showMessage: true,
|
||||
);
|
||||
if (baseModel.status) {
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
|
||||
Widget _slectEstate() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildingslecet(),
|
||||
40.w.heightBox,
|
||||
_uniteSelect(),
|
||||
40.w.heightBox,
|
||||
_houseSelect()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildingslecet() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
'选择楼栋'.text.size(32.sp).color(kTextPrimaryColor).bold.make(),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
List<HouseKeepingBuildingModel> _models = [];
|
||||
|
||||
Response response = await NetUtil().dio.get(
|
||||
API.manage.allBuilding,
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
_models = (response.data as List)
|
||||
.map((e) => HouseKeepingBuildingModel.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
// showItemSheet(
|
||||
// title: '选择楼栋',
|
||||
// items: _models.map((e) => e.label).toList(),
|
||||
// );
|
||||
await _showBottomSheet('选择楼栋', _models, onTap: (e) {
|
||||
_buidling = e;
|
||||
setState(() {});
|
||||
});
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
32.w.heightBox,
|
||||
Row(
|
||||
children: [
|
||||
_buidling.label.isEmptyOrNull
|
||||
? '请选择楼栋'
|
||||
.text
|
||||
.size(30.sp)
|
||||
.color(kTextSubColor)
|
||||
.bold
|
||||
.make()
|
||||
: _buidling.label.text
|
||||
.size(28.sp)
|
||||
.color(kTextPrimaryColor)
|
||||
.make(),
|
||||
Spacer()
|
||||
],
|
||||
).material(color: Colors.transparent),
|
||||
],
|
||||
)),
|
||||
12.w.heightBox,
|
||||
AkuDivider.horizontal(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_uniteSelect() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
'选择单元'.text.size(32.sp).color(kTextPrimaryColor).bold.make(),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
List<HouseKeepingBuildingModel> _models = [];
|
||||
|
||||
if (_buidling.value == -1) {
|
||||
BotToast.showText(text: '请先选择楼栋!');
|
||||
return;
|
||||
}
|
||||
|
||||
Response response = await NetUtil().dio.get(API.manage.allUnit,
|
||||
queryParameters: {"buildingId": _buidling.value});
|
||||
if (response.statusCode == 200) {
|
||||
_models = (response.data as List)
|
||||
.map((e) => HouseKeepingBuildingModel.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
await _showBottomSheet('选择单元', _models, onTap: (e) {
|
||||
_united = e;
|
||||
setState(() {});
|
||||
});
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
32.w.heightBox,
|
||||
Row(
|
||||
children: [
|
||||
_united.label.isEmptyOrNull
|
||||
? '请选择单元'
|
||||
.text
|
||||
.size(30.sp)
|
||||
.color(kTextSubColor)
|
||||
.bold
|
||||
.make()
|
||||
: _united.label.text
|
||||
.size(28.sp)
|
||||
.color(kTextPrimaryColor)
|
||||
.make(),
|
||||
Spacer()
|
||||
],
|
||||
).material(color: Colors.transparent),
|
||||
],
|
||||
)),
|
||||
12.w.heightBox,
|
||||
AkuDivider.horizontal(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_houseSelect() {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
'选择房产'.text.size(32.sp).color(kTextPrimaryColor).bold.make(),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
List<HouseKeepingBuildingModel> _models = [];
|
||||
|
||||
if (_united.value == -1) {
|
||||
BotToast.showText(text: '请先选择单元!');
|
||||
return;
|
||||
}
|
||||
|
||||
Response response = await NetUtil().dio.get(API.manage.allHous,
|
||||
queryParameters: {"unitId": _united.value});
|
||||
if (response.statusCode == 200) {
|
||||
_models = (response.data as List)
|
||||
.map((e) => HouseKeepingBuildingModel.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
await _showBottomSheet('选择单元', _models, onTap: (e) {
|
||||
_houseProperty = e;
|
||||
setState(() {});
|
||||
});
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
32.w.heightBox,
|
||||
Row(
|
||||
children: [
|
||||
_houseProperty.label.isEmptyOrNull
|
||||
? '请选择房产'
|
||||
.text
|
||||
.size(30.sp)
|
||||
.color(kTextSubColor)
|
||||
.bold
|
||||
.make()
|
||||
: _houseProperty.label.text
|
||||
.size(28.sp)
|
||||
.color(kTextPrimaryColor)
|
||||
.make(),
|
||||
Spacer()
|
||||
],
|
||||
).material(color: Colors.transparent),
|
||||
],
|
||||
)),
|
||||
12.w.heightBox,
|
||||
AkuDivider.horizontal(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future _showBottomSheet(String title, List<HouseKeepingBuildingModel> models,
|
||||
{Function(HouseKeepingBuildingModel model) onTap}) async {
|
||||
await Get.bottomSheet(
|
||||
CupertinoActionSheet(
|
||||
title: title.text
|
||||
.size(32.sp)
|
||||
.bold
|
||||
.color(kTextPrimaryColor)
|
||||
.isIntrinsic
|
||||
.make(),
|
||||
actions: models
|
||||
.map(
|
||||
(e) => CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
onTap(e);
|
||||
Get.back();
|
||||
setState(() {});
|
||||
},
|
||||
child: e.label.text
|
||||
.size(28.sp)
|
||||
.color(kTextPrimaryColor)
|
||||
.isIntrinsic
|
||||
.make(),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _inputRowTile(String title, TextEditingController controller,
|
||||
{String hintText, List<TextInputFormatter> formatters}) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
title.text.size(28.sp).color(kTextPrimaryColor).make(),
|
||||
32.w.heightBox,
|
||||
TextField(
|
||||
inputFormatters: formatters,
|
||||
controller: controller,
|
||||
textAlign: TextAlign.start,
|
||||
onChanged: (value) {
|
||||
setState(() {});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText ?? '',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFE8E8E8), width: 2.w),
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 36.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: kTextPrimaryColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
import 'package:aku_community_manager/models/manager/house_keeping/house_keeping_list_model.dart';
|
||||
import 'package:aku_community_manager/style/app_style.dart';
|
||||
import 'package:aku_community_manager/tools/aku_divider.dart';
|
||||
import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_detail_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart';
|
||||
|
||||
class HouseKeepingCard extends StatefulWidget {
|
||||
final HouseKeepingListModel model;
|
||||
HouseKeepingCard({Key key, this.model}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HouseKeepingCardState createState() => _HouseKeepingCardState();
|
||||
}
|
||||
|
||||
class _HouseKeepingCardState extends State<HouseKeepingCard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)),
|
||||
elevation: 0,
|
||||
padding: EdgeInsets.all(24.w),
|
||||
onPressed: () {
|
||||
Get.to(() => HouseKeepingDetailPage(model:widget.model));
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'家政服务'.text.size(32.sp).color(kTextPrimaryColor).bold.make(),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
16.w.heightBox,
|
||||
AkuDivider.horizontal(),
|
||||
24.w.heightBox,
|
||||
...<Widget>[
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
||||
'房产名称',
|
||||
widget.model.roomName.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make()),
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
||||
'人数',
|
||||
widget.model.num
|
||||
.toString()
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make()),
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
||||
'负责人姓名',
|
||||
widget.model.leaderName.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make()),
|
||||
_rowTile(
|
||||
R.ASSETS_MESSAGE_IC_PHONE_PNG,
|
||||
'负责人手机',
|
||||
widget.model.leaderTel.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make()),
|
||||
].sepWidget(separate: 12.w.heightBox),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _rowTile(String iconPath, String title, Widget content) {
|
||||
return Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
child: Image.asset(iconPath),
|
||||
),
|
||||
12.w.widthBox,
|
||||
title.text.size(24.sp).color(kTextSubColor).make(),
|
||||
Spacer(),
|
||||
content,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
import 'package:aku_community_manager/models/manager/house_keeping/house_keeping_list_model.dart';
|
||||
import 'package:aku_community_manager/style/app_style.dart';
|
||||
import 'package:aku_community_manager/tools/aku_divider.dart';
|
||||
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart';
|
||||
|
||||
class HouseKeepingDetailPage extends StatefulWidget {
|
||||
final HouseKeepingListModel model;
|
||||
HouseKeepingDetailPage({Key key, this.model}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HouseKeepingDetailPageState createState() => _HouseKeepingDetailPageState();
|
||||
}
|
||||
|
||||
class _HouseKeepingDetailPageState extends State<HouseKeepingDetailPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AkuScaffold(
|
||||
title: '服务详情',
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
children: [
|
||||
_interviewInfo(),
|
||||
20.w.heightBox,
|
||||
_contentWidget(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _interviewInfo() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
|
||||
padding: EdgeInsets.all(24.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'家政服务'.text.size(32.sp).color(kTextPrimaryColor).bold.make(),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
16.w.heightBox,
|
||||
AkuDivider.horizontal(),
|
||||
24.w.heightBox,
|
||||
...<Widget>[
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
||||
'房产名称',
|
||||
widget.model.roomName.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make()),
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
||||
'人数',
|
||||
widget.model.num
|
||||
.toString()
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make()),
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
||||
'负责人姓名',
|
||||
widget.model.leaderName.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make()),
|
||||
_rowTile(
|
||||
R.ASSETS_MESSAGE_IC_PHONE_PNG,
|
||||
'负责人手机',
|
||||
widget.model.leaderTel.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make()),
|
||||
].sepWidget(separate: 12.w.heightBox),
|
||||
// _getBottomButtons(widget.model.status),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _contentWidget() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
|
||||
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'访谈内容'.text.size(32.sp).color(kTextPrimaryColor).bold.make(),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
16.w.heightBox,
|
||||
AkuDivider.horizontal(),
|
||||
20.w.heightBox,
|
||||
widget.model.content.text.size(28.sp).color(kTextPrimaryColor).make(),
|
||||
40.w.heightBox,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
widget.model.createDate.text
|
||||
.size(24.sp)
|
||||
.color(kTextSubColor)
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _rowTile(String iconPath, String title, Widget content) {
|
||||
return Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
child: Image.asset(iconPath),
|
||||
),
|
||||
12.w.widthBox,
|
||||
title.text.size(24.sp).color(kTextSubColor).make(),
|
||||
Spacer(),
|
||||
content,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:aku_community_manager/models/manager/house_keeping/house_keeping_list_model.dart';
|
||||
import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_card.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:velocity_x/velocity_x.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
class HouseKeepingView extends StatefulWidget {
|
||||
final int index;
|
||||
HouseKeepingView({Key key, this.index}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HouseKeepingViewState createState() => _HouseKeepingViewState();
|
||||
}
|
||||
|
||||
class _HouseKeepingViewState extends State<HouseKeepingView> {
|
||||
EasyRefreshController _refreshController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refreshController = EasyRefreshController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeListView(
|
||||
path: API.manage.houseKeepingList,
|
||||
controller: _refreshController,
|
||||
convert: (models) {
|
||||
return models.tableList
|
||||
.map((e) => HouseKeepingListModel.fromJson(e))
|
||||
.toList();
|
||||
},
|
||||
builder: (items) {
|
||||
return ListView.separated(
|
||||
padding: EdgeInsets.all(24.w),
|
||||
itemBuilder: (context, index) {
|
||||
return HouseKeepingCard(model: items[index]);
|
||||
},
|
||||
separatorBuilder: (_, __) {
|
||||
return 24.w.heightBox;
|
||||
},
|
||||
itemCount: items.length);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in new issue