Issue
I'm trying to make a screen that's scrollable (like the whole screen scrollable).
This is what I got know:
Column(
children: <Widget>[
Expanded(
child: ListView(
scrollDirection: Axis.horizontal, children: posts2b)),
Expanded(child: ListView(children: posts2a)),
],
);
It all works, but I want those listviews scrollable as one. So if you scroll down, the horizontal listview 'disappears'.
Is that possible?
Thank you!
Solution
Something like this?
SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(
height: 200,
child: ListView(
scrollDirection: Axis.horizontal,
children: posts2b,
),
),
Flexible(
child: ListView(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
children: posts2a,
),
),
],
),
)
Wrap Column
with SingleChildScrollView
, set height for horizontal list and disable scrolling for vertical list by adding physics: NeverScrollableScrollPhysics()
...
Answered By - janstol
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.