fix: dialog text color in dark theme

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2026-02-01 10:15:39 +08:00
parent 255ce534c9
commit 0592905ad4

View File

@@ -1126,25 +1126,21 @@ Widget createDialogContent(String text) {
final RegExp linkRegExp = RegExp(r'(https?://[^\s]+)');
bool hasLink = linkRegExp.hasMatch(text);
// Early return: no link, use default theme color
if (!hasLink) {
return SelectableText(text, style: const TextStyle(fontSize: 15));
}
return Builder(
builder: (context) {
final List<TextSpan> spans = [];
int start = 0;
// Get theme-aware color for non-link text
final textColor = Theme.of(context).textTheme.bodyMedium?.color;
linkRegExp.allMatches(text).forEach((match) {
if (match.start > start) {
spans.add(TextSpan(text: text.substring(start, match.start)));
}
spans.add(TextSpan(
text: match.group(0) ?? '',
style: TextStyle(
style: const TextStyle(
color: Colors.blue,
decoration: TextDecoration.underline,
),
@@ -1164,15 +1160,10 @@ Widget createDialogContent(String text) {
return SelectableText.rich(
TextSpan(
style: TextStyle(
color: textColor,
fontSize: 15,
),
style: const TextStyle(fontSize: 15),
children: spans,
),
);
},
);
}
void msgBox(SessionID sessionId, String type, String title, String text,