Skip to content

Commit 1f9d6ed

Browse files
authored
Added optional scroll preferPosition to scrollController.scrollToIndex (#603)
1 parent 1053764 commit 1f9d6ed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/src/widgets/chat.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,12 @@ class ChatState extends State<Chat> {
380380
Duration? scrollDuration,
381381
bool withHighlight = false,
382382
Duration? highlightDuration,
383+
AutoScrollPosition? preferPosition
383384
}) async {
384385
await _scrollController.scrollToIndex(
385386
chatMessageAutoScrollIndexById[id]!,
386387
duration: scrollDuration ?? scrollAnimationDuration,
387-
preferPosition: AutoScrollPosition.middle,
388+
preferPosition: preferPosition ?? AutoScrollPosition.middle,
388389
);
389390
if (withHighlight) {
390391
await _scrollController.highlight(

0 commit comments

Comments
 (0)