{"id":13550525,"url":"https://github.com/Dimibe/sticky_grouped_list","last_synced_at":"2025-04-03T00:34:08.783Z","repository":{"id":38971806,"uuid":"274438248","full_name":"Dimibe/sticky_grouped_list","owner":"Dimibe","description":"A ScrollablePositionedList in which items can be grouped into sections with sticky headers.","archived":false,"fork":false,"pushed_at":"2024-09-26T01:24:50.000Z","size":1248,"stargazers_count":185,"open_issues_count":37,"forks_count":71,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T00:30:51.831Z","etag":null,"topics":["dart","flutter","flutter-package"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/sticky_grouped_list","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/Dimibe.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-23T15:13:04.000Z","updated_at":"2025-01-27T06:18:31.000Z","dependencies_parsed_at":"2023-11-15T14:29:19.555Z","dependency_job_id":"cb2d33d0-5ad5-49f3-84a6-34646c8e600f","html_url":"https://github.com/Dimibe/sticky_grouped_list","commit_stats":{"total_commits":66,"total_committers":3,"mean_commits":22.0,"dds":"0.030303030303030276","last_synced_commit":"0819d2610e6348551def6783ab7cda87bd13bae0"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dimibe%2Fsticky_grouped_list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dimibe%2Fsticky_grouped_list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dimibe%2Fsticky_grouped_list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dimibe%2Fsticky_grouped_list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dimibe","download_url":"https://codeload.github.com/Dimibe/sticky_grouped_list/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246916734,"owners_count":20854511,"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":["dart","flutter","flutter-package"],"created_at":"2024-08-01T12:01:34.330Z","updated_at":"2025-04-03T00:34:05.286Z","avatar_url":"https://github.com/Dimibe.png","language":"Dart","funding_links":[],"categories":["Dart"],"sub_categories":[],"readme":"\n[![pub package](https://img.shields.io/pub/v/sticky_grouped_list.svg)](https://pub.dev/packages/sticky_grouped_list)\n[![package publisher](https://img.shields.io/pub/publisher/sticky_grouped_list.svg)](https://pub.dev/packages/sticky_grouped_list)\n![build](https://github.com/Dimibe/sticky_grouped_list/actions/workflows/main.yaml/badge.svg??branch=main)\n \nA `ListView` in which list items can be grouped to sections. Based on [scrollable_positioned_list](https://pub.dev/packages/scrollable_positioned_list), which enables programatically scrolling of the list.\n\n\u003cimg src=\"https://raw.githubusercontent.com/Dimibe/sticky_grouped_list/master/assets/new-screenshot-for-readme.png\" width=\"300\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/Dimibe/sticky_grouped_list/master/assets/chat.png\" width=\"300\"\u003e\n\n### Features\n* Easy creation of chat-like interfaces. \n* List items can be separated in groups.\n* For the groups an individual header can be set.\n* Sticky headers with floating option. \n* All fields from `ScrollablePositionedList` available.\n\n## Getting Started\n\n Add the package to your pubspec.yaml:\n\n ```yaml\n sticky_grouped_list: ^3.1.0\n ```\n \n In your dart file, import the library:\n\n ```Dart\nimport 'package:sticky_grouped_list/sticky_grouped_list.dart';\n ``` \n \n Create a `StickyGroupedListView` Widget:\n \n ```Dart\n  final GroupedItemScrollController itemScrollController = GroupedItemScrollController();\n\n  StickyGroupedListView\u003cdynamic, String\u003e(\n    elements: _elements,\n    groupBy: (dynamic element) =\u003e element['group'],\n    groupSeparatorBuilder: (dynamic element) =\u003e Text(element['group']),\n    itemBuilder: (context, dynamic element) =\u003e Text(element['name']),\n    itemComparator: (e1, e2) =\u003e e1['name'].compareTo(e2['name']), // optional\n    elementIdentifier: (element) =\u003e element.name // optional - see below for usage\n    itemScrollController: itemScrollController, // optional\n    order: StickyGroupedListOrder.ASC, // optional\n  );\n```\n\nIf you are using the `GroupedItemScrollController` you can scroll or jump to an specific position in the list programatically:\n\n1. By using the index, which will scroll to the element at position [index]:\n```dart\n  itemScrollController.scrollTo(index: 4, duration: Duration(seconds: 2));\n  itemScrollController.jumpTo(index: 4);\n```\n\n2. By using a pre defined element identifier. The identifier is defined by a `Function` which takes one element and returns a unique identifier of any type.\nThe methods `scrollToElement` and `jumpToElement` can be used to jump to an element by providing the elements identifier instead of the index: \n```dart\n  final GroupedItemScrollController itemScrollController = GroupedItemScrollController();\n\n  StickyGroupedListView\u003cdynamic, String\u003e(\n    elements: _elements,\n    elementIdentifier: (element) =\u003e element.name\n    itemScrollController: itemScrollController, \n    [...]\n  );\n\n  itemScrollController.scrollToElement(identifier: 'item-1', duration: Duration(seconds: 2));\n  itemScrollController.jumpToElement(identifier: 'item-2');\n```\n\n\n### Parameters:\n| Name | Description | Required | Default value |\n|----|----|----|----|\n|`elements`| A list of the data you want to display in the list | required | - |\n|`itemBuilder` / `indexedItemBuilder`| Function which returns an Widget which defines the item. `indexedItemBuilder` provides the current index as well. If both are defined `indexedItemBuilder` is preferred| yes, either of them | - |\n|`groupBy` |Function which maps an element to its grouped value | required | - |\n|`groupSeparatorBuilder`| Function which gets a element and returns an Widget which defines the group header separator | required | - |\n|`separator` | A Widget which defines a separator between items inside a group | no | no separator |\n| `floatingHeader` | When set to `true` the sticky header will float over the list | no | `false` |\n| `stickyHeaderBackgroundColor` | Defines the background color of the sticky header | no | `Color(0xffF7F7F7)` |\n|`itemScrollController`| Instead of an `ItemScrollController` a `GroupedItemScrollController` needs to be provided. | no | - |\n|`elementIdentifier`| Used by `itemScrollController` and defines the unique identifier for each element. | no | - |\n| `order` | Change to `StickyGroupedListOrder.DESC` to reverse the group sorting | no | `StickyGroupedListOrder.ASC` |\n| `groupComparator` | Can be used to define a custom sorting for the groups. Otherwise the natural sorting order is used | no | - |\n| `itemComparator` | Can be used to define a custom sorting for the elements inside each group. Otherwise the natural sorting order is used | no | - |\n|`reverse`| Scrolls in opposite from reading direction (Starting at bottom and scrolling up). Same as in scrollable_positioned_list. | no | false |\n\n*`GroupedItemScrollController.srollTo()` and `GroupedItemScrollController.jumpTo()` automatic set the `alignment` so that the item is fully visible aligned under the group header. Both methods take `automaticAlignment` as a additional optional paramenter which needs to be set to true if `alignment` is specified.*\n\n**Also the fields from `ScrollablePositionedList.builder` can be used.**\n\n## Highlight - Chat Dialog\n\nEasy creation of chat-like dialogs.\nJust set the option `reverse` to `true` and the option `order` to `StickyGroupedListOrder.DESC`. A full example can be found in the examples.\nThe list will be scrolled to the end in the initial state and therefore scrolling will be against redeaing direction. \n\n## Difference between grouped_list and sticky_grouped_list: \n\nTThe list views in the [GroupedList](https://pub.dev/packages/grouped_list) package are based on the default flutter listview and the silver list. This package is based on the [scrollable_positioned_list](https://pub.dev/packages/scrollable_positioned_list) which enables the possibility to programatically scroll to certain positions in the list. So if you need the ability to programatically scroll the list use the this package otherwise I would recommend to use the [GroupedList](https://pub.dev/packages/grouped_list) package.\n\n\n## Used packages: \n| Package name | Copyright | License |\n|----|----|----|\n|[scrollable_positioned_list](https://pub.dev/packages/scrollable_positioned_list) | Copyright 2018 the Dart project authors, Inc. All rights reserved | [BSD 3-Clause \"New\" or \"Revised\" License](https://github.com/Dimibe/sticky_grouped_list/blob/master/LICENSE) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDimibe%2Fsticky_grouped_list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDimibe%2Fsticky_grouped_list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDimibe%2Fsticky_grouped_list/lists"}