quero que ao voltar para o jogo ele esteja igual quando eu sai
This commit is contained in:
@@ -2,37 +2,37 @@ 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 season;
|
||||
final String status;
|
||||
final DateTime date;
|
||||
final String season;
|
||||
|
||||
Game({
|
||||
required this.id,
|
||||
required this.myTeam,
|
||||
required this.opponentTeam,
|
||||
this.myTeamLogo,
|
||||
this.opponentTeamLogo,
|
||||
required this.myScore,
|
||||
required this.opponentScore,
|
||||
required this.season,
|
||||
required this.status,
|
||||
required this.date,
|
||||
required this.season,
|
||||
});
|
||||
|
||||
// Converte dados do Supabase para o Objeto Dart
|
||||
// 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'] ?? 'Desconhecido',
|
||||
opponentTeam: map['opponent_team'] ?? 'Desconhecido',
|
||||
// Convertemos para String porque no DB é Integer, mas na UI usas String
|
||||
myScore: (map['my_score'] ?? 0).toString(),
|
||||
opponentScore: (map['opponent_score'] ?? 0).toString(),
|
||||
season: map['season'] ?? '',
|
||||
status: map['status'] ?? 'Brevemente',
|
||||
date: map['game_date'] != null
|
||||
? DateTime.parse(map['game_date'])
|
||||
: DateTime.now(),
|
||||
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'],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user