From f256b1aee71c0a384a252c75621a74042b9652bf Mon Sep 17 00:00:00 2001 From: "Florian RICHER (MrDev023)" Date: Tue, 26 Apr 2022 21:38:26 +0200 Subject: [PATCH] Fix end scroll --- lib/widgets/pages/home.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/widgets/pages/home.dart b/lib/widgets/pages/home.dart index d228c14..030a84b 100644 --- a/lib/widgets/pages/home.dart +++ b/lib/widgets/pages/home.dart @@ -74,14 +74,20 @@ class _HomePageState extends State { (element) => element!.uuid == snapshot.data!.uuid, orElse: () => null) != null; - if (!alreadyAdded) streamElements.add(snapshot.data!); + if (!alreadyAdded) { + streamElements.add(snapshot.data!); + } } return ListView.builder( itemCount: streamElements.length, controller: _scrollController, itemBuilder: (BuildContext context, int index) { - _scrollController - .jumpTo(_scrollController.position.maxScrollExtent); + WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { + _scrollController.animateTo( + _scrollController.position.maxScrollExtent, + duration: const Duration(milliseconds: 500), + curve: Curves.easeOut); + }); return StreamElementCard( streamElement: streamElements[index]); },