SimformSolutionsPvtLtd / flutter_chatview

Highly customisable chat UI with reply and reaction functionality.
https://pub.dev/packages/chatview
MIT License
293 stars 129 forks source link

ScrollController Exception #240

Open kkruel8100 opened 1 month ago

kkruel8100 commented 1 month ago

1. The chatController is initialized as

chatController = ChatController( initialMessageList: messageList, scrollController: ScrollController(), currentUser: currentUser!, otherUsers: [otherUser!], );

  1. In the chatview, enter in incoming and receiving outgoing bubbles. Enough messages so that it has more messages than the height of the screen
  2. Attempt to scroll up and down the view

Expected results: Scroll without exceptions

Actual results: Scroll with unlimited exceptions

Screenshot 2024-08-08 at 7 20 56 AM

I am on 2.0.0 and cannot update to newest version due to issues on that release.

Thank you for any assistance you can provide to resolve this issue.

vatsaltanna commented 1 month ago

@kkruel8100 I attempted to reproduce the issue but was unsuccessful. Could you please try it on the example and send me the steps to reproduce the issue along with the solution as soon as possible?

mcosti commented 3 weeks ago

I am having the same issue, but it's a bit difficult to extract the code in a reproduceable manner.

I have a tab navigation and this usually shows up when I go from one tab to another (and one of the tabs is a chat view)

vatsaltanna commented 3 weeks ago

Could you please share the stack trace?

ahmedhosni-route commented 2 weeks ago

E/flutter (30159): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 158 pos 12: '_positions.length == 1': ScrollController attached to multiple scroll views. E/flutter (30159): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61) E/flutter (30159): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5) E/flutter (30159): #2 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:158:12) E/flutter (30159): #3 ChatController.scrollToLastMessage. (package:chatview/src/controller/chat_controller.dart:156:30) E/flutter (30159): #4 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) E/flutter (30159): #5 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) E/flutter (30159): #6 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5) E/flutter (30159): #7 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)