Open jabirmayar opened 3 years ago
Hello,
I also need to only show sticky header when scrolling and hide the sticky header when the scroll reach bottom. What I did was use ValueListenableBuilder
on _showFixedGroupHeader
.
Here is the one I forked https://github.com/yunanhelmy/grouped_list. I also created an example project : https://github.com/yunanhelmy/example_grouped_list/blob/master/lib/chat_example_header_listener.dart#L55
I added a new parameters listenableVisibleStickyHeader
. You could just set to listenableVisibleStickyHeader: true
and make sure useStickyGroupSeparators
set to true
.
Please let me know what you think.
Thank you
Hello, is there a way to hide useStickyGroupSeparators when the list is not scrolling? I tried with _scrollController , but the app gets laggy and the value won't update. Like from today it won't update to yesterday and so on.
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { _scrollController.addListener(() { print('scrolling'); setState(() { showStickyHeader = true; }); }); _scrollController.position.isScrollingNotifier.addListener(() { if (!_scrollController.position.isScrollingNotifier.value) { print('scroll is stopped'); setState(() { showStickyHeader = false; }); } else { print('scroll is started'); setState(() { showStickyHeader = true; }); } }); });
GroupedListView<dynamic, String>( elements: generatedList, groupBy: (element) => DateFormat('yyyy-MM-dd') .format(element.time), groupSeparatorBuilder: (time) => Padding( padding: EdgeInsets.only(left: 15, top: 15), child: Text( Utils.checkDate(time.toString()), textAlign: TextAlign.start, style: TextStyle( fontSize: 15, color: Colors.blueGrey[300], fontWeight: FontWeight.bold), ), ), itemBuilder: (context, dynamic element) => ExpandableCardContainer( isExpanded: false, update: updateLists, isFavorites: false, list: element, ), stickyHeaderBackgroundColor: Colors.transparent, order: GroupedListOrder.DESC, useStickyGroupSeparators: showStickyHeader, floatingHeader: true, controller: _scrollController, )
Any help would be greatly appreciated. Thank you