Home > Back-end >  Redundant space in page problem in Flutter
Redundant space in page problem in Flutter

Time:09-24

I want to let my ListView start after the blue part of my page. But there is an blank and redundant space that doesn't allow me to start at expected point.

the blank space that i get

Here is my code:

Column(children:[Stack(some other code),Expanded(child:ListView(..))]);

CodePudding user response:

The space is there because you have wrapped Stack(some other code) inside Column. This is what you should do if you want the ListView to be over some other code, ​

Stack(
 ​children:[
   //some other code,
   Column(
     ​children:[
       ​Expanded(
         child : ListView(...)
       ),
...

CodePudding user response:

According to documentation:

By default, ListView will automatically pad the list's scrollable extremities to avoid partial obstructions indicated by MediaQuery's padding. To avoid this behavior, override with a zero padding property.

To remove it wrap the ListView into a MediaQuery.removePadding:

MediaQuery.removePadding(
    context: context,
    removeTop: true,
    child: ListView(...))
  • Related