opt: 私信内容可选择(待升级至extended_text以解决表情复制显示占位符问题)

This commit is contained in:
orz12
2024-08-17 09:17:05 +08:00
parent 81f040f22b
commit a3031a9fec

View File

@@ -51,8 +51,7 @@ class ChatItem extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
bool isOwner = bool isOwner = item.senderUid == GStorage.userInfo.get('userInfoCache').mid;
item.senderUid == GStorage.userInfo.get('userInfoCache').mid;
bool isPic = item.msgType == MsgType.pic.value; // 图片 bool isPic = item.msgType == MsgType.pic.value; // 图片
bool isText = item.msgType == MsgType.text.value; // 文本 bool isText = item.msgType == MsgType.text.value; // 文本
@@ -85,7 +84,8 @@ class ChatItem extends StatelessWidget {
final String emojiKey = match[0]!; final String emojiKey = match[0]!;
print(emojiKey); print(emojiKey);
if (emojiMap.containsKey(emojiKey)) { if (emojiMap.containsKey(emojiKey)) {
children.add(WidgetSpan( children.add(
WidgetSpan(
child: NetworkImgLayer( child: NetworkImgLayer(
width: 18, width: 18,
height: 18, height: 18,
@@ -115,13 +115,13 @@ class ChatItem extends StatelessWidget {
return ''; return '';
}, },
); );
return RichText( return SelectableText.rich(
text: TextSpan( TextSpan(
children: children, children: children,
), ),
); );
} else { } else {
return Text( return SelectableText(
text, text,
style: TextStyle( style: TextStyle(
letterSpacing: 0.6, letterSpacing: 0.6,
@@ -234,7 +234,7 @@ class ChatItem extends StatelessWidget {
), ),
), ),
const SizedBox(height: 6), const SizedBox(height: 6),
Text( SelectableText(
content['title'], content['title'],
style: TextStyle( style: TextStyle(
letterSpacing: 0.6, letterSpacing: 0.6,
@@ -487,7 +487,7 @@ class SystemNotice extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(content['title'], SelectableText(content['title'],
style: Theme.of(context) style: Theme.of(context)
.textTheme .textTheme
.titleMedium! .titleMedium!
@@ -502,7 +502,7 @@ class SystemNotice extends StatelessWidget {
Divider( Divider(
color: Theme.of(context).colorScheme.primary.withOpacity(0.05), color: Theme.of(context).colorScheme.primary.withOpacity(0.05),
), ),
Text( SelectableText(
content['text'], content['text'],
) )
], ],