scrollToBottom method
void
scrollToBottom()
Smoothly scrolls to the bottom of the chat.
It performs an initial jump followed by a smooth animation for better user experience.
Implementation
void scrollToBottom() async {
if (hasClients) {
double movePosition = 0.0;
jumpTo(movePosition);
WidgetsBinding.instance.addPostFrameCallback((_) async {
movePosition = 0.0;
animateTo(
movePosition,
duration: const Duration(milliseconds: 50),
curve: Curves.easeInOut,
);
});
}
}