Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

sticky_and_expandable_list

flutter implementation of sticky headers and expandable list.support use it in a customscrollview.

sticky headers and expandable list flutter

features

  • support build an expandable listview, which can expand/collapse section group or pin section header.
  • use it with customscrollview、sliverappbar.
  • listen the scroll offset of current sticky header,
    and current sticky header index.

getting started

in the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  sticky_and_expandable_list: '^0.1.0'

basic usage

    //sectionlist is a custom data source for expandablelistview.
    //echo section class must implement expandablelistsection.
    list<section> sectionlist = mockdata.getexamplesections();
    return expandablelistview(
      builder: sliverexpandablechilddelegate<string, section>(
          sectionlist: sectionlist,
          headerbuilder: (context, section, index) => text("header #$index"),
          itembuilder: (context, section, item, index) => listtile(
                leading: circleavatar(
                  child: text("$index"),
                ),
                title: text(item),
              )),
    );

detail examples

faq

how to expand/collapse item?

section.setsectionexpanded(true)

example

how to listen current sticky header or the sticky header scroll offset?

  @override
  widget build(buildcontext context) {
    expandablelistview(
      builder: sliverexpandablechilddelegate<string, section>(
        headercontroller: _getheadercontroller(),
      ),
    )
  }

  _getheadercontroller() {
    var controller = expandablelistheadercontroller();
    controller.addlistener(() {
      print("switchingsectionindex:${controller.switchingsectionindex}, stickysectionindex:" +
          "${controller.stickysectionindex},scrollpercent:${controller.percent}");
    });
    return controller;
  }

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.