Browse Source

fix(message): 修复对话列表头像和昵称显示逻辑

- 移除头像图片的本地资源兜底逻辑,统一使用网络图片
- 简化昵称显示逻辑,优先显示昵称,否则显示空字符串
- 移除冗余的空值检查和类型转换代码
ios
Jolie 3 months ago
parent
commit
8e58edd0ac
1 changed files with 2 additions and 9 deletions
  1. 11
      lib/pages/message/conversation_tab.dart

11
lib/pages/message/conversation_tab.dart

@ -109,12 +109,7 @@ class _ConversationTabState extends State<ConversationTab>
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(28), borderRadius: BorderRadius.circular(28),
image: DecorationImage( image: DecorationImage(
image: (userInfo?.avatarUrl?.isNotEmpty ?? false)
? NetworkImage(userInfo!.avatarUrl!)
: const AssetImage(
Assets.imagesAvatarsExample,
)
as ImageProvider,
image: NetworkImage(userInfo!.avatarUrl!),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -131,9 +126,7 @@ class _ConversationTabState extends State<ConversationTab>
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
(userInfo?.nickName?.isNotEmpty ?? false)
? userInfo!.nickName!
: conversation.id, // ID
userInfo.nickName ?? '', // ID
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,

Loading…
Cancel
Save