I designed a chat app, here is send method:

  void sendMessage() async {
    FocusScope.of(context).unfocus();
    chatPlayerController.sendNewMessage(message: _textController.text);
    _textController.clear();

    _scrollController.animateTo(_scrollController.position.maxScrollExtent,
        duration: Duration(seconds: 2), curve: Curves.ease);
  }

for the main part I use a package called GroupedListView:

Expanded(
                  child: GroupedListView<LocalMessage, DateTime>(
                    physics: BouncingScrollPhysics(),
                    controller:_scrollController,
                    elements: controller.messagesList,
                    order: GroupedListOrder.DESC,
                    reverse: true,
                    floatingHeader: true,
                    useStickyGroupSeparators: false,
                    groupBy: (LocalMessage element) =>
                        DateTime(
                          element.senderTime.year,
                          element.senderTime.month,
                          element.senderTime.day,
                        ),
                    groupHeaderBuilder: _createGroupHeader,
                    itemBuilder: (_, LocalMessage element) =>
                        _createItem(context, element),
                  ),
                ),

After send method is activated, and keyboard will be hidden, but screen is just scrolling down a little and not scroll to the downmost, is anyone know why?


Solution 1: Ozan Taskiran

Try to scroll to 0.0 since you use reverse: true

 _scrollController.animateTo(0.0,
        duration: Duration(seconds: 2), curve: Curves.ease);