fazer vitoria e derrota

This commit is contained in:
2026-03-10 17:15:10 +00:00
parent d720e09866
commit 49bb371ef4
12 changed files with 940 additions and 742 deletions

View File

@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:playmaker/classe/home.config.dart';
class StatCard extends StatelessWidget {
final String title;
@@ -10,6 +9,11 @@ class StatCard extends StatelessWidget {
final IconData icon;
final bool isHighlighted;
final VoidCallback? onTap;
// Variáveis novas para que o tamanho não fique preso à HomeConfig
final double sf;
final double cardWidth;
final double cardHeight;
const StatCard({
super.key,
@@ -21,27 +25,30 @@ class StatCard extends StatelessWidget {
required this.icon,
this.isHighlighted = false,
this.onTap,
this.sf = 1.0, // Default 1.0 para não dar erro se não passares o valor
required this.cardWidth,
required this.cardHeight,
});
@override
Widget build(BuildContext context) {
return Container(
width: HomeConfig.cardwidthPadding,
height: HomeConfig.cardheightPadding,
return SizedBox(
width: cardWidth,
height: cardHeight,
child: Card(
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
borderRadius: BorderRadius.circular(20 * sf),
side: isHighlighted
? BorderSide(color: Colors.amber, width: 2)
? BorderSide(color: Colors.amber, width: 2 * sf)
: BorderSide.none,
),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(20),
borderRadius: BorderRadius.circular(20 * sf),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
borderRadius: BorderRadius.circular(20 * sf),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
@@ -52,13 +59,14 @@ class StatCard extends StatelessWidget {
),
),
child: Padding(
padding: const EdgeInsets.all(20.0),
padding: EdgeInsets.all(16.0 * sf),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Cabeçalho
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
@@ -66,12 +74,12 @@ class StatCard extends StatelessWidget {
children: [
Text(
title.toUpperCase(),
style: HomeConfig.titleStyle,
style: TextStyle(fontSize: 11 * sf, fontWeight: FontWeight.bold, color: Colors.white70),
),
SizedBox(height: 5),
SizedBox(height: 2 * sf),
Text(
playerName,
style: HomeConfig.playerNameStyle,
style: TextStyle(fontSize: 14 * sf, fontWeight: FontWeight.bold, color: Colors.white),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
@@ -80,38 +88,38 @@ class StatCard extends StatelessWidget {
),
if (isHighlighted)
Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
padding: EdgeInsets.all(6 * sf),
decoration: const BoxDecoration(
color: Colors.amber,
shape: BoxShape.circle,
),
child: Icon(
Icons.star,
size: 20,
size: 16 * sf,
color: Colors.white,
),
),
],
),
SizedBox(height: 10),
SizedBox(height: 8 * sf),
// Ícone
Container(
width: 60,
height: 60,
width: 45 * sf,
height: 45 * sf,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
shape: BoxShape.circle,
),
child: Icon(
icon,
size: 30,
size: 24 * sf,
color: Colors.white,
),
),
Spacer(),
const Spacer(),
// Estatística
Center(
@@ -119,26 +127,26 @@ class StatCard extends StatelessWidget {
children: [
Text(
statValue,
style: HomeConfig.statValueStyle,
style: TextStyle(fontSize: 34 * sf, fontWeight: FontWeight.bold, color: Colors.white),
),
SizedBox(height: 5),
SizedBox(height: 2 * sf),
Text(
statLabel.toUpperCase(),
style: HomeConfig.statLabelStyle,
style: TextStyle(fontSize: 12 * sf, color: Colors.white70),
),
],
),
),
Spacer(),
const Spacer(),
// Botão
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 12),
padding: EdgeInsets.symmetric(vertical: 8 * sf),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(15),
borderRadius: BorderRadius.circular(10 * sf),
),
child: Center(
child: Text(
@@ -146,7 +154,7 @@ class StatCard extends StatelessWidget {
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 14,
fontSize: 11 * sf,
letterSpacing: 1,
),
),
@@ -169,12 +177,12 @@ class SportGrid extends StatelessWidget {
const SportGrid({
super.key,
required this.children,
this.spacing = HomeConfig.cardSpacing,
this.spacing = 20.0, // Valor padrão se não for passado nada
});
@override
Widget build(BuildContext context) {
if (children.isEmpty) return SizedBox();
if (children.isEmpty) return const SizedBox();
return Column(
children: [