collection: scroll to top on filter change

This commit is contained in:
Thibault Deckers 2021-01-19 19:06:03 +09:00
parent 4d8e2d4123
commit c840190aec

View file

@ -195,10 +195,12 @@ class _CollectionScrollViewState extends State<CollectionScrollView> {
}
void _registerWidget(CollectionScrollView widget) {
widget.collection.filterChangeNotifier.addListener(_onFilterChange);
widget.scrollController.addListener(_onScrollChange);
}
void _unregisterWidget(CollectionScrollView widget) {
widget.collection.filterChangeNotifier.removeListener(_onFilterChange);
widget.scrollController.removeListener(_onScrollChange);
}
@ -281,6 +283,8 @@ class _CollectionScrollViewState extends State<CollectionScrollView> {
);
}
void _onFilterChange() => widget.scrollController.jumpTo(0);
void _onScrollChange() {
widget.isScrollingNotifier.value = true;
_stopScrollMonitoringTimer();