From 1f9d6ed30405e70943ec0d97720968d2aa5a8283 Mon Sep 17 00:00:00 2001 From: chdo002 <1107661983@qq.com> Date: Thu, 30 May 2024 14:51:47 +0800 Subject: [PATCH] Added optional scroll preferPosition to scrollController.scrollToIndex (#603) --- lib/src/widgets/chat.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/widgets/chat.dart b/lib/src/widgets/chat.dart index 2684ead5..fc6d5a6c 100644 --- a/lib/src/widgets/chat.dart +++ b/lib/src/widgets/chat.dart @@ -380,11 +380,12 @@ class ChatState extends State { Duration? scrollDuration, bool withHighlight = false, Duration? highlightDuration, + AutoScrollPosition? preferPosition }) async { await _scrollController.scrollToIndex( chatMessageAutoScrollIndexById[id]!, duration: scrollDuration ?? scrollAnimationDuration, - preferPosition: AutoScrollPosition.middle, + preferPosition: preferPosition ?? AutoScrollPosition.middle, ); if (withHighlight) { await _scrollController.highlight(