📜  颤振在列表视图构建器末尾添加静态小部件 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:20.689000             🧑  作者: Mango

代码示例1
Widget UsersList = new StreamBuilder(
  stream: Firestore.instance.collection('users').snapshots(),
  builder: (context, snapshot) {
    return new ListView.builder(
      itemCount: (snapshot?.data?.documents?.length ?? 0) + 1,
      itemBuilder: (context, index) {
        if (index == 0)
          return FlatButton(child: Text("Add"));
        else
          _buildItem(context, snapshot.data.documents[index-1]);
      },
    );
  },
),