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,16 +58,16 @@ 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,
child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -83,21 +83,27 @@ class _UserTileLikesState extends State<UserTileLikes> {
maxRadius: 16, maxRadius: 16,
child: Icon(Icons.person), child: Icon(Icons.person),
), ),
Text('$shortDist km'), if (shortDist != null && !shortDist.isNaN)
Text('${shortDist.toStringAsFixed(0)} km'),
], ],
), ),
),
title: hasName title: hasName
? Text( ? GestureDetector(onTap: widget.onViewInfo,
child: Text(
'${widget.user[Constants.dbFieldUsersName]}', '${widget.user[Constants.dbFieldUsersName]}',
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
),
) )
: null, : null,
subtitle: hasBio subtitle: hasBio
? Text( ? GestureDetector(onTap: widget.onViewInfo,
child: Text(
widget.user[Constants.dbFieldUsersBio], widget.user[Constants.dbFieldUsersBio],
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 3, maxLines: 3,
),
) )
: null, : null,
trailing: Row( trailing: Row(