Skip to content

Commit 0c7edd7

Browse files
new
1 parent 6261e5e commit 0c7edd7

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

lib/data/view/chat/widgets/chat_message_bubble.dart

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ChatMessageBubble extends StatefulWidget {
2222

2323
class _ChatMessageBubbleState extends State<ChatMessageBubble> {
2424
bool _showFullText = false;
25+
final _textController = TextEditingController();
2526

2627
@override
2728
void initState() {
@@ -31,6 +32,12 @@ class _ChatMessageBubbleState extends State<ChatMessageBubble> {
3132
}
3233
}
3334

35+
@override
36+
void dispose() {
37+
_textController.dispose();
38+
super.dispose();
39+
}
40+
3441
@override
3542
Widget build(BuildContext context) {
3643
return Column(
@@ -139,18 +146,24 @@ class _ChatMessageBubbleState extends State<ChatMessageBubble> {
139146
),
140147
)
141148
else
142-
TypeWriter(
143-
text: text,
144-
duration: const Duration(milliseconds: 30),
145-
textStyle: const TextStyle(
146-
color: Color(0xFFD1D5DB),
147-
fontSize: 16,
148-
),
149-
onEnd: () {
149+
TypeWriterText(
150+
controller: _textController,
151+
builder: (context, value) {
152+
return Text(
153+
value,
154+
style: const TextStyle(
155+
color: Color(0xFFD1D5DB),
156+
fontSize: 16,
157+
),
158+
);
159+
},
160+
onComplete: () {
150161
setState(() {
151162
_showFullText = true;
152163
});
153164
},
165+
text: Text(text),
166+
duration: const Duration(milliseconds: 30),
154167
),
155168
if (!isUser) ...[
156169
const Divider(color: Color(0xFF4D4D4D)),

0 commit comments

Comments
 (0)