|
|
@ -1,9 +1,13 @@
|
|
|
|
// Flutter imports:
|
|
|
|
// Flutter imports:
|
|
|
|
|
|
|
|
import 'package:aku_community_manager/const/api.dart';
|
|
|
|
|
|
|
|
import 'package:aku_community_manager/models/manager/borrow/borrow_detail_item_model.dart';
|
|
|
|
|
|
|
|
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
|
|
// Package imports:
|
|
|
|
// Package imports:
|
|
|
|
import 'package:aku_ui/common_widgets/aku_material_button.dart';
|
|
|
|
import 'package:aku_ui/common_widgets/aku_material_button.dart';
|
|
|
|
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -18,14 +22,15 @@ import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_item_de
|
|
|
|
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
|
|
|
|
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class BorrowItemPage extends StatefulWidget {
|
|
|
|
class BorrowItemPage extends StatefulWidget {
|
|
|
|
final BorrowObject object;
|
|
|
|
final int id;
|
|
|
|
BorrowItemPage({Key key, @required this.object}) : super(key: key);
|
|
|
|
BorrowItemPage({Key key, @required this.id}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_BorrowItemPageState createState() => _BorrowItemPageState();
|
|
|
|
_BorrowItemPageState createState() => _BorrowItemPageState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _BorrowItemPageState extends State<BorrowItemPage> {
|
|
|
|
class _BorrowItemPageState extends State<BorrowItemPage> {
|
|
|
|
|
|
|
|
EasyRefreshController _refreshController = EasyRefreshController();
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final userProvider = Provider.of<UserProvider>(context);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context);
|
|
|
@ -36,7 +41,7 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
|
|
|
|
? AkuMaterialButton(
|
|
|
|
? AkuMaterialButton(
|
|
|
|
minWidth: 120.w,
|
|
|
|
minWidth: 120.w,
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
Get.to(AddBorrowItemPage(object: widget.object));
|
|
|
|
// Get.to(AddBorrowItemPage(object: widget.object));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
'新增',
|
|
|
|
'新增',
|
|
|
@ -48,21 +53,31 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
: SizedBox(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
body: ListView.builder(
|
|
|
|
body: BeeListView(
|
|
|
|
|
|
|
|
path: API.manage.borrowDetailList,
|
|
|
|
|
|
|
|
controller: _refreshController,
|
|
|
|
|
|
|
|
extraParams: {'articleId': widget.id},
|
|
|
|
|
|
|
|
convert: (model) => model.tableList
|
|
|
|
|
|
|
|
.map((e) => BorrowDetailItemModel.fromJson(e))
|
|
|
|
|
|
|
|
.toList(),
|
|
|
|
|
|
|
|
builder: (items) {
|
|
|
|
|
|
|
|
return ListView.builder(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 32.w),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return _buildCard(widget.object.items[index]);
|
|
|
|
return _buildCard(items[index]);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
itemCount: items.length,
|
|
|
|
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
itemCount: widget.object.items.length,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_buildCard(SingleBorrowGoods item) {
|
|
|
|
_buildCard(BorrowDetailItemModel item) {
|
|
|
|
final userProvider = Provider.of<UserProvider>(context);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context);
|
|
|
|
return GestureDetector(
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
Get.to(BorrowItemDetailPage(item: item));
|
|
|
|
// Get.to(BorrowItemDetailPage(item: item));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(top: 16.w),
|
|
|
|
margin: EdgeInsets.only(top: 16.w),
|
|
|
@ -101,7 +116,7 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
|
|
|
|
CupertinoDialogAction(
|
|
|
|
CupertinoDialogAction(
|
|
|
|
child: Text('删除'),
|
|
|
|
child: Text('删除'),
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
widget.object.items.remove(item);
|
|
|
|
//TODO delete
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
Get.back();
|
|
|
|
Get.back();
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -141,18 +156,11 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
|
|
|
|
AkuBox.w(24),
|
|
|
|
AkuBox.w(24),
|
|
|
|
ClipRRect(
|
|
|
|
ClipRRect(
|
|
|
|
borderRadius: BorderRadius.circular(4.w),
|
|
|
|
borderRadius: BorderRadius.circular(4.w),
|
|
|
|
child: (item.assetpath is String)
|
|
|
|
child: FadeInImage.assetNetwork(
|
|
|
|
? Image.asset(
|
|
|
|
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
|
|
|
|
item.assetpath,
|
|
|
|
image: API.image(item.firstImg?.url ?? ''),
|
|
|
|
height: 184.w,
|
|
|
|
|
|
|
|
width: 184.w,
|
|
|
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
: Image.file(
|
|
|
|
|
|
|
|
item.assetpath,
|
|
|
|
|
|
|
|
height: 184.w,
|
|
|
|
height: 184.w,
|
|
|
|
width: 184.w,
|
|
|
|
width: 184.w,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
AkuBox.w(24),
|
|
|
|
AkuBox.w(24),
|
|
|
|