flutter-listutils icon indicating copy to clipboard operation
flutter-listutils copied to clipboard

Feature request: allow sections in the list

Open sebastianbuechleratcamaelion opened this issue 4 years ago • 5 comments

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(..),
  ),
  ...
],

themisir avatar Jun 15 '20 12:06 themisir

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 to itemBuilder).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?

themisir avatar Jun 15 '20 13:06 themisir

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.

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

themisir avatar Jun 18 '20 20:06 themisir