Skip to content

Commit

Permalink
feat: group section style (#206)
Browse files Browse the repository at this point in the history
Co-authored-by: Lior Agnin <[email protected]>
  • Loading branch information
Dimibe and LiorAgnin authored Jun 27, 2024
1 parent 229ba3a commit de7a7fc
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 275 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ import 'package:grouped_list/grouped_list.dart';
```

### Parameters:
| Name | Description | Required | Default value |
|----|----|----|----|
|`elements`| A list of the data you want to display in the list | required | - |
|`groupBy` |Function which maps an element to its grouped value | required | - |
|`itemBuilder` / `indexedItemBuilder` / `interdependentItemBuilder`| Function which returns an Widget which defines the item. `indexedItemBuilder` provides the current index as well. `interdependentItemBuilder` provides the previous and next items as well.`indexedItemBuilder` is preferred over `interdependentItemBuilder` and `interdependentItemBuilder` is preferred over`itemBuilder` | yes, either of them | - |
|`groupSeparatorBuilder` / `groupHeaderBuilder`| Function which returns a Widget which defines the group headers. While `groupSeparatorBuilder` gets the `groupBy`-value as parameter `groupHeaderBuilder` gets the whole element. If both are defined `groupHeaderBuilder` is preferred| yes, either of them | - |
|`groupStickyHeaderBuilder` | Function which returns a Widget which defines the sticky group header, when `useStickyGroupSeparators` is `true`. If not defined `groupSeparatorBuilder` or `groupHeaderBuilder` will be used as described above. | no | - |
|`useStickyGroupSeparators` | When set to true the group header of the current visible group will stick on top | no | `false` |
|`floatingHeader` | Whether the sticky group header float over the list or occupy it's own space | no | `false` |
|`stickyHeaderBackgroundColor` | Defines the background color of the sticky header. Will only be used if `useStickyGroupSeparators` is used | no | `Color(0xffF7F7F7)` |
|`separator` | A Widget which defines a separator between items inside a group | no | no separator |
| `groupComparator` | Can be used to define a custom sorting for the groups. Otherwise the natural sorting order is used | no | - |
| `itemComparator` | Can be used to define a custom sorting for the elements inside each group. Otherwise the natural sorting order is used | no | - |
| `order` | Change to `GroupedListOrder.DESC` to reverse the group sorting | no | `GroupedListOrder.ASC` |
| `footer` | Widget at the bottom of the list | no | - |
| Name | Description | Required | Default value |
|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----|----|
| `elements` | A list of the data you want to display in the list | required | - |
| `groupBy` | Function which maps an element to its grouped value | required | - |
| `itemBuilder` / `indexedItemBuilder` / `interdependentItemBuilder` / `grouItemBuilder` | Function which returns an Widget which defines the item. <br/> * `indexedItemBuilder` provides the current index as well. <br/> * `interdependentItemBuilder` provides the previous and next items as well.<br/> * `groupItemBuilder` provides information if the item is the first or last element inside a group. <br/>`indexedItemBuilder` is preferred over `interdependentItemBuilder` and `interdependentItemBuilder` is preferred over`itemBuilder`. | yes, either of them | - |
| `groupSeparatorBuilder` / `groupHeaderBuilder` | Function which returns a Widget which defines the group headers. While `groupSeparatorBuilder` gets the `groupBy`-value as parameter `groupHeaderBuilder` gets the whole element. If both are defined `groupHeaderBuilder` is preferred | yes, either of them | - |
| `groupStickyHeaderBuilder` | Function which returns a Widget which defines the sticky group header, when `useStickyGroupSeparators` is `true`. If not defined `groupSeparatorBuilder` or `groupHeaderBuilder` will be used as described above. | no | - |
| `useStickyGroupSeparators` | When set to true the group header of the current visible group will stick on top | no | `false` |
| `floatingHeader` | Whether the sticky group header float over the list or occupy it's own space | no | `false` |
| `stickyHeaderBackgroundColor` | Defines the background color of the sticky header. Will only be used if `useStickyGroupSeparators` is used | no | `Color(0xffF7F7F7)` |
| `separator` | A Widget which defines a separator between items inside a group | no | no separator |
| `groupComparator` | Can be used to define a custom sorting for the groups. Otherwise the natural sorting order is used | no | - |
| `itemComparator` | Can be used to define a custom sorting for the elements inside each group. Otherwise the natural sorting order is used | no | - |
| `order` | Change to `GroupedListOrder.DESC` to reverse the group sorting | no | `GroupedListOrder.ASC` |
| `footer` | Widget at the bottom of the list | no | - |

**Also the fields from `ListView.builder` can be used.**

Expand Down
Loading

0 comments on commit de7a7fc

Please sign in to comment.