GetStream / stream-chat-flutter

Flutter Chat SDK - Build your own chat app experience using Dart, Flutter and the Stream Chat Messaging API.
https://getstream.io/chat/sdk/flutter/
Other
918 stars 337 forks source link

support to customize the duration of scrolling to bottom #1878

Closed chenbokun97 closed 5 months ago

chenbokun97 commented 6 months ago

Please select which package this feature is related to

stream_chat_flutter

Which platforms would this feature impact?

iOS

Is your feature request related to a problem?

No response

Describe the solution that you'd like

add a parameter to customize the duration of scrolling to bottom in function scrollToBottomDefaultTapAction

Future<void> scrollToBottomDefaultTapAction(int unreadCount) async {
    this.unreadCount = unreadCount;
    if (unreadCount > 0) {
      streamChannel!.channel.markRead();
    }

    // If the channel is not up to date, we need to reload it before scrolling
    // to the end of the list.
    if (!_upToDate) {
      // Reset the pagination variables.
      initialIndex = 0;
      initialAlignment = 0;
      _bottomPaginationActive = false;

      // Reload the channel to get the latest messages.
      await streamChannel!.reloadChannel();

      // Wait for the frame to be rendered with the updated channel state.
      await WidgetsBinding.instance.endOfFrame;
    }

    // Scroll to the end of the list.
    if (_scrollController?.isAttached == true) {
      _scrollController!.scrollTo(
        index: 0,
        duration: const Duration(seconds: **customizedDuration**),
        curve: Curves.easeInOut,
      );
    }
  }

Describe alternatives that you have considered

We can pass our own scrollToBottomTapAction to solve this, but there are so many other functions in the default tap action, and it's hard to override and maintain them, such as the controller, and some private variables. Currently the scrolling speed is too slow, so could you help to add a parameter to customize this duration? It would be helpful, thanks.

Additional context

No response

Code of Conduct

github-actions[bot] commented 6 months ago

This issue is stale because it has been open for 20 days with no activity.

github-actions[bot] commented 5 months ago

This issue was closed because it has been inactive for 7 days since being marked as stale.