firebase - 如何在颤动中从云 Firestore 中获取数据的列表的特定索引处进行更改?
问题描述
在我的颤振应用程序中,我从 Firestore 的列表中获取了我的数据,现在想要一个 ADD 或 REMOVE 选项来增加或减少列表中该特定项目的单位数量,但经过几次尝试后无法做到这一点作为计数整个列表上的更新不是该索引中的特定元素。任何人都可以帮助我吗
CustomScrollView(
physics: BouncingScrollPhysics(),
slivers: <Widget>[
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: <Widget>[
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: <Widget>[
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',),),
SizedBox(
width: 7.0,
),
FloatingActionButton(
onPressed: (){
minus();
},
mini: true,
child: Icon(Icons.remove, color: Colors.black,),
backgroundColor: Colors.white,)
],
),
)
],
)
);
},
childCount: snapshot.data.documents.length))],
)
解决方案
推荐阅读
- python - OpenAI Gym 自定义环境:具有真实值的离散观察空间
- powerbi - 在 UserPrincipalName 的辅助字段上使用 RLS
- javascript - 如何在 JXA 中启动异步后台进程
- php - 使用 mysql 生成当前、30、60、90 天的老化报告
- amazon-web-services - AWS Step函数:如何在状态机中传递静态键值对(不使用类型:传递)?
- hash - 加密图像的深度学习
- scala - 在Scala中动态选择类型类
- java - OnActivityResult 在片段内不起作用。我怎样才能在我的代码上解决这个问题?
- c# - 带有实体框架的 SQLite DATETIME(在 Julian/Real/Double 中)列
- python - 如何从 git worktree 命令生成多个文件夹?