add 批量删除

hmxc
张萌 4 years ago
parent 7920bc36fc
commit 0b78e30878

@ -127,6 +127,9 @@ class _Manager {
/// ///
String get getQRcode => '/user/articleOut/getQRCode'; String get getQRcode => '/user/articleOut/getQRCode';
///app
String get articleOutDelete => '/user/articleOut/falseDelete';
} }
class _Community { class _Community {

@ -1,4 +1,7 @@
// Flutter imports: // 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/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -25,10 +28,51 @@ class GoodsDetoPage extends StatefulWidget {
class _GoodsDetoPageState extends State<GoodsDetoPage> { class _GoodsDetoPageState extends State<GoodsDetoPage> {
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
List<int> _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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '物品出户', title: '物品出户',
actions: [
IconButton(
icon: _isEdit
? '完成'.text.black.size(28.sp).make()
: '编辑'.text.black.size(28.sp).make(),
onPressed: () {
_isEdit = !_isEdit;
setState(() {});
})
],
body: Padding( body: Padding(
padding: EdgeInsets.only(bottom: 98.w), padding: EdgeInsets.only(bottom: 98.w),
child: BeeListView( child: BeeListView(
@ -42,23 +86,49 @@ class _GoodsDetoPageState extends State<GoodsDetoPage> {
builder: (items) { builder: (items) {
return ListView.builder( return ListView.builder(
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GoodsInfoCard( return Stack(children: [
model: items[index], 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, itemCount: items.length,
); );
}, },
), ),
), ),
bottomNavi: MaterialButton( bottomNavi: BottomButton(
color: kPrimaryColor, onPressed: _isEdit
? _select.isEmpty
padding: EdgeInsets.only(top:26.w ,bottom: MediaQuery.of(context).padding.bottom+26.w), ? null
child: '新增'.text.black.size(32.sp).bold.make(), : () async {
onPressed: () { await ManagerFunc.articleOutDelete(_select);
_select.clear();
_refreshController.callRefresh();
}
: () {
DetoCreatePage().to(); DetoCreatePage().to();
},), },
child: _isEdit
? '删除'.text.size(32.sp).bold.make()
: '新增'.text.size(32.sp).bold.make(),
),
); );
} }
} }

@ -19,7 +19,7 @@ class GoodsInfoCard extends StatelessWidget {
Widget _builTile(String title, String text) { Widget _builTile(String title, String text) {
return Container( return Container(
padding: EdgeInsets.only(top: 8.w), // padding: EdgeInsets.only(top: 8.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [

@ -81,6 +81,7 @@ class GoodsInfoCardButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white.withOpacity(0.6), color: Colors.white.withOpacity(0.6),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(

@ -138,4 +138,13 @@ class ManagerFunc {
); );
return ArticleQRModel.fromJson(response.data); return ArticleQRModel.fromJson(response.data);
} }
static Future<BaseModel> articleOutDelete(List<int> ids) async {
BaseModel baseModel = await NetUtil().post(
API.manager.articleOutDelete,
params: {'ids': ids},
showMessage: true,
);
return baseModel;
}
} }

@ -84,7 +84,7 @@ class _FixedSubmitPageState extends State<FixedSubmitPage> {
Widget _buildCard(FixedSubmitModel model) { Widget _buildCard(FixedSubmitModel model) {
return AnimatedPositioned( return AnimatedPositioned(
top: 0, top: 0,
left: (_canSkew(4) && _isEdit) ? 55.w : 0, left: (_canSkew(model.status) && _isEdit) ? 55.w : 0,
bottom: 0, bottom: 0,
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,

@ -26,7 +26,8 @@ class _FixedCheckBoxState extends State<FixedCheckBox> {
}); });
widget.onChanged(_isSelected); widget.onChanged(_isSelected);
}, },
child: Container( child: AnimatedContainer(
duration: Duration(milliseconds: 300),
alignment: Alignment.center, alignment: Alignment.center,
width: 40.w, width: 40.w,
height: 40.w, height: 40.w,
@ -36,7 +37,8 @@ class _FixedCheckBoxState extends State<FixedCheckBox> {
width: 3.w, color: _isSelected ? kPrimaryColor : kDarkSubColor), width: 3.w, color: _isSelected ? kPrimaryColor : kDarkSubColor),
color: Colors.transparent, color: Colors.transparent,
), ),
child: Container( child: AnimatedContainer(
duration: Duration(milliseconds: 300),
width: 24.w, width: 24.w,
height: 24.w, height: 24.w,
decoration: BoxDecoration( decoration: BoxDecoration(

@ -24,14 +24,10 @@ class BottomButton extends StatelessWidget {
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom), padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: MaterialButton( child: MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
child: DefaultTextStyle( disabledColor: Colors.white.withOpacity(0.5),
disabledTextColor: ktextSubColor.withOpacity(0.8),
textColor: ktextPrimary,
child: child, child: child,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 32.sp,
),
),
onPressed: onPressed, onPressed: onPressed,
color: kPrimaryColor, color: kPrimaryColor,
height: 98.w, height: 98.w,

Loading…
Cancel
Save