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
140 stars 29 forks source link

Custom Animation with Sliver not working properly #19

Closed degloff closed 3 years ago

degloff commented 4 years ago

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?

tp7309 commented 4 years ago

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

tp7309 commented 4 years ago

Bug, need some time.