From 58e18b06a8af5a3a31ab7ae61002c28052f26983 Mon Sep 17 00:00:00 2001 From: ivan2282 Date: Sun, 30 Nov 2025 22:48:41 +0300 Subject: [PATCH] Colored text --- lib/widgets/chat_message_bubble.dart | 39 +++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/lib/widgets/chat_message_bubble.dart b/lib/widgets/chat_message_bubble.dart index dbd68e2..a641665 100644 --- a/lib/widgets/chat_message_bubble.dart +++ b/lib/widgets/chat_message_bubble.dart @@ -3752,13 +3752,38 @@ class ChatMessageBubble extends StatelessWidget { ], if (message.text.isNotEmpty) ...[ if (message.text.contains("welcome.saved.dialog.message")) - Container( - alignment: Alignment.center, - child: Text( - 'Привет! Это твои избранные. Все написанное сюда попадёт прямиком к дяде Майору.', - style: TextStyle(color: textColor, fontStyle: FontStyle.italic), - textAlign: TextAlign.center, - ), + Linkify( + text:'Привет! Это твои избранные. Все написанное сюда попадёт прямиком к дяде Майору.', + style: TextStyle(color: textColor, fontStyle: FontStyle.italic), + linkStyle: linkStyle, + onOpen: onOpenLink, + options: const LinkifyOptions(humanize: false), + textAlign: TextAlign.left, + ) + else if (message.text.contains("komet.custom_text")) + Linkify( + style: message.text.contains("komet.custom_text.red") ? + TextStyle(color: Color.from(alpha: 255, red: 255, green: 0, blue: 0)) : + message.text.contains("komet.custom_text.black") ? + TextStyle(color: Color.from(alpha: 255, red: 0, green: 0, blue: 0)) : + message.text.contains("komet.custom_text.green") ? + TextStyle(color: Color.from(alpha: 255, red: 0, green: 255, blue: 0)) : + message.text.contains("komet.custom_text.white") ? + TextStyle(color: Color.from(alpha: 255, red: 255, green: 255, blue: 255)) : defaultTextStyle, + linkStyle: linkStyle, + onOpen: onOpenLink, + options: const LinkifyOptions(humanize: false), + textAlign: message.text.contains("komet.custom_text.right") + ? TextAlign.right + : message.text.contains("komet.custom_text.center") ? TextAlign.center : TextAlign.left, + text: message.text + .replaceAll("komet.custom_text.red", "") + .replaceAll("komet.custom_text.black", "") + .replaceAll("komet.custom_text.green", "") + .replaceAll("komet.custom_text.white", "") + .replaceAll("komet.custom_text.right", "") + .replaceAll("komet.custom_text.center", "") + .replaceAll("komet.custom_text", ""), ) else Linkify(