|
|
@ -1,9 +1,11 @@
|
|
|
|
// Flutter imports:
|
|
|
|
// Flutter imports:
|
|
|
|
|
|
|
|
import 'package:akuCommunity/constants/api.dart';
|
|
|
|
|
|
|
|
import 'package:akuCommunity/model/manager/mine_goods_model.dart';
|
|
|
|
|
|
|
|
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
|
|
|
|
|
|
|
|
import 'package:akuCommunity/utils/bee_map.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
// Package imports:
|
|
|
|
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Project imports:
|
|
|
|
// Project imports:
|
|
|
|
import 'package:akuCommunity/utils/headers.dart';
|
|
|
|
import 'package:akuCommunity/utils/headers.dart';
|
|
|
@ -17,76 +19,18 @@ class MineGoodsPage extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
List<Map<String, dynamic>> _listGoods = [
|
|
|
|
EasyRefreshController _controller;
|
|
|
|
{
|
|
|
|
|
|
|
|
'title': '榔头',
|
|
|
|
|
|
|
|
'goodsNum': 6,
|
|
|
|
|
|
|
|
'borrowTime': '2020.09.18 12:00',
|
|
|
|
|
|
|
|
'timeLength': '7',
|
|
|
|
|
|
|
|
'status': '未还'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'title': '梯子',
|
|
|
|
|
|
|
|
'goodsNum': 1,
|
|
|
|
|
|
|
|
'borrowTime': '2020.08.28 12:00',
|
|
|
|
|
|
|
|
'timeLength': '3',
|
|
|
|
|
|
|
|
'status': '已还'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'title': '电钻',
|
|
|
|
|
|
|
|
'goodsNum': 1,
|
|
|
|
|
|
|
|
'borrowTime': '2020.07.04 12:00',
|
|
|
|
|
|
|
|
'timeLength': '6',
|
|
|
|
|
|
|
|
'status': '未还'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'title': '多功能螺丝刀',
|
|
|
|
|
|
|
|
'goodsNum': 4,
|
|
|
|
|
|
|
|
'borrowTime': '2020.04.06 12:00',
|
|
|
|
|
|
|
|
'timeLength': '4',
|
|
|
|
|
|
|
|
'status': '已还'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'title': '手电筒',
|
|
|
|
|
|
|
|
'goodsNum': 2,
|
|
|
|
|
|
|
|
'borrowTime': '2020.02.19 12:00',
|
|
|
|
|
|
|
|
'timeLength': '2',
|
|
|
|
|
|
|
|
'status': '已还'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'title': '胶带',
|
|
|
|
|
|
|
|
'goodsNum': 3,
|
|
|
|
|
|
|
|
'borrowTime': '2020.01.14 12:00',
|
|
|
|
|
|
|
|
'timeLength': '8',
|
|
|
|
|
|
|
|
'status': '未还'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RefreshController _refreshController =
|
|
|
|
|
|
|
|
RefreshController(initialRefresh: false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
_controller = EasyRefreshController();
|
|
|
|
|
|
|
|
|
|
|
|
void _onRefresh() async {
|
|
|
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 1500));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _onLoading() async {
|
|
|
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 1500));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mounted) setState(() {});
|
|
|
|
|
|
|
|
_refreshController.loadComplete();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
super.dispose();
|
|
|
|
_refreshController.dispose();
|
|
|
|
_controller.dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
InkWell _frmLoss() {
|
|
|
|
InkWell _frmLoss() {
|
|
|
@ -109,8 +53,15 @@ class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Container _goodsCard(
|
|
|
|
String _getDatelength(int date) {
|
|
|
|
String title, borrowTime, timeLength, status, int goodsNum) {
|
|
|
|
if (date >= 24) {
|
|
|
|
|
|
|
|
return '${date / 24}' + '${date % 24}';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return '$date';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Container _goodsCard(MineGoodsModel model) {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
top: 20.w,
|
|
|
|
top: 20.w,
|
|
|
@ -136,7 +87,7 @@ class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
'物品名称:$title',
|
|
|
|
'物品名称:${model.name}',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 28.sp,
|
|
|
|
fontSize: 28.sp,
|
|
|
|
color: Color(0xff4a4b51),
|
|
|
|
color: Color(0xff4a4b51),
|
|
|
@ -145,7 +96,7 @@ class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 16.w),
|
|
|
|
margin: EdgeInsets.only(top: 16.w),
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
'借还数量:$goodsNum个',
|
|
|
|
'借还数量:10个',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24.sp,
|
|
|
|
fontSize: 24.sp,
|
|
|
|
color: Color(0xff333333),
|
|
|
|
color: Color(0xff333333),
|
|
|
@ -155,7 +106,7 @@ class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 16.w),
|
|
|
|
margin: EdgeInsets.only(top: 16.w),
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
'借用时间: $borrowTime',
|
|
|
|
'借用时间: ${model.beginDate}',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24.sp,
|
|
|
|
fontSize: 24.sp,
|
|
|
|
color: Color(0xff999999),
|
|
|
|
color: Color(0xff999999),
|
|
|
@ -165,7 +116,7 @@ class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 16.w),
|
|
|
|
margin: EdgeInsets.only(top: 16.w),
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
'借用时长: $timeLength日',
|
|
|
|
'借用时长: ${_getDatelength(model.borrowDate)}',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24.sp,
|
|
|
|
fontSize: 24.sp,
|
|
|
|
color: Color(0xff999999),
|
|
|
|
color: Color(0xff999999),
|
|
|
@ -178,7 +129,7 @@ class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
'借用状态: $status',
|
|
|
|
'借用状态: ${BeeMap.borrowStatus}',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24.sp,
|
|
|
|
fontSize: 24.sp,
|
|
|
|
color: Color(0xff999999),
|
|
|
|
color: Color(0xff999999),
|
|
|
@ -190,11 +141,11 @@ class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 12.w),
|
|
|
|
SizedBox(height: 12.w),
|
|
|
|
Divider(color: Color(0xfff9f9f9)),
|
|
|
|
Divider(color: Color(0xfff9f9f9)),
|
|
|
|
status == '未还'
|
|
|
|
model.borrowStatus == 1
|
|
|
|
? Container(
|
|
|
|
? Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 9.w),
|
|
|
|
margin: EdgeInsets.only(bottom: 9.w),
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
'温馨提示:您的物品已借用$timeLength天,如果用完,请及时归还',
|
|
|
|
'温馨提示:您的物品已借用${_getDatelength(model.borrowDate)},如果用完,请及时归还',
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 22.sp,
|
|
|
|
fontSize: 22.sp,
|
|
|
|
color: Color(0xff999999),
|
|
|
|
color: Color(0xff999999),
|
|
|
@ -214,26 +165,39 @@ class _MineGoodsPageState extends State<MineGoodsPage> {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return BeeScaffold(
|
|
|
|
return BeeScaffold(
|
|
|
|
title: '我的借还物品',
|
|
|
|
title: '我的借还物品',
|
|
|
|
body: RefreshConfiguration(
|
|
|
|
// body: RefreshConfiguration(
|
|
|
|
child: SmartRefresher(
|
|
|
|
// child: SmartRefresher(
|
|
|
|
controller: _refreshController,
|
|
|
|
// controller: _refreshController,
|
|
|
|
header: WaterDropHeader(),
|
|
|
|
// header: WaterDropHeader(),
|
|
|
|
footer: ClassicFooter(),
|
|
|
|
// footer: ClassicFooter(),
|
|
|
|
onRefresh: _onRefresh,
|
|
|
|
// onRefresh: _onRefresh,
|
|
|
|
onLoading: _onLoading,
|
|
|
|
// onLoading: _onLoading,
|
|
|
|
enablePullUp: true,
|
|
|
|
// enablePullUp: true,
|
|
|
|
child: ListView.builder(
|
|
|
|
// child: ListView.builder(
|
|
|
|
itemBuilder: (BuildContext context, int index) => _goodsCard(
|
|
|
|
// itemBuilder: (BuildContext context, int index) => _goodsCard(
|
|
|
|
_listGoods[index]['title'],
|
|
|
|
// _listGoods[index]['title'],
|
|
|
|
_listGoods[index]['borrowTime'],
|
|
|
|
// _listGoods[index]['borrowTime'],
|
|
|
|
_listGoods[index]['timeLength'],
|
|
|
|
// _listGoods[index]['timeLength'],
|
|
|
|
_listGoods[index]['status'],
|
|
|
|
// _listGoods[index]['status'],
|
|
|
|
_listGoods[index]['goodsNum'],
|
|
|
|
// _listGoods[index]['goodsNum'],
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
itemCount: _listGoods.length,
|
|
|
|
// itemCount: _listGoods.length,
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
|
|
|
|
body: BeeListView(
|
|
|
|
|
|
|
|
path: API.manager.articleBorrowMylist,
|
|
|
|
|
|
|
|
controller: _controller,
|
|
|
|
|
|
|
|
convert: (model) {
|
|
|
|
|
|
|
|
return model.tableList
|
|
|
|
|
|
|
|
.map((e) => MineGoodsModel.fromJson(e))
|
|
|
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
builder: (items) {
|
|
|
|
|
|
|
|
return ListView.builder(itemBuilder: (context, index) {
|
|
|
|
|
|
|
|
return _goodsCard(items[index]);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|