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