There are lots of apps that contains feature lists. Sometimes app needs to build lists of settings, lists of todo items, lists of Images, lists of posts etc. While fetchin these data somw time the data could scroll endlessly. Examples like a Twitter timeline, a Facebook feed or a list of posts on Reddit etc...
How to build this infinite scrolling list in flutter. In this post we will create infinite scroll pagination data with flutter.
To implement this pagination we will use pagination plugin
PageNation Widget is here
PaginationList<User>(
shrinkWrap: true,
padding: EdgeInsets.only(
left: 5,
right: 5,
),
separatorWidget: Container(
height: 0.5,
color: Colors.black,
),
itemBuilder: (BuildContext context, User user) {
return ListTile(
title:
Text(user.prefix + " " + user.firstName + " " + user.lastName),
subtitle: Text(user.designation),
leading: IconButton(
icon: Icon(Icons.person_outline),
onPressed: () => null,
),
onTap: () => print(user.designation),
trailing: Icon(
Icons.call,
color: Colors.green,
),
);
},
pageFetch: pageFetch,
onError: (dynamic error) => Center(
child: Text('Something Went Wrong'),
),
initialData: <User>[
User(
faker.person.prefix(),
faker.person.firstName(),
faker.person.lastName(),
faker.company.position(),
),
User(
faker.person.prefix(),
faker.person.firstName(),
faker.person.lastName(),
faker.company.position(),
),
],
onEmpty: Center(
child: Text('Empty List'),
),
),
);
Find more at Flutter Infinte Scroll Pagination data
Conclusion
That's the Load data on Infinite scroll Listview and Flutter Pagination Example..
I hope you found this Example useful 🤓
Comments (0)