esta melhor des que comecei
This commit is contained in:
@@ -2,8 +2,6 @@ class Game {
|
||||
final String id;
|
||||
final String myTeam;
|
||||
final String opponentTeam;
|
||||
final String? myTeamLogo; // URL da imagem
|
||||
final String? opponentTeamLogo; // URL da imagem
|
||||
final String myScore;
|
||||
final String opponentScore;
|
||||
final String status;
|
||||
@@ -13,26 +11,22 @@ class Game {
|
||||
required this.id,
|
||||
required this.myTeam,
|
||||
required this.opponentTeam,
|
||||
this.myTeamLogo,
|
||||
this.opponentTeamLogo,
|
||||
required this.myScore,
|
||||
required this.opponentScore,
|
||||
required this.status,
|
||||
required this.season,
|
||||
});
|
||||
|
||||
// No seu factory, certifique-se de mapear os campos da tabela (ou de um JOIN)
|
||||
factory Game.fromMap(Map<String, dynamic> map) {
|
||||
return Game(
|
||||
id: map['id'],
|
||||
myTeam: map['my_team_name'],
|
||||
opponentTeam: map['opponent_team_name'],
|
||||
myTeamLogo: map['my_team_logo'], // Certifique-se que o Supabase retorna isto
|
||||
opponentTeamLogo: map['opponent_team_logo'],
|
||||
myScore: map['my_score'].toString(),
|
||||
opponentScore: map['opponent_score'].toString(),
|
||||
status: map['status'],
|
||||
season: map['season'],
|
||||
// O "?." converte para texto com segurança, e o "?? '...'" diz o que mostrar se for nulo (vazio)
|
||||
id: map['id']?.toString() ?? '',
|
||||
myTeam: map['my_team']?.toString() ?? 'Desconhecida',
|
||||
opponentTeam: map['opponent_team']?.toString() ?? 'Adversário',
|
||||
myScore: map['my_score']?.toString() ?? '0',
|
||||
opponentScore: map['opponent_score']?.toString() ?? '0',
|
||||
status: map['status']?.toString() ?? 'Terminado',
|
||||
season: map['season']?.toString() ?? 'Sem Época',
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user