diff --git a/lib/components/user_tile_likes.dart b/lib/components/user_tile_likes.dart index d5250f8..f5f8cba 100644 --- a/lib/components/user_tile_likes.dart +++ b/lib/components/user_tile_likes.dart @@ -58,47 +58,53 @@ class _UserTileLikesState extends State { bool hasName = userMap.containsKey(Constants.dbFieldUsersName); bool hasBio = userMap.containsKey(Constants.dbFieldUsersBio); - String? shortDist = (_otherUser != null && widget.currentUser != null + double? shortDist = (_otherUser != null && widget.currentUser != null ? shortestDistanceBetweenUsers(widget.currentUser!, _otherUser!) - .toStringAsFixed(0) : null); return Card( color: Theme.of(context).colorScheme.onInverseSurface, margin: const EdgeInsets.all(8.0), child: ListTile( - leading: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - hasPictureUrl == true && - widget.user[Constants.dbFieldUsersProfilePic] != null - ? CircleAvatar( - maxRadius: 16, - backgroundImage: NetworkImage( - widget.user[Constants.dbFieldUsersProfilePic], + leading: GestureDetector(onTap: widget.onViewInfo, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + hasPictureUrl == true && + widget.user[Constants.dbFieldUsersProfilePic] != null + ? CircleAvatar( + maxRadius: 16, + backgroundImage: NetworkImage( + widget.user[Constants.dbFieldUsersProfilePic], + ), + ) + : const CircleAvatar( + maxRadius: 16, + child: Icon(Icons.person), ), - ) - : const CircleAvatar( - maxRadius: 16, - child: Icon(Icons.person), - ), - Text('$shortDist km'), - ], + if (shortDist != null && !shortDist.isNaN) + Text('${shortDist.toStringAsFixed(0)} km'), + ], + ), ), title: hasName - ? Text( - '${widget.user[Constants.dbFieldUsersName]}', - overflow: TextOverflow.ellipsis, - maxLines: 1, - ) + ? GestureDetector(onTap: widget.onViewInfo, + child: Text( + '${widget.user[Constants.dbFieldUsersName]}', + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ) : null, subtitle: hasBio - ? Text( - widget.user[Constants.dbFieldUsersBio], - overflow: TextOverflow.ellipsis, - maxLines: 3, - ) + ? GestureDetector(onTap: widget.onViewInfo, + child: Text( + widget.user[Constants.dbFieldUsersBio], + overflow: TextOverflow.ellipsis, + maxLines: 3, + ), + ) : null, trailing: Row( mainAxisSize: MainAxisSize.min,