mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: 嵌套中括号未识别最内层;匹配不上未显示原始内容;无标题或作者错误
This commit is contained in:
@@ -80,9 +80,10 @@ class ChatItem extends StatelessWidget {
|
||||
emojiMap[e['text']] = e['url'];
|
||||
}
|
||||
text.splitMapJoin(
|
||||
RegExp(r"\[.+?\]"),
|
||||
RegExp(r"\[[^\[\]]+\]"),
|
||||
onMatch: (Match match) {
|
||||
final String emojiKey = match[0]!;
|
||||
print(emojiKey);
|
||||
if (emojiMap.containsKey(emojiKey)) {
|
||||
children.add(WidgetSpan(
|
||||
child: NetworkImgLayer(
|
||||
@@ -91,6 +92,15 @@ class ChatItem extends StatelessWidget {
|
||||
src: emojiMap[emojiKey]!,
|
||||
),
|
||||
));
|
||||
} else {
|
||||
children.add(TextSpan(
|
||||
text: emojiKey,
|
||||
style: TextStyle(
|
||||
color: textColor(context),
|
||||
letterSpacing: 0.6,
|
||||
height: 1.5,
|
||||
),
|
||||
));
|
||||
}
|
||||
return '';
|
||||
},
|
||||
@@ -174,7 +184,7 @@ class ChatItem extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
content['title'],
|
||||
content['title'] ?? "",
|
||||
style: TextStyle(
|
||||
letterSpacing: 0.6,
|
||||
height: 1.5,
|
||||
@@ -184,7 +194,7 @@ class ChatItem extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 1),
|
||||
Text(
|
||||
content['author'],
|
||||
content['author'] ?? "",
|
||||
style: TextStyle(
|
||||
letterSpacing: 0.6,
|
||||
height: 1.5,
|
||||
|
||||
Reference in New Issue
Block a user