ListView.builder中的FutureBuilder无法正常工作

时间:2020-02-12 12:49:41

标签: flutter dart

想要在ListView.builder中使用FutureBuilder显示项目。但是,没有显示。帮助

body: ListView.builder(
    itemExtent: 25.0,
    itemCount: _posts.length,
    itemBuilder: (BuildContext context, int index){
      Post post = _posts[index];
      return FutureBuilder(
        future: DatabaseService.getUserWithId(post.authorId),
        builder: (BuildContext context, AsyncSnapshot snapshot) {
          return Container(
            height: 200.0,
            margin: EdgeInsets.all(10.0),
            color: Colors.red,
          );
        },
      );
    },
  ),

0 个答案:

没有答案