Putting a PageView
inside a ListView
is possible, but since ListView
is providing unlimited height (since you can put as many widgets inside it as you like and it will make everything scroll practically) your PageView
does not know how to handle this. The PageView
needs to know how big it can get so it can layout its own children.
When using PageView
, I would recommend you to make use of MediaQuery.of(context).size
to get the screen width and height. You can set the size of your PageView
based on that information. For example you could do:
SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: PageView(
...
),
)
Use this inside your ListView
and you should be good to go!