{"id":13465648,"url":"https://github.com/quire-io/scroll-to-index","last_synced_at":"2025-03-25T16:32:29.790Z","repository":{"id":34739570,"uuid":"183142380","full_name":"quire-io/scroll-to-index","owner":"quire-io","description":"scroll to index with fixed/variable row height inside Flutter scrollable widget","archived":false,"fork":false,"pushed_at":"2025-01-28T07:06:46.000Z","size":83,"stargazers_count":523,"open_issues_count":26,"forks_count":107,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-01-28T08:20:39.266Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/quire-io.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}},"created_at":"2019-04-24T03:41:14.000Z","updated_at":"2025-01-28T07:06:50.000Z","dependencies_parsed_at":"2024-01-02T22:52:16.661Z","dependency_job_id":"868aec3b-8aed-40b1-a373-a486a5a94936","html_url":"https://github.com/quire-io/scroll-to-index","commit_stats":{"total_commits":39,"total_committers":6,"mean_commits":6.5,"dds":0.5641025641025641,"last_synced_commit":"be171b267f318e47436fdfb134e30fd5ce7b2efb"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quire-io%2Fscroll-to-index","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quire-io%2Fscroll-to-index/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quire-io%2Fscroll-to-index/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quire-io%2Fscroll-to-index/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quire-io","download_url":"https://codeload.github.com/quire-io/scroll-to-index/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245500401,"owners_count":20625572,"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":"2024-07-31T15:00:33.293Z","updated_at":"2025-03-25T16:32:29.512Z","avatar_url":"https://github.com/quire-io.png","language":"Dart","funding_links":[],"categories":["Components","组件","UI [🔝](#readme)"],"sub_categories":["UI"],"readme":"# scroll-to-index\n\nThis package provides the scroll to index mechanism for fixed/variable row height for Flutter scrollable widget.\n\n## Getting Started\n\nIn the `pubspec.yaml` of your flutter project, add the following dependency:\n\n```yaml\ndependencies:\n  ...\n  scroll_to_index: any\n```\n\nIn your library add the following import:\n\n```dart\nimport 'package:scroll_to_index/scroll_to_index.dart';\n```\n\nFor help getting started with Flutter, view the online [documentation](https://flutter.io/).\n\n## Usage\n\nThis is a widget level library, means you can use this mechanism inside any Flutter scrollable widget.\n\nExample for Flutter ListView\n\n``` dart\nListView(\n  scrollDirection: scrollDirection,\n  controller: controller,\n  children: randomList.map\u003cWidget\u003e((data) {\n  \tfinal index = data[0];\n  \tfinal height = data[1];\n    return AutoScrollTag(\n      key: ValueKey(index),\n      controller: controller,\n      index: index,\n      child: Text('index: $index, height: $height'),\n      highlightColor: Colors.black.withOpacity(0.1),\n    );\n  }).toList(),\n)\n\n```\n\nyou can wrap any of your row widget which has dynamic row height\n\n``` dart\nAutoScrollTag(\n  key: ValueKey(index),\n  controller: controller,\n  index: index,\n  child: child\n)\n```\n\nwith the `AutoScrollController` controller.\n\nwhen you need to trigger scroll to a specified index, you can call\n\n```\ncontroller.scrollToIndex(index, preferPosition: AutoScrollPosition.begin)\n```\n\neven more, with a fixed row height, you can give it a suggested height for more efficient scrolling. there are more configuration.\n\n```\nfinal controller = AutoScrollController(\n  //add this for advanced viewport boundary. e.g. SafeArea\n  viewportBoundaryGetter: () =\u003e Rect.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom),\n\n  //choose vertical/horizontal\n  axis: scrollDirection,\n\n  //this given value will bring the scroll offset to the nearest position in fixed row height case.\n  //for variable row height case, you can still set the average height, it will try to get to the relatively closer offset \n  //and then start searching.\n  suggestedRowHeight: 200\n);\n```\n\nfor full example, please see this [Demo](https://github.com/quire-io/scroll-to-index/blob/master/example/lib/main.dart).\n\n## Who Uses\n\n* [Quire](https://quire.io) - a simple, collaborative, multi-level task management tool.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquire-io%2Fscroll-to-index","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquire-io%2Fscroll-to-index","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquire-io%2Fscroll-to-index/lists"}