Files
PlayMaker/lib/widgets/home_widgets.dart
2026-03-16 23:25:48 +00:00

180 lines
5.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:playmaker/classe/home.config.dart';
class StatCard extends StatelessWidget {
final String title;
final String playerName;
final String statValue;
final String statLabel;
final Color color;
final IconData icon;
final bool isHighlighted;
final VoidCallback? onTap;
const StatCard({
super.key,
required this.title,
required this.playerName,
required this.statValue,
required this.statLabel,
required this.color,
required this.icon,
this.isHighlighted = false,
this.onTap,
});
@override
Widget build(BuildContext context) {
return SizedBox(
width: HomeConfig.cardwidthPadding,
height: HomeConfig.cardheightPadding,
child: Card(
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
side: isHighlighted
? const BorderSide(color: Colors.amber, width: 2)
: BorderSide.none,
),
child: InkWell(
onTap: onTap,
borderRadius: BorderRadius.circular(20),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
color.withOpacity(0.9),
color.withOpacity(0.7),
],
),
),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Cabeçalho
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title.toUpperCase(),
style: HomeConfig.titleStyle,
),
const SizedBox(height: 5),
Text(
playerName,
style: HomeConfig.playerNameStyle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
if (isHighlighted)
Container(
padding: const EdgeInsets.all(8),
decoration: const BoxDecoration(
color: Colors.amber,
shape: BoxShape.circle,
),
child: const Icon(Icons.star, size: 20, color: Colors.white),
),
],
),
const SizedBox(height: 10),
// Ícone
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
shape: BoxShape.circle,
),
child: Icon(icon, size: 30, color: Colors.white),
),
const Spacer(),
// Estatística
Center(
child: Column(
children: [
Text(statValue, style: HomeConfig.statValueStyle),
const SizedBox(height: 5),
Text(statLabel.toUpperCase(), style: HomeConfig.statLabelStyle),
],
),
),
const Spacer(),
// Botão
Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(vertical: 12),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(15),
),
child: const Center(
child: Text(
'VER DETALHES',
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14, letterSpacing: 1),
),
),
),
],
),
),
),
),
),
);
}
}
class SportGrid extends StatelessWidget {
final List<Widget> children;
final double spacing;
const SportGrid({
super.key,
required this.children,
this.spacing = HomeConfig.cardSpacing,
});
@override
Widget build(BuildContext context) {
if (children.isEmpty) return const SizedBox();
return Column(
children: [
if (children.length >= 2)
Padding(
padding: EdgeInsets.only(bottom: spacing),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children[0],
SizedBox(width: spacing),
children[1],
],
),
),
if (children.length >= 4)
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children[2],
SizedBox(width: spacing),
children[3],
],
),
],
);
}
}