chore: add UserAvatar placeholder builder to stream_chat_theme.dart and user_avatar.dart

This commit is contained in:
groovinchip
2021-08-04 14:35:58 -04:00
parent 8de0eab7cb
commit d74576a197
2 changed files with 6 additions and 0 deletions
@@ -113,6 +113,7 @@ class StreamChatThemeData {
required this.ownMessageTheme,
required this.messageInputTheme,
required this.defaultUserImage,
this.placeholderUserImage,
required this.primaryIconTheme,
required this.reactionIcons,
required this.galleryHeaderTheme,
@@ -170,6 +171,9 @@ class StreamChatThemeData {
/// The widget that will be built when the user image is unavailable
final Widget Function(BuildContext, User) defaultUserImage;
/// The widget that will be built when the user image is loading
final Widget Function(BuildContext context, User user)? placeholderUserImage;
/// Primary icon theme
final IconThemeData primaryIconTheme;
@@ -79,6 +79,8 @@ class UserAvatar extends StatelessWidget {
imageUrl: user.extraData['image'] as String,
errorWidget: (_, __, ___) =>
streamChatTheme.defaultUserImage(context, user),
placeholder: (_, __) =>
streamChatTheme.placeholderUserImage!(context, user),
fit: BoxFit.cover,
)
: streamChatTheme.defaultUserImage(context, user),