Dimibe / grouped_list

A Flutter ListView in which items can be grouped into sections.
https://pub.dev/packages/grouped_list
MIT License
391 stars 107 forks source link

Hide Separator if only one group #199

Open wilpar opened 6 months ago

wilpar commented 6 months ago

Is your feature request related to a problem? Please describe. I run into cases where there may or not be multiple groups in a stream. In this case, I would like to NOT put a header (groupSeparatorBuilder) on the single group, as it's redundant.

Describe the solution you'd like Perhaps a boolean hideSingleGroupSeparator, which if set to true, would ignore the groupSeparatorBuilder completely in cases where there was only one group.

iksivee commented 3 months ago

Hello, you can do omething like this:

groupHeaderBuilder: (element) { return listElements.last != element ? groupDivider() : SizedBox.shrink(); }