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