1
0
Fork 0

Improve scroll end

This commit is contained in:
Florian RICHER (MrDev023) 2022-04-26 21:41:57 +02:00
parent f256b1aee7
commit 96a8f41525

View file

@ -82,12 +82,17 @@ class _HomePageState extends State<HomePage> {
itemCount: streamElements.length,
controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
_scrollController.animateTo(
_scrollController.position.maxScrollExtent,
duration: const Duration(milliseconds: 500),
curve: Curves.easeOut);
});
if (_scrollController.position.maxScrollExtent -
_scrollController.offset <
10) {
WidgetsBinding.instance!
.addPostFrameCallback((timeStamp) {
_scrollController.animateTo(
_scrollController.position.maxScrollExtent,
duration: const Duration(milliseconds: 500),
curve: Curves.easeOut);
});
}
return StreamElementCard(
streamElement: streamElements[index]);
},