listview_infinite_pagination 0.0.1 copy "listview_infinite_pagination: ^0.0.1" to clipboard
listview_infinite_pagination: ^0.0.1 copied to clipboard

A very lite Flutter Package infinite scroll listview with pagination

Infinite Pagination ListView Scrollable #

A very lite Flutter Package infinite scroll listview with pagination.

Platforms #

This plugin has been successfully tested on iOS, Android & web.

Examples #

The following examples are extracted from the example project available in the repository. More examples are available in this project.

Demo of Dropdown Searchable list with choices #

listview_infinite_pagination

Features #

  • Infinite scroll listview.
  • Automating Pagination
  • Customizable listview item
  • Customizable listview item separator

Getting started and Usage #

We need to two steps to use this package.

  1. first step is to create a function to fetch data to use dataFetcher function.
  2. second step is to implement and design the listview to use itemBuilder function.

         
          // ################ First Example Model ################
          // ####### Posts List
          ListviewInfinitePagination<Post>(
            itemBuilder: (index, item) {
              return Container(
                color: Colors.yellow,
                height: 48,
                child: Text('$index => ${item}'),
              );
            },
            dataFetcher: (page) => dataFetchApi(page),
          ),
          
          // ####### Data Sample Api
          Future<List<Post>> dataFetchApi(int page) async {
              const String _baseUrl = 'https://jsonplaceholder.typicode.com/posts';
              List<Post> testList = [];
            
              try {
                final res = await http.get(Uri.parse("$_baseUrl?_page=$page&_limit=10"));
                json.decode(res.body).forEach((post) {
                  testList.add(Post.fromJson(post));
                });
              } catch (err) {
                if (kDebugMode) {
                  print('Something went wrong');
                }
              }
              return testList;
          }
          

          // ################ Second Example Model ################
          // ####### String List
          ListviewInfinitePagination<Post>(
            itemBuilder: (index, item) {
              return Container(
                color: Colors.yellow,
                height: 48,
                child: Text('$index => ${item.title}'),
              );
            },
            dataFetcher: (page) => dataFetchMocha(page),
          ),
          
          // ####### Data Sample Mocha
          Future<List<String>> dataFetchMocha(int page) async {
              List<String> testList = [];
              if (page < 4) {
                for (int i = 1 + (page - 1) * 20; i <= page * 20; i++) {
                  testList.add('Item$i of page$page');
                }
              }
              return testList;
          }

Additional information #

LICENSE! #

Dropdown Searchable list is MIT-licensed.

Let us know! #

I would be happy if you send us feedback on your projects where you use our component. Just email amir.email@gmail.com and let me know if you have any questions or suggestions about my work.

5
likes
0
pub points
61%
popularity

Publisher

verified publisheramirhome.com

A very lite Flutter Package infinite scroll listview with pagination

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on listview_infinite_pagination