GestureDetector for UserTileLikes

master
Rafael 2024-06-18 23:45:24 +02:00
parent 46b3b99cc6
commit f23f2b9bf1
1 changed files with 35 additions and 29 deletions

View File

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