|
|
@ -21,6 +21,7 @@ class BorrowGoodsPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
|
|
|
|
class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
|
|
|
|
EasyRefreshController _easyRefreshController;
|
|
|
|
EasyRefreshController _easyRefreshController;
|
|
|
|
|
|
|
|
List<int> _receiveIds = [];
|
|
|
|
List<int> _submitIds = [];
|
|
|
|
List<int> _submitIds = [];
|
|
|
|
List<int> _counts = [];
|
|
|
|
List<int> _counts = [];
|
|
|
|
@override
|
|
|
|
@override
|
|
|
@ -52,16 +53,18 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
|
|
|
|
path: API.manager.articleBorrow,
|
|
|
|
path: API.manager.articleBorrow,
|
|
|
|
controller: _easyRefreshController,
|
|
|
|
controller: _easyRefreshController,
|
|
|
|
convert: (models) {
|
|
|
|
convert: (models) {
|
|
|
|
_counts.addAll(List.filled(models.tableList.length, 0));
|
|
|
|
|
|
|
|
return models.tableList
|
|
|
|
return models.tableList
|
|
|
|
.map((e) => ArticleBorrowModel.fromJson(e))
|
|
|
|
.map((e) => ArticleBorrowModel.fromJson(e))
|
|
|
|
.toList();
|
|
|
|
.toList();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
builder: (items) {
|
|
|
|
builder: (items) {
|
|
|
|
|
|
|
|
if (_counts.isEmpty) {
|
|
|
|
|
|
|
|
_counts = List.filled(items.length, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
return ListView.separated(
|
|
|
|
return ListView.separated(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w),
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return _goodsCard(items[index], _counts[index]);
|
|
|
|
return _goodsCard(items[index], index);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
separatorBuilder: (_, __) {
|
|
|
|
separatorBuilder: (_, __) {
|
|
|
|
return 16.w.heightBox;
|
|
|
|
return 16.w.heightBox;
|
|
|
@ -71,7 +74,11 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
|
|
|
|
bottomNavi: Row(
|
|
|
|
bottomNavi: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
'已选择 '.richText.color(ktextPrimary).size(24.sp).withTextSpanChildren([
|
|
|
|
'已选择 '.richText.color(ktextPrimary).size(24.sp).withTextSpanChildren([
|
|
|
|
'0'.textSpan.size(32.sp).color(ktextPrimary).make(),
|
|
|
|
'${_submitIds.length}'
|
|
|
|
|
|
|
|
.textSpan
|
|
|
|
|
|
|
|
.size(32.sp)
|
|
|
|
|
|
|
|
.color(ktextPrimary)
|
|
|
|
|
|
|
|
.make(),
|
|
|
|
' 项'.textSpan.size(24.sp).color(ktextPrimary).make(),
|
|
|
|
' 项'.textSpan.size(24.sp).color(ktextPrimary).make(),
|
|
|
|
]).make(),
|
|
|
|
]).make(),
|
|
|
|
Spacer(),
|
|
|
|
Spacer(),
|
|
|
@ -144,7 +151,7 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
|
|
|
|
_counts[index] == 0
|
|
|
|
_counts[index] == 0
|
|
|
|
? SizedBox()
|
|
|
|
? SizedBox()
|
|
|
|
: Column(
|
|
|
|
: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
@ -173,15 +180,17 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
|
|
|
|
.withRounded(value: 6.w)
|
|
|
|
.withRounded(value: 6.w)
|
|
|
|
.make()
|
|
|
|
.make()
|
|
|
|
.onInkTap(() async {
|
|
|
|
.onInkTap(() async {
|
|
|
|
List<int> ids;
|
|
|
|
_receiveIds.forEach((element) {
|
|
|
|
|
|
|
|
_submitIds.remove(element);
|
|
|
|
|
|
|
|
});
|
|
|
|
await Get.to(() => BorrowGoodsDetailPage(
|
|
|
|
await Get.to(() => BorrowGoodsDetailPage(
|
|
|
|
articleId: model.id,
|
|
|
|
articleId: model.id,
|
|
|
|
)).then((value) {
|
|
|
|
)).then((value) {
|
|
|
|
ids = value;
|
|
|
|
_receiveIds = value;
|
|
|
|
_counts[index] = ids.length;
|
|
|
|
|
|
|
|
_submitIds.addAll(ids);
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
_counts[index] = _receiveIds.length;
|
|
|
|
|
|
|
|
_submitIds.addAll(_receiveIds);
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|