vai te lixar github
This commit is contained in:
@@ -1,76 +1,91 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/pages/PlacarPage.dart';
|
||||
import '../controllers/game_controller.dart';
|
||||
import 'package:playmaker/classe/theme.dart';
|
||||
import '../controllers/team_controller.dart';
|
||||
import '../controllers/game_controller.dart';
|
||||
import '../models/game_model.dart';
|
||||
import '../utils/size_extension.dart'; // 👇 NOVO SUPERPODER AQUI TAMBÉM!
|
||||
import '../utils/size_extension.dart';
|
||||
|
||||
// --- CARD DE EXIBIÇÃO DO JOGO ---
|
||||
class GameResultCard extends StatelessWidget {
|
||||
final String gameId, myTeam, opponentTeam, myScore, opponentScore, status, season;
|
||||
final String? myTeamLogo, opponentTeamLogo;
|
||||
final String? myTeamLogo, opponentTeamLogo;
|
||||
final double sf;
|
||||
|
||||
const GameResultCard({
|
||||
super.key, required this.gameId, required this.myTeam, required this.opponentTeam,
|
||||
required this.myScore, required this.opponentScore, required this.status, required this.season,
|
||||
this.myTeamLogo, this.opponentTeamLogo,
|
||||
this.myTeamLogo, this.opponentTeamLogo, required this.sf,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bgColor = Theme.of(context).cardTheme.color;
|
||||
final textColor = Theme.of(context).colorScheme.onSurface;
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 16 * context.sf),
|
||||
padding: EdgeInsets.all(16 * context.sf),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(20 * context.sf), boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 10 * context.sf)]),
|
||||
margin: EdgeInsets.only(bottom: 16 * sf),
|
||||
padding: EdgeInsets.all(16 * sf),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(20 * sf),
|
||||
boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 10 * sf)],
|
||||
border: Border.all(color: Colors.grey.withOpacity(0.1)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(child: _buildTeamInfo(context, myTeam, const Color(0xFFE74C3C), myTeamLogo)),
|
||||
_buildScoreCenter(context, gameId),
|
||||
Expanded(child: _buildTeamInfo(context, opponentTeam, Colors.black87, opponentTeamLogo)),
|
||||
Expanded(child: _buildTeamInfo(myTeam, AppTheme.primaryRed, myTeamLogo, sf, textColor)),
|
||||
_buildScoreCenter(context, gameId, sf, textColor),
|
||||
Expanded(child: _buildTeamInfo(opponentTeam, Colors.grey.shade600, opponentTeamLogo, sf, textColor)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTeamInfo(BuildContext context, String name, Color color, String? logoUrl) {
|
||||
Widget _buildTeamInfo(String name, Color color, String? logoUrl, double sf, Color textColor) {
|
||||
return Column(
|
||||
children: [
|
||||
CircleAvatar(radius: 24 * context.sf, backgroundColor: color, backgroundImage: (logoUrl != null && logoUrl.isNotEmpty) ? NetworkImage(logoUrl) : null, child: (logoUrl == null || logoUrl.isEmpty) ? Icon(Icons.shield, color: Colors.white, size: 24 * context.sf) : null),
|
||||
SizedBox(height: 6 * context.sf),
|
||||
Text(name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 13 * context.sf), textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, maxLines: 2),
|
||||
CircleAvatar(
|
||||
radius: 24 * sf,
|
||||
backgroundColor: color,
|
||||
backgroundImage: (logoUrl != null && logoUrl.isNotEmpty) ? NetworkImage(logoUrl) : null,
|
||||
child: (logoUrl == null || logoUrl.isEmpty) ? Icon(Icons.shield, color: Colors.white, size: 24 * sf) : null,
|
||||
),
|
||||
SizedBox(height: 6 * sf),
|
||||
Text(name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 13 * sf, color: textColor), textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, maxLines: 2),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildScoreCenter(BuildContext context, String id) {
|
||||
Widget _buildScoreCenter(BuildContext context, String id, double sf, Color textColor) {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_scoreBox(context, myScore, Colors.green),
|
||||
Text(" : ", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 22 * context.sf)),
|
||||
_scoreBox(context, opponentScore, Colors.grey),
|
||||
_scoreBox(myScore, AppTheme.successGreen, sf),
|
||||
Text(" : ", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 22 * sf, color: textColor)),
|
||||
_scoreBox(opponentScore, Colors.grey, sf),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10 * context.sf),
|
||||
SizedBox(height: 10 * sf),
|
||||
TextButton.icon(
|
||||
onPressed: () => Navigator.push(context, MaterialPageRoute(builder: (context) => PlacarPage(gameId: id, myTeam: myTeam, opponentTeam: opponentTeam))),
|
||||
icon: Icon(Icons.play_circle_fill, size: 18 * context.sf, color: const Color(0xFFE74C3C)),
|
||||
label: Text("RETORNAR", style: TextStyle(fontSize: 11 * context.sf, color: const Color(0xFFE74C3C), fontWeight: FontWeight.bold)),
|
||||
style: TextButton.styleFrom(backgroundColor: const Color(0xFFE74C3C).withOpacity(0.1), padding: EdgeInsets.symmetric(horizontal: 14 * context.sf, vertical: 8 * context.sf), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20 * context.sf)), visualDensity: VisualDensity.compact),
|
||||
icon: Icon(Icons.play_circle_fill, size: 18 * sf, color: AppTheme.primaryRed),
|
||||
label: Text("RETORNAR", style: TextStyle(fontSize: 11 * sf, color: AppTheme.primaryRed, fontWeight: FontWeight.bold)),
|
||||
style: TextButton.styleFrom(backgroundColor: AppTheme.primaryRed.withOpacity(0.1), padding: EdgeInsets.symmetric(horizontal: 14 * sf, vertical: 8 * sf), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20 * sf)), visualDensity: VisualDensity.compact),
|
||||
),
|
||||
SizedBox(height: 6 * context.sf),
|
||||
Text(status, style: TextStyle(fontSize: 12 * context.sf, color: Colors.blue, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 6 * sf),
|
||||
Text(status, style: TextStyle(fontSize: 12 * sf, color: Colors.blue, fontWeight: FontWeight.bold)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _scoreBox(BuildContext context, String pts, Color c) => Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12 * context.sf, vertical: 6 * context.sf),
|
||||
decoration: BoxDecoration(color: c, borderRadius: BorderRadius.circular(8 * context.sf)),
|
||||
child: Text(pts, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 16 * context.sf)),
|
||||
Widget _scoreBox(String pts, Color c, double sf) => Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12 * sf, vertical: 6 * sf),
|
||||
decoration: BoxDecoration(color: c, borderRadius: BorderRadius.circular(8 * sf)),
|
||||
child: Text(pts, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 16 * sf)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -78,8 +93,9 @@ class GameResultCard extends StatelessWidget {
|
||||
class CreateGameDialogManual extends StatefulWidget {
|
||||
final TeamController teamController;
|
||||
final GameController gameController;
|
||||
final double sf;
|
||||
|
||||
const CreateGameDialogManual({super.key, required this.teamController, required this.gameController});
|
||||
const CreateGameDialogManual({super.key, required this.teamController, required this.gameController, required this.sf});
|
||||
|
||||
@override
|
||||
State<CreateGameDialogManual> createState() => _CreateGameDialogManualState();
|
||||
@@ -105,24 +121,29 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20 * context.sf)),
|
||||
title: Text('Configurar Partida', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18 * context.sf)),
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20 * widget.sf)),
|
||||
title: Text('Configurar Partida', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18 * widget.sf, color: Theme.of(context).colorScheme.onSurface)),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(controller: _seasonController, style: TextStyle(fontSize: 14 * context.sf), decoration: InputDecoration(labelText: 'Temporada', labelStyle: TextStyle(fontSize: 14 * context.sf), border: const OutlineInputBorder(), prefixIcon: Icon(Icons.calendar_today, size: 20 * context.sf))),
|
||||
SizedBox(height: 15 * context.sf),
|
||||
TextField(
|
||||
controller: _seasonController,
|
||||
style: TextStyle(fontSize: 14 * widget.sf, color: Theme.of(context).colorScheme.onSurface),
|
||||
decoration: InputDecoration(labelText: 'Temporada', labelStyle: TextStyle(fontSize: 14 * widget.sf), border: const OutlineInputBorder(), prefixIcon: Icon(Icons.calendar_today, size: 20 * widget.sf))
|
||||
),
|
||||
SizedBox(height: 15 * widget.sf),
|
||||
_buildSearch(context, "Minha Equipa", _myTeamController),
|
||||
Padding(padding: EdgeInsets.symmetric(vertical: 10 * context.sf), child: Text("VS", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 16 * context.sf))),
|
||||
Padding(padding: EdgeInsets.symmetric(vertical: 10 * widget.sf), child: Text("VS", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey, fontSize: 16 * widget.sf))),
|
||||
_buildSearch(context, "Adversário", _opponentController),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: Text('CANCELAR', style: TextStyle(fontSize: 14 * context.sf))),
|
||||
TextButton(onPressed: () => Navigator.pop(context), child: Text('CANCELAR', style: TextStyle(fontSize: 14 * widget.sf, color: Colors.grey))),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFFE74C3C), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10 * context.sf)), padding: EdgeInsets.symmetric(horizontal: 16 * context.sf, vertical: 10 * context.sf)),
|
||||
style: ElevatedButton.styleFrom(backgroundColor: AppTheme.primaryRed, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10 * widget.sf)), padding: EdgeInsets.symmetric(horizontal: 16 * widget.sf, vertical: 10 * widget.sf)),
|
||||
onPressed: _isLoading ? null : () async {
|
||||
if (_myTeamController.text.isNotEmpty && _opponentController.text.isNotEmpty) {
|
||||
setState(() => _isLoading = true);
|
||||
@@ -134,7 +155,7 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
}
|
||||
}
|
||||
},
|
||||
child: _isLoading ? SizedBox(width: 20 * context.sf, height: 20 * context.sf, child: const CircularProgressIndicator(color: Colors.white, strokeWidth: 2)) : Text('CRIAR', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14 * context.sf)),
|
||||
child: _isLoading ? SizedBox(width: 20 * widget.sf, height: 20 * widget.sf, child: const CircularProgressIndicator(color: Colors.white, strokeWidth: 2)) : Text('CRIAR', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14 * widget.sf)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -156,9 +177,10 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
return Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Material(
|
||||
elevation: 4.0, borderRadius: BorderRadius.circular(8 * context.sf),
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
elevation: 4.0, borderRadius: BorderRadius.circular(8 * widget.sf),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: 250 * context.sf, maxWidth: MediaQuery.of(context).size.width * 0.7),
|
||||
constraints: BoxConstraints(maxHeight: 250 * widget.sf, maxWidth: MediaQuery.of(context).size.width * 0.7),
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero, shrinkWrap: true, itemCount: options.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
@@ -166,8 +188,8 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
final String name = option['name'].toString();
|
||||
final String? imageUrl = option['image_url'];
|
||||
return ListTile(
|
||||
leading: CircleAvatar(radius: 20 * context.sf, backgroundColor: Colors.grey.shade200, backgroundImage: (imageUrl != null && imageUrl.isNotEmpty) ? NetworkImage(imageUrl) : null, child: (imageUrl == null || imageUrl.isEmpty) ? Icon(Icons.shield, color: Colors.grey, size: 20 * context.sf) : null),
|
||||
title: Text(name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14 * context.sf)),
|
||||
leading: CircleAvatar(radius: 20 * widget.sf, backgroundColor: Colors.grey.withOpacity(0.2), backgroundImage: (imageUrl != null && imageUrl.isNotEmpty) ? NetworkImage(imageUrl) : null, child: (imageUrl == null || imageUrl.isEmpty) ? Icon(Icons.shield, color: Colors.grey, size: 20 * widget.sf) : null),
|
||||
title: Text(name, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14 * widget.sf, color: Theme.of(context).colorScheme.onSurface)),
|
||||
onTap: () { onSelected(option); },
|
||||
);
|
||||
},
|
||||
@@ -180,8 +202,9 @@ class _CreateGameDialogManualState extends State<CreateGameDialogManual> {
|
||||
if (txtCtrl.text.isEmpty && controller.text.isNotEmpty) txtCtrl.text = controller.text;
|
||||
txtCtrl.addListener(() { controller.text = txtCtrl.text; });
|
||||
return TextField(
|
||||
controller: txtCtrl, focusNode: node, style: TextStyle(fontSize: 14 * context.sf),
|
||||
decoration: InputDecoration(labelText: label, labelStyle: TextStyle(fontSize: 14 * context.sf), prefixIcon: Icon(Icons.search, size: 20 * context.sf), border: const OutlineInputBorder()),
|
||||
controller: txtCtrl, focusNode: node,
|
||||
style: TextStyle(fontSize: 14 * widget.sf, color: Theme.of(context).colorScheme.onSurface),
|
||||
decoration: InputDecoration(labelText: label, labelStyle: TextStyle(fontSize: 14 * widget.sf), prefixIcon: Icon(Icons.search, size: 20 * widget.sf, color: AppTheme.primaryRed)),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -209,16 +232,16 @@ class _GamePageState extends State<GamePage> {
|
||||
bool isFilterActive = selectedSeason != 'Todas' || selectedTeam != 'Todas';
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF5F7FA),
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
appBar: AppBar(
|
||||
title: Text("Jogos", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20 * context.sf)),
|
||||
backgroundColor: Colors.white,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 8.0 * context.sf),
|
||||
child: IconButton(
|
||||
icon: Icon(isFilterActive ? Icons.filter_list_alt : Icons.filter_list, color: isFilterActive ? const Color(0xFFE74C3C) : Colors.black87, size: 26 * context.sf),
|
||||
icon: Icon(isFilterActive ? Icons.filter_list_alt : Icons.filter_list, color: isFilterActive ? AppTheme.primaryRed : Theme.of(context).colorScheme.onSurface, size: 26 * context.sf),
|
||||
onPressed: () => _showFilterPopup(context),
|
||||
),
|
||||
)
|
||||
@@ -232,9 +255,9 @@ class _GamePageState extends State<GamePage> {
|
||||
stream: gameController.getFilteredGames(teamFilter: selectedTeam, seasonFilter: selectedSeason),
|
||||
builder: (context, gameSnapshot) {
|
||||
if (gameSnapshot.connectionState == ConnectionState.waiting && teamsList.isEmpty) return const Center(child: CircularProgressIndicator());
|
||||
if (gameSnapshot.hasError) return Center(child: Text("Erro: ${gameSnapshot.error}", style: TextStyle(fontSize: 14 * context.sf)));
|
||||
if (gameSnapshot.hasError) return Center(child: Text("Erro: ${gameSnapshot.error}", style: TextStyle(fontSize: 14 * context.sf, color: Theme.of(context).colorScheme.onSurface)));
|
||||
if (!gameSnapshot.hasData || gameSnapshot.data!.isEmpty) {
|
||||
return Center(child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [Icon(Icons.search_off, size: 48 * context.sf, color: Colors.grey.shade300), SizedBox(height: 10 * context.sf), Text("Nenhum jogo encontrado.", style: TextStyle(fontSize: 14 * context.sf, color: Colors.grey.shade600))]));
|
||||
return Center(child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [Icon(Icons.search_off, size: 48 * context.sf, color: Colors.grey.withOpacity(0.3)), SizedBox(height: 10 * context.sf), Text("Nenhum jogo encontrado.", style: TextStyle(fontSize: 14 * context.sf, color: Colors.grey))]));
|
||||
}
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.all(16 * context.sf),
|
||||
@@ -249,6 +272,7 @@ class _GamePageState extends State<GamePage> {
|
||||
return GameResultCard(
|
||||
gameId: game.id, myTeam: game.myTeam, opponentTeam: game.opponentTeam, myScore: game.myScore,
|
||||
opponentScore: game.opponentScore, status: game.status, season: game.season, myTeamLogo: myLogo, opponentTeamLogo: oppLogo,
|
||||
sf: context.sf,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -257,10 +281,10 @@ class _GamePageState extends State<GamePage> {
|
||||
},
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
heroTag: 'add_game_btn', // 👇 A MÁGICA ESTÁ AQUI TAMBÉM!
|
||||
backgroundColor: const Color(0xFFE74C3C),
|
||||
heroTag: 'add_game_btn',
|
||||
backgroundColor: AppTheme.primaryRed,
|
||||
child: Icon(Icons.add, color: Colors.white, size: 24 * context.sf),
|
||||
onPressed: () => showDialog(context: context, builder: (context) => CreateGameDialogManual(teamController: teamController, gameController: gameController)),
|
||||
onPressed: () => showDialog(context: context, builder: (context) => CreateGameDialogManual(teamController: teamController, gameController: gameController, sf: context.sf)),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -274,34 +298,36 @@ class _GamePageState extends State<GamePage> {
|
||||
return StatefulBuilder(
|
||||
builder: (context, setPopupState) {
|
||||
return AlertDialog(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20 * context.sf)),
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('Filtrar Jogos', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18 * context.sf)),
|
||||
Text('Filtrar Jogos', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18 * context.sf, color: Theme.of(context).colorScheme.onSurface)),
|
||||
IconButton(icon: const Icon(Icons.close, color: Colors.grey), onPressed: () => Navigator.pop(context), padding: EdgeInsets.zero, constraints: const BoxConstraints())
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Temporada", style: TextStyle(fontSize: 12 * context.sf, color: Colors.grey.shade600, fontWeight: FontWeight.bold)),
|
||||
Text("Temporada", style: TextStyle(fontSize: 12 * context.sf, color: Colors.grey, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 6 * context.sf),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12 * context.sf), decoration: BoxDecoration(color: Colors.grey.shade100, borderRadius: BorderRadius.circular(10 * context.sf)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 12 * context.sf), decoration: BoxDecoration(color: Theme.of(context).cardTheme.color, borderRadius: BorderRadius.circular(10 * context.sf), border: Border.all(color: Colors.grey.withOpacity(0.2))),
|
||||
child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
isExpanded: true, value: tempSeason, style: TextStyle(fontSize: 14 * context.sf, color: Colors.black87, fontWeight: FontWeight.bold),
|
||||
dropdownColor: Theme.of(context).colorScheme.surface,
|
||||
isExpanded: true, value: tempSeason, style: TextStyle(fontSize: 14 * context.sf, color: Theme.of(context).colorScheme.onSurface, fontWeight: FontWeight.bold),
|
||||
items: ['Todas', '2024/25', '2025/26'].map((String value) => DropdownMenuItem<String>(value: value, child: Text(value))).toList(),
|
||||
onChanged: (newValue) => setPopupState(() => tempSeason = newValue!),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20 * context.sf),
|
||||
Text("Equipa", style: TextStyle(fontSize: 12 * context.sf, color: Colors.grey.shade600, fontWeight: FontWeight.bold)),
|
||||
Text("Equipa", style: TextStyle(fontSize: 12 * context.sf, color: Colors.grey, fontWeight: FontWeight.bold)),
|
||||
SizedBox(height: 6 * context.sf),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12 * context.sf), decoration: BoxDecoration(color: Colors.grey.shade100, borderRadius: BorderRadius.circular(10 * context.sf)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 12 * context.sf), decoration: BoxDecoration(color: Theme.of(context).cardTheme.color, borderRadius: BorderRadius.circular(10 * context.sf), border: Border.all(color: Colors.grey.withOpacity(0.2))),
|
||||
child: StreamBuilder<List<Map<String, dynamic>>>(
|
||||
stream: teamController.teamsStream,
|
||||
builder: (context, snapshot) {
|
||||
@@ -310,7 +336,8 @@ class _GamePageState extends State<GamePage> {
|
||||
if (!teamNames.contains(tempTeam)) tempTeam = 'Todas';
|
||||
return DropdownButtonHideUnderline(
|
||||
child: DropdownButton<String>(
|
||||
isExpanded: true, value: tempTeam, style: TextStyle(fontSize: 14 * context.sf, color: Colors.black87, fontWeight: FontWeight.bold),
|
||||
dropdownColor: Theme.of(context).colorScheme.surface,
|
||||
isExpanded: true, value: tempTeam, style: TextStyle(fontSize: 14 * context.sf, color: Theme.of(context).colorScheme.onSurface, fontWeight: FontWeight.bold),
|
||||
items: teamNames.map((String value) => DropdownMenuItem<String>(value: value, child: Text(value, overflow: TextOverflow.ellipsis))).toList(),
|
||||
onChanged: (newValue) => setPopupState(() => tempTeam = newValue!),
|
||||
),
|
||||
@@ -322,7 +349,7 @@ class _GamePageState extends State<GamePage> {
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () { setState(() { selectedSeason = 'Todas'; selectedTeam = 'Todas'; }); Navigator.pop(context); }, child: Text('LIMPAR', style: TextStyle(fontSize: 12 * context.sf, color: Colors.grey))),
|
||||
ElevatedButton(style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFFE74C3C), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10 * context.sf))), onPressed: () { setState(() { selectedSeason = tempSeason; selectedTeam = tempTeam; }); Navigator.pop(context); }, child: Text('APLICAR', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 13 * context.sf))),
|
||||
ElevatedButton(style: ElevatedButton.styleFrom(backgroundColor: AppTheme.primaryRed, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10 * context.sf))), onPressed: () { setState(() { selectedSeason = tempSeason; selectedTeam = tempTeam; }); Navigator.pop(context); }, child: Text('APLICAR', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 13 * context.sf))),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user