{"id":28589712,"url":"https://github.com/codingfries/auto_paginated_view","last_synced_at":"2025-06-11T08:11:23.321Z","repository":{"id":297106392,"uuid":"995700071","full_name":"CodingFries/auto_paginated_view","owner":"CodingFries","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-03T22:24:59.000Z","size":41195,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-04T05:58:09.730Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodingFries.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-03T22:09:26.000Z","updated_at":"2025-06-03T22:25:01.000Z","dependencies_parsed_at":"2025-06-08T04:03:07.343Z","dependency_job_id":null,"html_url":"https://github.com/CodingFries/auto_paginated_view","commit_stats":null,"previous_names":["codingfries/auto_paginated_view"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Fauto_paginated_view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Fauto_paginated_view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Fauto_paginated_view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Fauto_paginated_view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodingFries","download_url":"https://codeload.github.com/CodingFries/auto_paginated_view/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingFries%2Fauto_paginated_view/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259227958,"owners_count":22824904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-11T08:11:14.000Z","updated_at":"2025-06-11T08:11:23.310Z","avatar_url":"https://github.com/CodingFries.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutoPaginatedView\n\nA Flutter widget that simplifies implementing automatic pagination in list-based views. This package helps you create paginated lists with minimal code while handling loading states, errors, and empty states.\n\n[![pub package](https://img.shields.io/pub/v/auto_paginated_view.svg)](https://pub.dev/packages/auto_paginated_view)\n\n## Features\n\n- 📋 **Universal List Support**: Works with ListView, GridView, SliverList, SliverGrid, and custom list implementations\n- 🔄 **Automatic Loading**: Triggers loading of more items when the user reaches the end of the list\n- ⚠️ **Error Handling**: Built-in error handling with customizable error widgets and retry functionality\n- 🔍 **Empty State Handling**: Displays appropriate widgets when the list is empty\n- 🎨 **Customizable**: Allows full customization of loading, error, and empty state widgets\n- 🔧 **Highly Configurable**: Flexible parameters for customizing behavior and appearance\n\n## Examples\n\nHere are some examples of what you can build with AutoPaginatedView:\n\n| ListView | GridView | Pull-to-Refresh |\n|----------|----------|-----------------|\n| ![ListView Example](https://raw.githubusercontent.com/CodingFries/auto_paginated_view/main/gifs/listview.gif) | ![GridView Example](https://raw.githubusercontent.com/CodingFries/auto_paginated_view/main/gifs/gridview.gif) | ![Pull-to-Refresh Example](https://raw.githubusercontent.com/CodingFries/auto_paginated_view/main/gifs/pull_to_refresh.gif) |\n\n| SliverList | SliverGrid |\n|------------|------------|\n| ![SliverList Example](https://raw.githubusercontent.com/CodingFries/auto_paginated_view/main/gifs/sliverlist.gif) | ![SliverGrid Example](https://raw.githubusercontent.com/CodingFries/auto_paginated_view/main/gifs/slivergrid.gif) |\n\n## Getting Started\n\nAdd the package to your `pubspec.yaml`:\n\n```yaml\ndependencies:\n  auto_paginated_view:\n```\n\nThen run:\n\n```\nflutter pub get\n```\n\n### Dependencies\n\nThis package uses [visibility_detector](https://pub.dev/packages/visibility_detector) to determine when to trigger loading more items. This dependency is managed automatically when you add `auto_paginated_view` to your project.\n\n## Usage\n\n### Basic ListView Example\n\n```dart\nimport 'package:auto_paginated_view/auto_paginated_view.dart';\nimport 'package:flutter/material.dart';\n\nAutoPaginatedView(\n  items: myItemsList,\n  hasReachedEnd: !hasMoreItems,\n  onLoadMore: () async {\n    try {\n      await loadMoreItems();\n      return null; // Success\n    } catch (e) {\n      return e.toString(); // Error message\n    }\n  },\n  itemBuilder: (context, index) =\u003e ListTile(\n    title: Text(myItemsList[index].title),\n    subtitle: Text(myItemsList[index].description),\n  ),\n  builder: (context, itemCount, itemBuilder) =\u003e ListView.builder(\n    itemCount: itemCount,\n    itemBuilder: itemBuilder,\n  ),\n)\n```\n\n### GridView Example\n\n```dart\nAutoPaginatedView(\n  items: myImagesList,\n  hasReachedEnd: !hasMoreImages,\n  onLoadMore: () async {\n    try {\n      await fetchMoreImages();\n      return null;\n    } catch (e) {\n      return e.toString();\n    }\n  },\n  itemBuilder: (context, index) =\u003e Image.network(myImagesList[index].url),\n  builder: (context, itemCount, itemBuilder) =\u003e GridView.builder(\n    gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(\n      crossAxisCount: 2,\n      mainAxisSpacing: 8,\n      crossAxisSpacing: 8,\n    ),\n    itemCount: itemCount,\n    itemBuilder: itemBuilder,\n  ),\n)\n```\n\n### SliverList Example\n\n```dart\nCustomScrollView(\n  slivers: [\n    SliverAppBar(\n      title: Text('My Sliver List'),\n      floating: true,\n    ),\n    AutoPaginatedView(\n      items: myItemsList,\n      hasReachedEnd: !hasMoreItems,\n      onLoadMore: () async {\n        try {\n          await loadMoreItems();\n          return null;\n        } catch (e) {\n          return e.toString();\n        }\n      },\n      itemBuilder: (context, index) =\u003e ListTile(\n        title: Text(myItemsList[index].title),\n      ),\n      builder: (context, itemCount, itemBuilder) =\u003e SliverList(\n        delegate: SliverChildBuilderDelegate(\n          itemBuilder,\n          childCount: itemCount,\n        ),\n      ),\n      isInsideSliverView: true,\n    ),\n  ],\n)\n```\n\n### Custom State Builders\n\n```dart\nAutoPaginatedView(\n  items: myItemsList,\n  hasReachedEnd: !hasMoreItems,\n  onLoadMore: loadMoreFunction,\n  itemBuilder: itemBuilderFunction,\n  builder: listBuilderFunction,\n  // Custom loading state\n  loadingStateBuilder: () =\u003e Center(\n    child: Column(\n      children: [\n        CircularProgressIndicator(color: Colors.blue),\n        SizedBox(height: 8),\n        Text('Loading more items...'),\n      ],\n    ),\n  ),\n  // Custom error state\n  errorStateBuilder: (error, retry) =\u003e Center(\n    child: Column(\n      children: [\n        Icon(Icons.error, color: Colors.red, size: 48),\n        Text('Oops! $error'),\n        ElevatedButton(\n          onPressed: retry,\n          child: Text('Try Again'),\n        ),\n      ],\n    ),\n  ),\n  // Custom empty state\n  emptyStateBuilder: () =\u003e Center(\n    child: Column(\n      children: [\n        Icon(Icons.inbox, color: Colors.grey, size: 48),\n        Text('No items available'),\n        ElevatedButton(\n          onPressed: loadMoreFunction,\n          child: Text('Refresh'),\n        ),\n      ],\n    ),\n  ),\n)\n```\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `items` | `List` | Yes | The list of items to display |\n| `hasReachedEnd` | `bool` | Yes | Whether all available items have been loaded |\n| `onLoadMore` | `Future\u003cString?\u003e Function()` | Yes | Callback to load more items. Returns null on success or error message on failure |\n| `itemBuilder` | `Widget Function(BuildContext, int)` | Yes | Builder for individual items in the list |\n| `builder` | `Widget Function(BuildContext, int, Widget Function(BuildContext, int))` | Yes | Builder for the list container (ListView, GridView, etc.) |\n| `loadingStateBuilder` | `Widget Function()?` | No | Custom builder for the loading state widget |\n| `errorStateBuilder` | `Widget Function(String, VoidCallback)?` | No | Custom builder for the error state widget |\n| `emptyStateBuilder` | `Widget Function()?` | No | Custom builder for the empty state widget |\n| `isInsideSliverView` | `bool` | No | Whether the widget is being used inside a sliver view. Default is `false` |\n| `emptyStateHeight` | `double?` | No | Height for the empty state widget. If not provided, the empty state will take its natural height based on its content. |\n| `visibilityThreshold` | `double` | No | Visibility threshold for triggering loading more items. Default is `0` |\n| `autoLoadInitially` | `bool` | No | Whether to automatically load items when the widget is first built. Default is `true` |\n| `autoRefreshOnEmptyList` | `bool` | No | Whether to automatically refresh when the list becomes empty. Default is `true` |\n\n## Advanced Usage\n\nSee the `/example` folder for complete sample applications demonstrating different use cases and configurations.\n\n## Contributing\n\nContributions are welcome! If you find a bug or want a feature, please open an issue.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingfries%2Fauto_paginated_view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingfries%2Fauto_paginated_view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingfries%2Fauto_paginated_view/lists"}