melhorar o sensor de calor
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/controllers/login_controller.dart';
|
||||
import 'package:playmaker/pages/RegisterPage.dart';
|
||||
import '../utils/size_extension.dart'; // 👇 O NOSSO SUPERPODER!
|
||||
import '../utils/size_extension.dart';
|
||||
import 'dart:math' as math; // 👇 IMPORTANTE PARA O TRAVÃO NO TABLET!
|
||||
|
||||
class BasketTrackHeader extends StatelessWidget {
|
||||
const BasketTrackHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double safeSf = math.min(context.sf, 1.15); // TRAVÃO DE MÃO
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 200 * context.sf, // Ajusta o tamanho da imagem suavemente
|
||||
height: 200 * context.sf,
|
||||
width: 200 * safeSf,
|
||||
height: 200 * safeSf,
|
||||
child: Image.asset(
|
||||
'assets/playmaker-logos.png',
|
||||
fit: BoxFit.contain,
|
||||
@@ -21,16 +24,16 @@ class BasketTrackHeader extends StatelessWidget {
|
||||
Text(
|
||||
'BasketTrack',
|
||||
style: TextStyle(
|
||||
fontSize: 36 * context.sf,
|
||||
fontSize: 36 * safeSf,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey[900],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6 * context.sf),
|
||||
SizedBox(height: 6 * safeSf),
|
||||
Text(
|
||||
'Gere as tuas equipas e estatísticas',
|
||||
style: TextStyle(
|
||||
fontSize: 16 * context.sf,
|
||||
fontSize: 16 * safeSf,
|
||||
color: Colors.grey[600],
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -48,40 +51,42 @@ class LoginFormFields extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double safeSf = math.min(context.sf, 1.15);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: controller.emailController,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'E-mail',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.email_outlined, size: 22 * context.sf),
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.email_outlined, size: 22 * safeSf),
|
||||
errorText: controller.emailError,
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
),
|
||||
SizedBox(height: 20 * context.sf),
|
||||
SizedBox(height: 20 * safeSf),
|
||||
TextField(
|
||||
controller: controller.passwordController,
|
||||
obscureText: controller.obscurePassword,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.lock_outlined, size: 22 * context.sf),
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.lock_outlined, size: 22 * safeSf),
|
||||
errorText: controller.passwordError,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
controller.obscurePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined,
|
||||
size: 22 * context.sf
|
||||
size: 22 * safeSf
|
||||
),
|
||||
onPressed: controller.togglePasswordVisibility,
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -97,9 +102,11 @@ class LoginButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double safeSf = math.min(context.sf, 1.15);
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 58 * context.sf,
|
||||
height: 58 * safeSf,
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.isLoading ? null : () async {
|
||||
final success = await controller.login();
|
||||
@@ -108,15 +115,15 @@ class LoginButton extends StatelessWidget {
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFE74C3C),
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14 * context.sf)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14 * safeSf)),
|
||||
elevation: 3,
|
||||
),
|
||||
child: controller.isLoading
|
||||
? SizedBox(
|
||||
width: 28 * context.sf, height: 28 * context.sf,
|
||||
width: 28 * safeSf, height: 28 * safeSf,
|
||||
child: const CircularProgressIndicator(strokeWidth: 3, valueColor: AlwaysStoppedAnimation<Color>(Colors.white)),
|
||||
)
|
||||
: Text('Entrar', style: TextStyle(fontSize: 18 * context.sf, fontWeight: FontWeight.bold)),
|
||||
: Text('Entrar', style: TextStyle(fontSize: 18 * safeSf, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -127,19 +134,21 @@ class CreateAccountButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double safeSf = math.min(context.sf, 1.15);
|
||||
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 58 * context.sf,
|
||||
height: 58 * safeSf,
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const RegisterPage()));
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: const Color(0xFFE74C3C),
|
||||
side: BorderSide(color: const Color(0xFFE74C3C), width: 2 * context.sf),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14 * context.sf)),
|
||||
side: BorderSide(color: const Color(0xFFE74C3C), width: 2 * safeSf),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14 * safeSf)),
|
||||
),
|
||||
child: Text('Criar Conta', style: TextStyle(fontSize: 18 * context.sf, fontWeight: FontWeight.bold)),
|
||||
child: Text('Criar Conta', style: TextStyle(fontSize: 18 * safeSf, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../controllers/register_controller.dart';
|
||||
import '../utils/size_extension.dart'; // 👇 O NOSSO SUPERPODER!
|
||||
import '../utils/size_extension.dart';
|
||||
import 'dart:math' as math; // 👇 IMPORTANTE
|
||||
|
||||
class RegisterHeader extends StatelessWidget {
|
||||
const RegisterHeader({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final double safeSf = math.min(context.sf, 1.15); // TRAVÃO
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Icon(Icons.person_add_outlined, size: 100 * context.sf, color: const Color(0xFFE74C3C)),
|
||||
SizedBox(height: 10 * context.sf),
|
||||
Icon(Icons.person_add_outlined, size: 100 * safeSf, color: const Color(0xFFE74C3C)),
|
||||
SizedBox(height: 10 * safeSf),
|
||||
Text(
|
||||
'Nova Conta',
|
||||
style: TextStyle(fontSize: 36 * context.sf, fontWeight: FontWeight.bold, color: Colors.grey[900]),
|
||||
style: TextStyle(fontSize: 36 * safeSf, fontWeight: FontWeight.bold, color: Colors.grey[900]),
|
||||
),
|
||||
SizedBox(height: 5 * context.sf),
|
||||
SizedBox(height: 5 * safeSf),
|
||||
Text(
|
||||
'Cria o teu perfil no BasketTrack',
|
||||
style: TextStyle(fontSize: 16 * context.sf, color: Colors.grey[600], fontWeight: FontWeight.w500),
|
||||
style: TextStyle(fontSize: 16 * safeSf, color: Colors.grey[600], fontWeight: FontWeight.w500),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
@@ -39,71 +42,76 @@ class _RegisterFormFieldsState extends State<RegisterFormFields> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Form(
|
||||
key: widget.controller.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: widget.controller.nameController,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Nome Completo',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.person_outline, size: 22 * context.sf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20 * context.sf),
|
||||
final double safeSf = math.min(context.sf, 1.15); // TRAVÃO
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.emailController,
|
||||
validator: widget.controller.validateEmail,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'E-mail',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.email_outlined, size: 22 * context.sf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
),
|
||||
SizedBox(height: 20 * context.sf),
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.passwordController,
|
||||
obscureText: _obscurePassword,
|
||||
validator: widget.controller.validatePassword,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.lock_outlined, size: 22 * context.sf),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_obscurePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined, size: 22 * context.sf),
|
||||
onPressed: () => setState(() => _obscurePassword = !_obscurePassword),
|
||||
return Container(
|
||||
constraints: BoxConstraints(maxWidth: 450 * safeSf), // LIMITA A LARGURA NO TABLET
|
||||
child: Form(
|
||||
key: widget.controller.formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: widget.controller.nameController,
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Nome Completo',
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.person_outline, size: 22 * safeSf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20 * context.sf),
|
||||
SizedBox(height: 20 * safeSf),
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.confirmPasswordController,
|
||||
obscureText: _obscurePassword,
|
||||
validator: widget.controller.validateConfirmPassword,
|
||||
style: TextStyle(fontSize: 15 * context.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Confirmar Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * context.sf),
|
||||
prefixIcon: Icon(Icons.lock_clock_outlined, size: 22 * context.sf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * context.sf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * context.sf, horizontal: 16 * context.sf),
|
||||
TextFormField(
|
||||
controller: widget.controller.emailController,
|
||||
validator: widget.controller.validateEmail,
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'E-mail',
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.email_outlined, size: 22 * safeSf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
),
|
||||
),
|
||||
],
|
||||
SizedBox(height: 20 * safeSf),
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.passwordController,
|
||||
obscureText: _obscurePassword,
|
||||
validator: widget.controller.validatePassword,
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.lock_outlined, size: 22 * safeSf),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(_obscurePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined, size: 22 * safeSf),
|
||||
onPressed: () => setState(() => _obscurePassword = !_obscurePassword),
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20 * safeSf),
|
||||
|
||||
TextFormField(
|
||||
controller: widget.controller.confirmPasswordController,
|
||||
obscureText: _obscurePassword,
|
||||
validator: widget.controller.validateConfirmPassword,
|
||||
style: TextStyle(fontSize: 15 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Confirmar Palavra-passe',
|
||||
labelStyle: TextStyle(fontSize: 15 * safeSf),
|
||||
prefixIcon: Icon(Icons.lock_clock_outlined, size: 22 * safeSf),
|
||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12 * safeSf)),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 18 * safeSf, horizontal: 16 * safeSf),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -115,23 +123,25 @@ class RegisterButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 58 * context.sf,
|
||||
final double safeSf = math.min(context.sf, 1.15); // TRAVÃO
|
||||
|
||||
return Container(
|
||||
constraints: BoxConstraints(maxWidth: 450 * safeSf), // LIMITA LARGURA
|
||||
height: 58 * safeSf,
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.isLoading ? null : () => controller.signUp(context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFE74C3C),
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14 * context.sf)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14 * safeSf)),
|
||||
elevation: 3,
|
||||
),
|
||||
child: controller.isLoading
|
||||
? SizedBox(
|
||||
width: 28 * context.sf, height: 28 * context.sf,
|
||||
width: 28 * safeSf, height: 28 * safeSf,
|
||||
child: const CircularProgressIndicator(strokeWidth: 3, valueColor: AlwaysStoppedAnimation<Color>(Colors.white)),
|
||||
)
|
||||
: Text('Criar Conta', style: TextStyle(fontSize: 18 * context.sf, fontWeight: FontWeight.bold)),
|
||||
: Text('Criar Conta', style: TextStyle(fontSize: 18 * safeSf, fontWeight: FontWeight.bold)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:playmaker/screens/team_stats_page.dart';
|
||||
import '../models/team_model.dart';
|
||||
import '../controllers/team_controller.dart';
|
||||
import 'dart:math' as math; // 👇 IMPORTANTE PARA O TRAVÃO DE MÃO
|
||||
|
||||
class TeamCard extends StatelessWidget {
|
||||
final Team team;
|
||||
final TeamController controller;
|
||||
final VoidCallback onFavoriteTap;
|
||||
final double sf; // <-- Variável de escala
|
||||
final double sf; // <-- Variável de escala original
|
||||
|
||||
const TeamCard({
|
||||
super.key,
|
||||
@@ -19,20 +20,24 @@ class TeamCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 👇 O SEGREDO ESTÁ AQUI: TRAVÃO DE MÃO PARA TABLETS 👇
|
||||
// O sf pode crescer, mas NUNCA vai ser maior que 1.15!
|
||||
final double safeSf = math.min(sf, 1.15);
|
||||
|
||||
return Card(
|
||||
color: Colors.white,
|
||||
elevation: 3,
|
||||
margin: EdgeInsets.only(bottom: 12 * sf),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15 * sf)),
|
||||
margin: EdgeInsets.only(bottom: 12 * safeSf),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15 * safeSf)),
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16 * sf, vertical: 8 * sf),
|
||||
contentPadding: EdgeInsets.symmetric(horizontal: 16 * safeSf, vertical: 8 * safeSf),
|
||||
|
||||
// --- 1. IMAGEM + FAVORITO ---
|
||||
leading: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 28 * sf,
|
||||
radius: 28 * safeSf,
|
||||
backgroundColor: Colors.grey[200],
|
||||
backgroundImage: (team.imageUrl.isNotEmpty && team.imageUrl.startsWith('http'))
|
||||
? NetworkImage(team.imageUrl)
|
||||
@@ -40,22 +45,22 @@ class TeamCard extends StatelessWidget {
|
||||
child: (team.imageUrl.isEmpty || !team.imageUrl.startsWith('http'))
|
||||
? Text(
|
||||
team.imageUrl.isEmpty ? "🏀" : team.imageUrl,
|
||||
style: TextStyle(fontSize: 24 * sf),
|
||||
style: TextStyle(fontSize: 24 * safeSf),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
Positioned(
|
||||
left: -15 * sf,
|
||||
top: -10 * sf,
|
||||
left: -15 * safeSf,
|
||||
top: -10 * safeSf,
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
team.isFavorite ? Icons.star : Icons.star_border,
|
||||
color: team.isFavorite ? Colors.amber : Colors.black.withOpacity(0.1),
|
||||
size: 28 * sf,
|
||||
size: 28 * safeSf,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black.withOpacity(team.isFavorite ? 0.3 : 0.1),
|
||||
blurRadius: 4 * sf,
|
||||
blurRadius: 4 * safeSf,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -68,40 +73,39 @@ class TeamCard extends StatelessWidget {
|
||||
// --- 2. TÍTULO ---
|
||||
title: Text(
|
||||
team.name,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16 * sf),
|
||||
overflow: TextOverflow.ellipsis, // Previne overflows em nomes longos
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16 * safeSf),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
// --- 3. SUBTÍTULO (Contagem + Época em TEMPO REAL) ---
|
||||
subtitle: Padding(
|
||||
padding: EdgeInsets.only(top: 6.0 * sf),
|
||||
padding: EdgeInsets.only(top: 6.0 * safeSf),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.groups_outlined, size: 16 * sf, color: Colors.grey),
|
||||
SizedBox(width: 4 * sf),
|
||||
Icon(Icons.groups_outlined, size: 16 * safeSf, color: Colors.grey),
|
||||
SizedBox(width: 4 * safeSf),
|
||||
|
||||
// 👇 A CORREÇÃO ESTÁ AQUI: StreamBuilder em vez de FutureBuilder 👇
|
||||
StreamBuilder<int>(
|
||||
stream: controller.getPlayerCountStream(team.id),
|
||||
initialData: 0,
|
||||
builder: (context, snapshot) {
|
||||
final count = snapshot.data ?? 0;
|
||||
return Text(
|
||||
"$count Jogs.", // Abreviado para poupar espaço
|
||||
"$count Jogs.",
|
||||
style: TextStyle(
|
||||
color: count > 0 ? Colors.green[700] : Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13 * sf,
|
||||
fontSize: 13 * safeSf,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
SizedBox(width: 8 * sf),
|
||||
Expanded( // Garante que a temporada se adapta se faltar espaço
|
||||
SizedBox(width: 8 * safeSf),
|
||||
Expanded(
|
||||
child: Text(
|
||||
"| ${team.season}",
|
||||
style: TextStyle(color: Colors.grey, fontSize: 13 * sf),
|
||||
style: TextStyle(color: Colors.grey, fontSize: 13 * safeSf),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
@@ -111,11 +115,11 @@ class TeamCard extends StatelessWidget {
|
||||
|
||||
// --- 4. BOTÕES (Estatísticas e Apagar) ---
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min, // <-- ISTO RESOLVE O OVERFLOW DAS RISCAS AMARELAS
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
tooltip: 'Ver Estatísticas',
|
||||
icon: Icon(Icons.bar_chart_rounded, color: Colors.blue, size: 24 * sf),
|
||||
icon: Icon(Icons.bar_chart_rounded, color: Colors.blue, size: 24 * safeSf),
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
@@ -127,8 +131,8 @@ class TeamCard extends StatelessWidget {
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Eliminar Equipa',
|
||||
icon: Icon(Icons.delete_outline, color: const Color(0xFFE74C3C), size: 24 * sf),
|
||||
onPressed: () => _confirmDelete(context),
|
||||
icon: Icon(Icons.delete_outline, color: const Color(0xFFE74C3C), size: 24 * safeSf),
|
||||
onPressed: () => _confirmDelete(context, safeSf),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -136,23 +140,23 @@ class TeamCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
void _confirmDelete(BuildContext context) {
|
||||
void _confirmDelete(BuildContext context, double safeSf) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Eliminar Equipa?', style: TextStyle(fontSize: 18 * sf, fontWeight: FontWeight.bold)),
|
||||
content: Text('Tens a certeza que queres eliminar "${team.name}"?', style: TextStyle(fontSize: 14 * sf)),
|
||||
title: Text('Eliminar Equipa?', style: TextStyle(fontSize: 18 * safeSf, fontWeight: FontWeight.bold)),
|
||||
content: Text('Tens a certeza que queres eliminar "${team.name}"?', style: TextStyle(fontSize: 14 * safeSf)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('Cancelar', style: TextStyle(fontSize: 14 * sf)),
|
||||
child: Text('Cancelar', style: TextStyle(fontSize: 14 * safeSf)),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
controller.deleteTeam(team.id);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text('Eliminar', style: TextStyle(color: Colors.red, fontSize: 14 * sf)),
|
||||
child: Text('Eliminar', style: TextStyle(color: Colors.red, fontSize: 14 * safeSf)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -163,7 +167,7 @@ class TeamCard extends StatelessWidget {
|
||||
// --- DIALOG DE CRIAÇÃO ---
|
||||
class CreateTeamDialog extends StatefulWidget {
|
||||
final Function(String name, String season, String imageUrl) onConfirm;
|
||||
final double sf; // Recebe a escala
|
||||
final double sf;
|
||||
|
||||
const CreateTeamDialog({super.key, required this.onConfirm, required this.sf});
|
||||
|
||||
@@ -178,58 +182,65 @@ class _CreateTeamDialogState extends State<CreateTeamDialog> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 👇 MESMO TRAVÃO NO POPUP PARA NÃO FICAR GIGANTE 👇
|
||||
final double safeSf = math.min(widget.sf, 1.15);
|
||||
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15 * widget.sf)),
|
||||
title: Text('Nova Equipa', style: TextStyle(fontSize: 18 * widget.sf, fontWeight: FontWeight.bold)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15 * safeSf)),
|
||||
title: Text('Nova Equipa', style: TextStyle(fontSize: 18 * safeSf, fontWeight: FontWeight.bold)),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: _nameController,
|
||||
style: TextStyle(fontSize: 14 * widget.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Nome da Equipa',
|
||||
labelStyle: TextStyle(fontSize: 14 * widget.sf)
|
||||
child: Container(
|
||||
// 👇 Limita a largura máxima no tablet para o popup não ficar super esticado!
|
||||
constraints: BoxConstraints(maxWidth: 450 * safeSf),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: _nameController,
|
||||
style: TextStyle(fontSize: 14 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Nome da Equipa',
|
||||
labelStyle: TextStyle(fontSize: 14 * safeSf)
|
||||
),
|
||||
textCapitalization: TextCapitalization.words,
|
||||
),
|
||||
textCapitalization: TextCapitalization.words,
|
||||
),
|
||||
SizedBox(height: 15 * widget.sf),
|
||||
DropdownButtonFormField<String>(
|
||||
value: _selectedSeason,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Temporada',
|
||||
labelStyle: TextStyle(fontSize: 14 * widget.sf)
|
||||
SizedBox(height: 15 * safeSf),
|
||||
DropdownButtonFormField<String>(
|
||||
value: _selectedSeason,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Temporada',
|
||||
labelStyle: TextStyle(fontSize: 14 * safeSf)
|
||||
),
|
||||
style: TextStyle(fontSize: 14 * safeSf, color: Colors.black87),
|
||||
items: ['2023/24', '2024/25', '2025/26']
|
||||
.map((s) => DropdownMenuItem(value: s, child: Text(s)))
|
||||
.toList(),
|
||||
onChanged: (val) => setState(() => _selectedSeason = val!),
|
||||
),
|
||||
style: TextStyle(fontSize: 14 * widget.sf, color: Colors.black87),
|
||||
items: ['2023/24', '2024/25', '2025/26']
|
||||
.map((s) => DropdownMenuItem(value: s, child: Text(s)))
|
||||
.toList(),
|
||||
onChanged: (val) => setState(() => _selectedSeason = val!),
|
||||
),
|
||||
SizedBox(height: 15 * widget.sf),
|
||||
TextField(
|
||||
controller: _imageController,
|
||||
style: TextStyle(fontSize: 14 * widget.sf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'URL Imagem ou Emoji',
|
||||
labelStyle: TextStyle(fontSize: 14 * widget.sf),
|
||||
hintText: 'Ex: 🏀 ou https://...',
|
||||
hintStyle: TextStyle(fontSize: 14 * widget.sf)
|
||||
SizedBox(height: 15 * safeSf),
|
||||
TextField(
|
||||
controller: _imageController,
|
||||
style: TextStyle(fontSize: 14 * safeSf),
|
||||
decoration: InputDecoration(
|
||||
labelText: 'URL Imagem ou Emoji',
|
||||
labelStyle: TextStyle(fontSize: 14 * safeSf),
|
||||
hintText: 'Ex: 🏀 ou https://...',
|
||||
hintStyle: TextStyle(fontSize: 14 * safeSf)
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text('Cancelar', style: TextStyle(fontSize: 14 * widget.sf))
|
||||
child: Text('Cancelar', style: TextStyle(fontSize: 14 * safeSf))
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFE74C3C),
|
||||
padding: EdgeInsets.symmetric(horizontal: 16 * widget.sf, vertical: 10 * widget.sf)
|
||||
padding: EdgeInsets.symmetric(horizontal: 16 * safeSf, vertical: 10 * safeSf)
|
||||
),
|
||||
onPressed: () {
|
||||
if (_nameController.text.trim().isNotEmpty) {
|
||||
@@ -241,7 +252,7 @@ class _CreateTeamDialogState extends State<CreateTeamDialog> {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
child: Text('Criar', style: TextStyle(color: Colors.white, fontSize: 14 * widget.sf)),
|
||||
child: Text('Criar', style: TextStyle(color: Colors.white, fontSize: 14 * safeSf)),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user