continuar a team_page
This commit is contained in:
@@ -3,23 +3,31 @@ class Team {
|
||||
final String name;
|
||||
final String season;
|
||||
final String imageUrl;
|
||||
final int playerCount; // NOVO: Campo para guardar o total
|
||||
|
||||
Team({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.season,
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.season,
|
||||
required this.imageUrl,
|
||||
this.playerCount = 0, // Valor padrão
|
||||
});
|
||||
|
||||
factory Team.fromFirestore(Map<String, dynamic> data, String id) {
|
||||
// Converte de Mapa (o formato da nossa "memória") para Objeto
|
||||
factory Team.fromMap(Map<String, dynamic> map) {
|
||||
return Team(
|
||||
id: id,
|
||||
name: data['name'] ?? '',
|
||||
season: data['season'] ?? '',
|
||||
imageUrl: data['imageUrl'] ?? '',
|
||||
playerCount: data['playerCount'] ?? 0, // Lê do Firebase
|
||||
id: map['id'] ?? '',
|
||||
name: map['name'] ?? '',
|
||||
season: map['season'] ?? '',
|
||||
imageUrl: map['image_url'] ?? '',
|
||||
);
|
||||
}
|
||||
|
||||
// Converte de Objeto para Mapa (para guardar na lista)
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'season': season,
|
||||
'image_url': imageUrl,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user