其他分享
首页 > 其他分享> > flutter 去除listview上下留白

flutter 去除listview上下留白

作者:互联网

在listview外层加入MediaQuery.removePadding,以及需要去除的位置

MediaQuery.removePadding(
  context: context,
  removeTop: true,
  removeBottom: true,
  child: ListView.builder(
    itemBuilder: (context, index) => Container(
      color: Colors.blue,
      padding: EdgeInsets.symmetric(vertical: 5.0),
      alignment: Alignment.topCenter,
      child: Text('data'),
    ),
    itemCount: 10,
    shrinkWrap: true,
    physics: NeverScrollableScrollPhysics(),
  ),
);

标签:removePadding,留白,context,child,MediaQuery,listview,true,flutter
来源: https://blog.csdn.net/qq_42772570/article/details/111408502