{"id":13547959,"url":"https://github.com/marcossevilla/lazy_indexed_stack","last_synced_at":"2025-04-22T11:51:11.014Z","repository":{"id":37939847,"uuid":"495478896","full_name":"marcossevilla/lazy_indexed_stack","owner":"marcossevilla","description":"A Flutter package that exposes an IndexedStack that can be lazily loaded.","archived":false,"fork":false,"pushed_at":"2023-07-19T15:01:42.000Z","size":934,"stargazers_count":28,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-19T00:19:52.980Z","etag":null,"topics":["flutter"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/flutter_lazy_indexed_stack","language":"C++","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/marcossevilla.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-05-23T15:57:10.000Z","updated_at":"2024-09-25T04:23:34.000Z","dependencies_parsed_at":"2024-01-14T15:25:47.989Z","dependency_job_id":"c3fab19b-c61f-418e-9486-cbebea4c8c73","html_url":"https://github.com/marcossevilla/lazy_indexed_stack","commit_stats":{"total_commits":20,"total_committers":3,"mean_commits":6.666666666666667,"dds":0.09999999999999998,"last_synced_commit":"86bbcea5cf3b010cfff48b15a3bd84f92f71d6f4"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcossevilla%2Flazy_indexed_stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcossevilla%2Flazy_indexed_stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcossevilla%2Flazy_indexed_stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcossevilla%2Flazy_indexed_stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcossevilla","download_url":"https://codeload.github.com/marcossevilla/lazy_indexed_stack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250237796,"owners_count":21397399,"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":["flutter"],"created_at":"2024-08-01T12:01:03.783Z","updated_at":"2025-04-22T11:51:10.970Z","avatar_url":"https://github.com/marcossevilla.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Lazy Indexed Stack 😴🥞\n\n[![pub][pub_dev_badge]][pub_dev_link]\n[![ci][ci_badge]][ci_link]\n[![License: MIT][license_badge]][license_link]\n[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]\n\nA Flutter package that exposes an `IndexedStack` that can be lazily loaded.\n\n`IndexedStack` is a widget that shows its children one at a time, preserving the state of all the children. But it renders all the children at once.\n\nWith `LazyIndexedStack`, you can load the children lazily, and only when they are needed. This comes in handy if you have a lot of children, and you don't want to load them all at once or if you have a child that loads content asynchronously.\n\n## Usage\n\nThe `LazyIndexedStack` API is the same as `IndexedStack`. A basic implementation requires two parameters:\n\n- A `List\u003cWidget\u003e` of children that are going to be lazy loaded under the hood.\n- An `int` index that indicates which child is going to be shown.\n\n## Example\n\n\u003ca href=\"https://github.com/marcossevilla/lazy_indexed_stack/blob/main/example/lib/app.dart\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/marcossevilla/lazy_indexed_stack/main/art/flutter_lazy_indexed_stack.gif\" height=\"400\" width=\"250\"/\u003e\u003c/a\u003e\n\n```dart\nclass HomePage extends StatefulWidget {\n  const HomePage({super.key, required this.title});\n\n  final String title;\n\n  @override\n  State\u003cHomePage\u003e createState() =\u003e _HomePageState();\n}\n\nclass _HomePageState extends State\u003cHomePage\u003e {\n  int index = 0;\n\n  void changeIndex(int newIndex) =\u003e setState(() =\u003e index = newIndex);\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(\n        title: Text(widget.title),\n      ),\n      body: Column(\n        children: [\n          Expanded(\n            child: LazyIndexedStack(\n              index: index,\n              children: List.generate(3, (i) =\u003e Text('$i')),\n            ),\n          ),\n          BottomNavigationBar(\n            currentIndex: index,\n            onTap: changeIndex,\n            items: const [\n              BottomNavigationBarItem(\n                icon: Icon(Icons.filter_1),\n                label: '1',\n              ),\n              BottomNavigationBarItem(\n                icon: Icon(Icons.filter_2),\n                label: '2',\n              ),\n              BottomNavigationBarItem(\n                icon: Icon(Icons.filter_3),\n                label: '3',\n              ),\n            ],\n          ),\n        ],\n      ),\n    );\n  }\n}\n```\n\nRefer to the [example][example_link] to see the usage of `LazyIndexedStack`.\n\n[ci_badge]: https://github.com/marcossevilla/lazy_indexed_stack/workflows/lazy_indexed_stack/badge.svg\n[ci_link]: https://github.com/marcossevilla/lazy_indexed_stack/actions\n[example_link]: https://github.com/marcossevilla/lazy_indexed_stack/blob/main/example/lib/app.dart\n[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg\n[license_link]: https://opensource.org/licenses/MIT\n[pub_dev_badge]: https://img.shields.io/pub/v/flutter_lazy_indexed_stack.svg\n[pub_dev_link]: https://pub.dev/packages/flutter_lazy_indexed_stack\n[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg\n[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcossevilla%2Flazy_indexed_stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcossevilla%2Flazy_indexed_stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcossevilla%2Flazy_indexed_stack/lists"}