MediaQuery.removePadding(
removeTop:true,//移除头部padding,使listview沉浸
context:context,
child:NotificationListener(//监听且只监听ListView的滚动
onNotification:(scrollNotification)=>{
if(scrollNotification is ScrollUpdateNotification && scrollNotification.depth == 0){
_onScroll(scrollNotification.metrics.pixels);
}
},
child:ListView()
)
)
flutter中listview移除padding
于 2023-05-06 17:00:51 首次发布