Animate Text like in chatbots
It is possible to animate the text like in a chatbot?
I just added this feature. I sent a PR @ this
Hi @Princewil Thankyou for your time and input to improve the package, but please read the below comment to acheive the output without changing the package code. Thankyou.
Animated Chatbot Text Using customMessageBuilder
chatview already exposes customMessageBuilder, which is explicitly designed to let consumers render any widget they want for a message. Since animated chatbot text is purely a UI concern, it fits perfectly into MessageType.custom.
Because of this, there is no need to add a dependency on animated_text_kit (or any animation package) inside chatview itself. Users can implement animations entirely on their side using the existing API.
How to Do It with the Existing API
1. Add a Custom Message
_chatController.addMessage(
Message(
id: DateTime.now().toString(),
createdAt: DateTime.now(),
message: message,
sentBy: _chatController.currentUser.id,
messageType: MessageType.custom,
),
);
2. Render it using customMessageBuilder:
customMessageBuilder: (message) {
return AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText(
message.message,
),
],
);
},
Please view the working code in gist - https://gist.github.com/japanshah-simform/e2d4746929d12ca00d082e4f9a2b1bc2
Preview
https://github.com/user-attachments/assets/6a200d4c-1347-42ef-bf77-f25765cc8f67
please view the explanation above to use customMessageBuilder to Animate text like Chatbot.