diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 4c9e6e2e..86d9534b 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -127,6 +127,9 @@ class _Manager { ///物品出户:查询二维码信息 String get getQRcode => '/user/articleOut/getQRCode'; + + ///物品出户:app批量删除物品出户信息 + String get articleOutDelete => '/user/articleOut/falseDelete'; } class _Community { diff --git a/lib/pages/goods_deto_page/goods_deto_page.dart b/lib/pages/goods_deto_page/goods_deto_page.dart index fee118b8..f3cd34bc 100644 --- a/lib/pages/goods_deto_page/goods_deto_page.dart +++ b/lib/pages/goods_deto_page/goods_deto_page.dart @@ -1,4 +1,7 @@ // Flutter imports: +import 'package:akuCommunity/pages/manager_func.dart'; +import 'package:akuCommunity/widget/buttons/bottom_button.dart'; +import 'package:akuCommunity/widget/buttons/radio_button.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -25,10 +28,51 @@ class GoodsDetoPage extends StatefulWidget { class _GoodsDetoPageState extends State { EasyRefreshController _refreshController = EasyRefreshController(); + List _select = []; + bool _isEdit = false; + bool _canSkew(int state) { + switch (state) { + case 1: + case 2: + case 3: + return false; + case 4: + case 5: + case 6: + case 7: + return true; + default: + return true; + } + } + + Widget _buildPositioned(GoodsOutModel model) { + return AnimatedPositioned( + bottom: 0, + top: 0, + left: (_canSkew(4) && _isEdit) ? 80.w : 0.w, + duration: Duration(milliseconds: 300), + width: 750.w, + child: GoodsInfoCard( + model: model, + ), + ); + } + @override Widget build(BuildContext context) { return BeeScaffold( title: '物品出户', + actions: [ + IconButton( + icon: _isEdit + ? '完成'.text.black.size(28.sp).make() + : '编辑'.text.black.size(28.sp).make(), + onPressed: () { + _isEdit = !_isEdit; + setState(() {}); + }) + ], body: Padding( padding: EdgeInsets.only(bottom: 98.w), child: BeeListView( @@ -42,23 +86,49 @@ class _GoodsDetoPageState extends State { builder: (items) { return ListView.builder( itemBuilder: (context, index) { - return GoodsInfoCard( - model: items[index], - ); + return Stack(children: [ + GestureDetector( + onTap: () { + if (_select.contains(items[index].id)) { + _select.remove(items[index].id); + } else + _select.add(items[index].id); + setState(() {}); + }, + child: Container( + padding: EdgeInsets.symmetric( + vertical: 50.w, horizontal: 32.w), + alignment: Alignment.topLeft, + constraints: BoxConstraints( + minHeight: 631.w + 96.w, minWidth: 686.w), + child: BeeRadio( + value: items[index].id, groupValues: _select), + ), + ), + _buildPositioned(items[index]), + ]); }, itemCount: items.length, ); }, ), ), - bottomNavi: MaterialButton( - color: kPrimaryColor, - - padding: EdgeInsets.only(top:26.w ,bottom: MediaQuery.of(context).padding.bottom+26.w), - child: '新增'.text.black.size(32.sp).bold.make(), - onPressed: () { - DetoCreatePage().to(); - },), + bottomNavi: BottomButton( + onPressed: _isEdit + ? _select.isEmpty + ? null + : () async { + await ManagerFunc.articleOutDelete(_select); + _select.clear(); + _refreshController.callRefresh(); + } + : () { + DetoCreatePage().to(); + }, + child: _isEdit + ? '删除'.text.size(32.sp).bold.make() + : '新增'.text.size(32.sp).bold.make(), + ), ); } } diff --git a/lib/pages/goods_deto_page/widget/goods_info_card.dart b/lib/pages/goods_deto_page/widget/goods_info_card.dart index 6c19d315..f7988b0a 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card.dart @@ -19,7 +19,7 @@ class GoodsInfoCard extends StatelessWidget { Widget _builTile(String title, String text) { return Container( - padding: EdgeInsets.only(top: 8.w), + // padding: EdgeInsets.only(top: 8.w), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/pages/goods_deto_page/widget/goods_info_card_button.dart b/lib/pages/goods_deto_page/widget/goods_info_card_button.dart index f7ea5812..0336b508 100644 --- a/lib/pages/goods_deto_page/widget/goods_info_card_button.dart +++ b/lib/pages/goods_deto_page/widget/goods_info_card_button.dart @@ -81,6 +81,7 @@ class GoodsInfoCardButton extends StatelessWidget { @override Widget build(BuildContext context) { return Container( + alignment: Alignment.center, decoration: BoxDecoration( color: Colors.white.withOpacity(0.6), borderRadius: BorderRadius.only( diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 6c42d929..9c418fe9 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -138,4 +138,13 @@ class ManagerFunc { ); return ArticleQRModel.fromJson(response.data); } + + static Future articleOutDelete(List ids) async { + BaseModel baseModel = await NetUtil().post( + API.manager.articleOutDelete, + params: {'ids': ids}, + showMessage: true, + ); + return baseModel; + } } diff --git a/lib/pages/things_page/fixed_submit_page.dart b/lib/pages/things_page/fixed_submit_page.dart index fbfbe816..064a5fa0 100644 --- a/lib/pages/things_page/fixed_submit_page.dart +++ b/lib/pages/things_page/fixed_submit_page.dart @@ -84,7 +84,7 @@ class _FixedSubmitPageState extends State { Widget _buildCard(FixedSubmitModel model) { return AnimatedPositioned( top: 0, - left: (_canSkew(4) && _isEdit) ? 55.w : 0, + left: (_canSkew(model.status) && _isEdit) ? 55.w : 0, bottom: 0, duration: Duration(milliseconds: 300), curve: Curves.easeInOutCubic, diff --git a/lib/pages/things_page/widget/fixed_check_box.dart b/lib/pages/things_page/widget/fixed_check_box.dart index dd9d875a..3972a270 100644 --- a/lib/pages/things_page/widget/fixed_check_box.dart +++ b/lib/pages/things_page/widget/fixed_check_box.dart @@ -26,7 +26,8 @@ class _FixedCheckBoxState extends State { }); widget.onChanged(_isSelected); }, - child: Container( + child: AnimatedContainer( + duration: Duration(milliseconds: 300), alignment: Alignment.center, width: 40.w, height: 40.w, @@ -36,7 +37,8 @@ class _FixedCheckBoxState extends State { width: 3.w, color: _isSelected ? kPrimaryColor : kDarkSubColor), color: Colors.transparent, ), - child: Container( + child: AnimatedContainer( + duration: Duration(milliseconds: 300), width: 24.w, height: 24.w, decoration: BoxDecoration( diff --git a/lib/widget/buttons/bottom_button.dart b/lib/widget/buttons/bottom_button.dart index 8f8cf1a3..a7940ad2 100644 --- a/lib/widget/buttons/bottom_button.dart +++ b/lib/widget/buttons/bottom_button.dart @@ -24,14 +24,10 @@ class BottomButton extends StatelessWidget { padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom), child: MaterialButton( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - child: DefaultTextStyle( - child: child, - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold, - fontSize: 32.sp, - ), - ), + disabledColor: Colors.white.withOpacity(0.5), + disabledTextColor: ktextSubColor.withOpacity(0.8), + textColor: ktextPrimary, + child: child, onPressed: onPressed, color: kPrimaryColor, height: 98.w,