fazer pdf
This commit is contained in:
@@ -6,8 +6,8 @@ import '../controllers/team_controller.dart';
|
||||
import '../controllers/game_controller.dart';
|
||||
import '../models/game_model.dart';
|
||||
import '../utils/size_extension.dart';
|
||||
import 'pdf_export_service.dart';
|
||||
|
||||
// --- CARD DE EXIBIÇÃO DO JOGO ---
|
||||
class GameResultCard extends StatelessWidget {
|
||||
final String gameId, myTeam, opponentTeam, myScore, opponentScore, status, season;
|
||||
final String? myTeamLogo, opponentTeamLogo;
|
||||
@@ -44,13 +44,35 @@ class GameResultCard extends StatelessWidget {
|
||||
Expanded(child: _buildTeamInfo(opponentTeam, Colors.grey.shade600, opponentTeamLogo, sf, textColor)),
|
||||
],
|
||||
),
|
||||
|
||||
Positioned(
|
||||
top: -10 * sf,
|
||||
right: -10 * sf,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.delete_outline, color: Colors.grey.shade400, size: 22 * sf),
|
||||
splashRadius: 20 * sf,
|
||||
onPressed: () => _showDeleteConfirmation(context),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.picture_as_pdf, color: AppTheme.primaryRed.withOpacity(0.8), size: 22 * sf),
|
||||
splashRadius: 20 * sf,
|
||||
tooltip: 'Gerar PDF',
|
||||
onPressed: () async {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('A gerar PDF...'), duration: Duration(seconds: 1)));
|
||||
await PdfExportService.generateAndPrintBoxScore(
|
||||
gameId: gameId,
|
||||
myTeam: myTeam,
|
||||
opponentTeam: opponentTeam,
|
||||
myScore: myScore,
|
||||
opponentScore: opponentScore,
|
||||
season: season,
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete_outline, color: Colors.grey.shade400, size: 22 * sf),
|
||||
splashRadius: 20 * sf,
|
||||
tooltip: 'Eliminar Jogo',
|
||||
onPressed: () => _showDeleteConfirmation(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -141,7 +163,6 @@ class GameResultCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// --- POPUP DE CRIAÇÃO ---
|
||||
class CreateGameDialogManual extends StatefulWidget {
|
||||
final TeamController teamController;
|
||||
final GameController gameController;
|
||||
@@ -280,7 +301,6 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
}
|
||||
}
|
||||
|
||||
// --- PÁGINA PRINCIPAL DOS JOGOS ---
|
||||
class GamePage extends StatefulWidget {
|
||||
const GamePage({super.key});
|
||||
|
||||
@@ -347,13 +367,11 @@ class _GamePageState extends State<GamePage> {
|
||||
myTeamLogo: myLogo,
|
||||
opponentTeamLogo: oppLogo,
|
||||
sf: context.sf,
|
||||
onDelete: () async {
|
||||
onDelete: () async {
|
||||
bool success = await gameController.deleteGame(game.id);
|
||||
if (context.mounted) {
|
||||
if (success) {
|
||||
// 👇 ISTO FORÇA A LISTA A ATUALIZAR IMEDIATAMENTE 👇
|
||||
setState(() {});
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Jogo eliminado com sucesso!'), backgroundColor: Colors.green)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user