lulu
lulu

Reputation: 19

How to scroll in Flutter Listview child by child, so image by image, without having two half images shown?

I wanna make a Listview where every items has the 'width' of the screen size, scrolling horizontally between them.

child: ListView(
        scrollDirection: Axis.horizontal,
        children: [
          Container(
            child: Image.asset("assets/images/tests/asset0.PNG"),
            width: MediaQuery.of(context).size.width,
          ),
          Container(
            child: Image.asset("assets/images/tests/asset1.PNG"),
            width: MediaQuery.of(context).size.width,
          ),
        ],
      ),

But (like if you swipe between many pictures horizontally on instagram) i want the children to be full on page (not half half or something if you start scrolling between them).

Any ideas?

Upvotes: 1

Views: 109

Answers (1)

Islomkhuja Akhrarov
Islomkhuja Akhrarov

Reputation: 1400

Use PageView.builder instead ListView

Upvotes: 1

Related Questions