Skip to content

Make scrollToMessage/scrollToIndex work properly even if a non-empty List<Message> is not passed to the messages instance variable of ChatController #793

@avith-tmorishita

Description

@avith-tmorishita

Description
If you don't pass a value to the messages instance variable of ChatController or pass an empty List, executing scrollToMessage and scrollToIndex will not scroll to the specified message or index.

Platform
Web(Chrome)
*I have'nt checked it on Web other than Chrome, or on iOS or Android.

Steps to Reproduce

  1. Add a message using insertMessage.
  2. Execute scrollToMessage/scrollToIndex.

pubspec.yaml Excerpt from package's example

flutter:
  sdk: flutter
flutter_chat_core: ^2.4.0
flutter_chat_ui: ^2.3.1
flyer_chat_file_message: ^2.1.6
flyer_chat_image_message: ^2.1.7
flyer_chat_system_message: ^2.1.6
flyer_chat_text_message: ^2.2.1
flyer_chat_text_stream_message: ^2.1.6

pubspec.yaml Excerpt from my project

flutter:
  sdk: flutter
flutter_chat_ui: ^2.3.1
flutter_chat_core: ^2.4.0
flyer_chat_file_message: ^2.1.6
flyer_chat_image_message: ^2.1.7
flyer_chat_system_message: ^2.1.6
flyer_chat_text_message: ^2.2.1

This problem reproduces both in my project and in the local.dart of the package's example code.
It works properly if you pass a non-empty List to the ChatController's messages instance variable.
Thanks in advance for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions