From 37e33d6388b3ab04df222193b84d3b2b68ddedde Mon Sep 17 00:00:00 2001 From: Sahil Sonawane Date: Fri, 22 Oct 2021 16:20:49 +0530 Subject: [PATCH] Bottom Scroll with new incoming messages * With the new change, the list will always be scrolled at the bottom to adjust with the new incoming message. * Also change on line 230 for scrolling bottom on a new message posted. --- example/lib/ChatPage.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/example/lib/ChatPage.dart b/example/lib/ChatPage.dart index 67af307e..9787aeaf 100644 --- a/example/lib/ChatPage.dart +++ b/example/lib/ChatPage.dart @@ -124,7 +124,8 @@ class _ChatPage extends State { child: ListView( padding: const EdgeInsets.all(12.0), controller: listScrollController, - children: list), + reverse: true, + children: list.reversed.toList()), ), Row( children: [ @@ -226,7 +227,7 @@ class _ChatPage extends State { Future.delayed(Duration(milliseconds: 333)).then((_) { listScrollController.animateTo( - listScrollController.position.maxScrollExtent, + listScrollController.position.minScrollExtent, duration: Duration(milliseconds: 333), curve: Curves.easeOut); });