【问题标题】:Not able to scroll in ListView flutter web无法在 ListView 中滚动 flutter web
【发布时间】:2021-12-15 07:44:51
【问题描述】:

我正在尝试通过从 firebase 获取图像来进行轮播视图。我能够在 listView 中获取图像并能够成功地将它们放入卡片中,但不幸的是我无法滚动列表视图。

return Container(
          width: double.infinity,
          height: 300,
          child: ListView(
            scrollDirection: Axis.horizontal,
            children: snapshot.data!.docs.map((DocumentSnapshot document) {
              Map<String, dynamic> data = document.data()! as Map<String, dynamic>;
              return Padding(
                padding: const EdgeInsets.all(8.0),
                child: Center(
                  child: Stack(
                    children: [
                      SizedBox(
                        height: 200,
                        child: Card(
                          elevation: 10,
                          child: ClipRRect(
                              borderRadius: BorderRadius.circular(4),
                              child: Image.network(data['image'],width: 400,fit: BoxFit.fill,)),
                        ),
                      ),
                    ],
                  ),
                ),
              );
            }).toList(),
          ),
        );

有什么帮助吗?

【问题讨论】:

标签: flutter flutter-web


【解决方案1】:

Container > SingleChildScoolView > ListView 尝试

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 2020-11-19
  • 2023-03-26
  • 1970-01-01
  • 2019-02-15
  • 2021-11-12
  • 2022-11-15
  • 2022-01-06
  • 1970-01-01
相关资源
最近更新 更多