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 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,