limit team members to 4 and display member count in list
This commit is contained in:
@@ -4,6 +4,7 @@ class Team {
|
||||
final String tag;
|
||||
final String description;
|
||||
final String createdAt;
|
||||
final int? memberCount;
|
||||
|
||||
Team({
|
||||
required this.id,
|
||||
@@ -11,6 +12,7 @@ class Team {
|
||||
required this.tag,
|
||||
required this.description,
|
||||
required this.createdAt,
|
||||
this.memberCount,
|
||||
});
|
||||
|
||||
factory Team.fromJson(Map<String, dynamic> json) {
|
||||
@@ -20,6 +22,7 @@ class Team {
|
||||
tag: json['tag'] as String,
|
||||
description: (json['description'] as String?) ?? '',
|
||||
createdAt: (json['createdAt'] as String?) ?? '',
|
||||
memberCount: json['memberCount'] as int?,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,6 +33,7 @@ class Team {
|
||||
'tag': tag,
|
||||
'description': description,
|
||||
'createdAt': createdAt,
|
||||
if (memberCount != null) 'memberCount': memberCount,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,10 @@ class TeamListItem extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final memberCountText = team.memberCount != null
|
||||
? '${team.memberCount}/4 members'
|
||||
: 'No members';
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: ListTile(
|
||||
@@ -135,7 +139,21 @@ class TeamListItem extends StatelessWidget {
|
||||
child: Text(team.tag),
|
||||
),
|
||||
title: Text(team.name),
|
||||
subtitle: Text(team.description.isEmpty ? 'No description' : team.description),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(team.description.isEmpty ? 'No description' : team.description),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
memberCountText,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
isThreeLine: true,
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user