getImageWidget method
Implementation
Widget getImageWidget(BuildContext context, TUITheme theme) {
Widget defaultAvatar() {
if (type == 1) {
return Image.asset(
TencentUtils.checkString(
selfInfoViewModel.globalConfig?.defaultAvatarAssetPath) ??
'images/default_c2c_head.png',
fit: BoxFit.cover,
package:
selfInfoViewModel.globalConfig?.defaultAvatarAssetPath != null
? null
: 'tencent_cloud_chat_uikit');
} else {
return Image.asset(
TencentUtils.checkString(
selfInfoViewModel.globalConfig?.defaultAvatarAssetPath) ??
'images/default_group_head.png',
fit: BoxFit.cover,
package:
selfInfoViewModel.globalConfig?.defaultAvatarAssetPath != null
? null
: 'tencent_cloud_chat_uikit');
}
}
// final emptyAvatarBuilder = coreService.emptyAvatarBuilder;
if (faceUrl != "") {
if (isFromLocalAsset) {
return Image.asset(
faceUrl,
fit: BoxFit.cover,
);
}
return CachedNetworkImage(
imageUrl: faceUrl,
fadeInDuration: const Duration(milliseconds: 0),
errorWidget: (BuildContext context, String c, dynamic s) {
return defaultAvatar();
},
);
} else {
return defaultAvatar();
}
}