【问题标题】:How to fill the Screen with ListView/GridView?如何用 ListView/GridView 填充屏幕?
【发布时间】:2021-03-25 10:11:58
【问题描述】:

enter image description here

如何填满屏幕?

【问题讨论】:

  • 请复制粘贴您的代码,而不是截图!得到一个被接受的答案更合适。
  • body: Container( color: Colors.black, child: ListView(scrollDirection: Axis.vertical, children: [ SizedBox(height: 5.0), Container( padding: E​​dgeInsets.all(5.0 ),宽度:MediaQuery.of(context).size.width - 15.0,高度:MediaQuery.of(context).size.width - 15.0,孩子:GridView.count(crossAxisCount:2,主要:false,crossAxisSpacing:10, mainAxisSpacing:10,孩子: [

标签: flutter listview gridview


【解决方案1】:

您可以使用 Expanded 而不是 Container 小部件来用 ListView 填充屏幕

【讨论】:

  • 我不明白要放那个吗?
  • 您需要使用 Expanded 小部件 Expanded(child:ListView...) 包装您的列表视图
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-03-31
  • 2011-10-27
  • 1970-01-01
  • 1970-01-01
  • 2012-12-16
  • 1970-01-01
相关资源
最近更新 更多