tp7309 / flutter_sticky_and_expandable_list

粘性头部与分组列表Sliver实现 Build a grouped list, which support expand/collapse section and sticky headers, support use it with sliver widget.
MIT License
141 stars 27 forks source link

Customize section class #1

Closed tp7309 closed 4 years ago

tp7309 commented 4 years ago

You can define an section class as you like, the only requirement is implement ExpandableListSection, this is to provide item data list in section. Like this:


class Section implements ExpandableListSection<Widget> {
  bool expanded;
  Widget header;
  List<Widget> items;

  @override
  List<Widget> getItems() {
    return items;
  }

  @override
  bool isSectionExpanded() {
    return expanded;
  }

  @override
  void setSectionExpanded(bool expanded) {
    this.expanded = expanded;
  }
}
``
emvaized commented 4 years ago

With this implementation of Section class I get the following error: Screenshot_20200316_234941

tp7309 commented 4 years ago
class Section implements ExpandableListSection<Widget> {}
//so:
SliverExpandableChildDelegate<Widget, Section>()