flutter-listutils
flutter-listutils copied to clipboard
Feature request: allow sections in the list
Allow the usage of sections similar to this listview: https://pub.dev/packages/flutter_section_list_view
Do you want something like that?
sections: <Section>[
Section(
label: Text('Static section'),
children: <Widget>[
ListTile(),
...
],
),
Section(
label: Text('Dynamic section'),
adapter: NetworkListAdapter(..),
),
...
],
No, more like a separate sectionBuilder
(additional to itemBuilder
).However, i am not sure how to distinguish between sections and items in the data once you have to separate builders.
No, more like a separate
sectionBuilder
(additional toitemBuilder
).However, i am not sure how to distinguish between sections and items in the data once you have to separate builders.
Could you write example mockup code?
No, more like a separate
sectionBuilder
(additional toitemBuilder
).However, i am not sure how to distinguish between sections and items in the data once you have to separate builders.Could you write example mockup code?
Sure:
CustomListView(
sectionBuilder: (context, index, section) {return SectionTile(title: section.title)},
itemBuilder: (context, index, item) {return ListTile(title: item.title)},
adapter: ListAdapter(
fetchItems: (int offset, int limit) {
return List(ListItems([ ... ])); // <- Each section has its own list entry, or maybe other structure handling the sections
},
),
Does this make sense to you?
I need to think about code design:
- Where to define sections
- Dynamic sections?
- Defining which item is associated to which section.
- Infinite loading and many more things