作者:大伙没事偷着乐吧 | 来源:互联网 | 2023-05-26 11:02
在flutter应用程序中,我从Firestore的列表中提取了数据,现在想使用ADD或REMOVE选项来增加或减少列表中该特定项目的单位数量,但是经过几次尝试后却无法做到这一点因为整个列表中的计数会更新,而不是该索引中的特定元素。有人可以帮我吗
CustomScrollView(
physics: BouncingScrollPhysics(),slivers: [
SliverList(
delegate: SliverChildBuilderDelegate((context,index){
return Container(
margin: EdgeInsets.only(top: 15.0,left: 15.0,right: 15.0),child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [
Container(
child: Text(snapshot.data.documents[index].documentID,style: TextStyle(fontFamily: "DelishN",fontSize: 15.0),),Container(
decoration: BoxDecoration(
border: Border.all(
width: 2.0,color: Colors.black
),borderRadius: BorderRadius.circular(23.0)
),child: Row(
children: [
FloatingactionButton(
onpressed: (){
add();
},mini: true,child: Icon(Icons.add,color: Colors.black,backgroundColor: Colors.white,SizedBox(
width: 7.0,Text(_n.toString(),style: TextStyle(fontFamily: 'DelishN',FloatingactionButton(
onpressed: (){
minus();
},child: Icon(Icons.remove,)
],)
],)
);
},childCount: snapshot.data.documents.length))],)