@@ -22,13 +22,21 @@ class ActivityComments extends HookConsumerWidget {
2222 final GlobalKey <FormState > formKey;
2323
2424 final currentUserPictureDataProvider =
25- FutureProvider .family <String ?, Activity >((ref, activity) async {
25+ FutureProvider .family <ImageProvider ?, Activity >((ref, activity) async {
2626 final user = await StorageUtils .getUser ();
2727 final provider =
2828 ref.read (activityItemViewModelProvider (activity.id).notifier);
2929
3030 user != null ? provider.getProfilePicture (user.id) : null ;
31- return user? .id;
31+
32+ if (user? .id != null ) {
33+ final profilePicture =
34+ ref.watch (profilePictureViewModelProvider (user! .id)).profilePicture;
35+ return profilePicture != null
36+ ? MemoryImage (profilePicture)
37+ : await ColorUtils .colorToImageProvider ((Colors .white70));
38+ }
39+ return await ColorUtils .colorToImageProvider (Colors .white70);
3240 });
3341
3442 final commentUserPictureDataProvider =
@@ -90,7 +98,6 @@ class ActivityComments extends HookConsumerWidget {
9098 overflow: TextOverflow .visible,
9199 ),
92100 ),
93- const Spacer (),
94101 if (currentUser.id == comment.user.id)
95102 IconButton (
96103 color: ColorUtils .black,
@@ -201,24 +208,14 @@ class ActivityComments extends HookConsumerWidget {
201208 height: state.comments.isNotEmpty ? 210 : 80 ,
202209 child: CommentBox (
203210 userImage: currentUserPictureProvider.when (
204- data: (userId) {
205- if (userId != null ) {
206- final profilePicture = ref
207- .watch (profilePictureViewModelProvider (userId))
208- .profilePicture;
209- return profilePicture != null
210- ? MemoryImage (profilePicture)
211- : null ;
212- }
213- return null ;
214- },
215- loading: () => null ,
216- error: (_, __) => null ,
217- ),
211+ data: (picture) {
212+ return picture;
213+ },
214+ loading: () => null ,
215+ error: (_, __) => null ),
218216 sendButtonMethod: () => commentsProvider.comment (currentActivity),
219217 formKey: formKey,
220218 commentController: commentsProvider.commentController,
221- backgroundColor: ColorUtils .white,
222219 textColor: ColorUtils .mainMedium,
223220 sendWidget:
224221 Icon (Icons .send_sharp, size: 30 , color: ColorUtils .main),
0 commit comments