i´m trying to make a horizontal scrollable widget. it must be infinit (or kind of), so I´ve done this.
Widget build(BuildContext context) {
final int initialPage = 1000;
return Container(
margin: const EdgeInsets.all(10.0),
height: 400,
child: PageView.builder(
controller: PageController(
keepPage: true,
initialPage: initialPage,
),
itemBuilder: (context, position) {
print(position);
return Container(child:Text(position),
);
},
itemCount: null,
),
);
}
Then i scroll right 3 times and the console shows this:
I/flutter (12616): 1000
I/flutter (12616): 1001
I/flutter (12616): 1002
I/flutter (12616): 1003
but then when i go backwards, i have to scroll 4 times to see some results, but in the middle it doesn´t show anything.
I/flutter (12616): 1000
I/flutter (12616): 1001
I/flutter (12616): 1002
I/flutter (12616): 1003
I/flutter (12616): 999
I/flutter (12616): 1004
I/flutter (12616): 1005
That was 3 times right, 4 times left and 6 to the right again. Why itemBuilder function doesn´t run sometimes?