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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Animation with Sliver not working properly

degloff opened this issue · comments

If I use the exampe_custom_section_animation example and convert it to use a sliver app bar the scroll behaviour of the sections is not working properly

    return Scaffold(
      body: CustomScrollView(
        slivers: <Widget>[
          SliverAppBar(
            pinned: true,
            floating: true,
            expandedHeight: 200,
            flexibleSpace: FlexibleSpaceBar(
              title: Text("Sliver Example"),
            ),
          ),
          SliverExpandableList(
            builder: SliverExpandableChildDelegate<String, ExampleSection>(
              sectionList: sectionList,
              itemBuilder: (context, sectionIndex, itemIndex, index) {
                String item = sectionList[sectionIndex].items[itemIndex];
                return ListTile(
                  leading: CircleAvatar(
                    child: Text("$index"),
                  ),
                  title: Text(item),
                );
              },
              sectionBuilder: (context, containerInfo) => _SectionWidget(
                section: sectionList[containerInfo.sectionIndex],
                containerInfo: containerInfo,
                onStateChanged: () {
                  //notify ExpandableListView that expand state has changed.
                  WidgetsBinding.instance.addPostFrameCallback((_) {
                    if (mounted) {
                      setState(() {});
                    }
                  });
                },
              ),
            ),
          ),
        ],
      ),
    );

Scroll up first section and then try to open close. It opens and closes but sometimes the section header scrolls up too, which should not happen.

What is the appropriate way to do it?

I'm on vacation now,and I will test at sunday.

Bug, need some time.