rect_getter
rect_getter copied to clipboard
getting scroll position such as top or bottom with RectGetter
with RectGetter widget we can detect visible items into ListView, for example:
List<int> getVisible() {
var rect = RectGetter.getRectFromKey(listViewKey);
var _items = <int>[];
_keys.forEach((index, key) {
var itemRect = RectGetter.getRectFromKey(key);
if (itemRect != null && !(itemRect.top > rect.bottom || itemRect.bottom < rect.top)) _items.add(index);
});
return _items;
}
in this code i want to detect ListView scroll position achieve on top of list or bottom of list, maybe you guess this issue can be solve with ScrollController, but i check that and that have a bit problem and i can't resolve with that
now how can i get scroll position such as top or bottom with RectGetter?