MVP #141
@@ -6,25 +6,24 @@ import 'package:intl/intl.dart';
|
|||||||
|
|
||||||
class GameHistoryTile extends StatefulWidget {
|
class GameHistoryTile extends StatefulWidget {
|
||||||
final Game game;
|
final Game game;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
|
||||||
const GameHistoryTile({
|
const GameHistoryTile({super.key, required this.game, required this.onTap});
|
||||||
super.key,
|
|
||||||
required this.game,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<GameHistoryTile> createState() => _GameHistoryTileState();
|
State<GameHistoryTile> createState() => _GameHistoryTileState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GameHistoryTileState extends State<GameHistoryTile> {
|
class _GameHistoryTileState extends State<GameHistoryTile> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final group = widget.game.group;
|
final group = widget.game.group;
|
||||||
final winner = widget.game.winner;
|
final winner = widget.game.winner;
|
||||||
final allPlayers = _getAllPlayers();
|
final allPlayers = _getAllPlayers();
|
||||||
|
|
||||||
return Container(
|
return GestureDetector(
|
||||||
|
onTap: widget.onTap,
|
||||||
|
child: Container(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -50,10 +49,7 @@ class _GameHistoryTileState extends State<GameHistoryTile> {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
_formatDate(widget.game.createdAt),
|
_formatDate(widget.game.createdAt),
|
||||||
style: const TextStyle(
|
style: const TextStyle(fontSize: 12, color: Colors.grey),
|
||||||
fontSize: 12,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -63,19 +59,12 @@ class _GameHistoryTileState extends State<GameHistoryTile> {
|
|||||||
if (group != null) ...[
|
if (group != null) ...[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(
|
const Icon(Icons.group, size: 16, color: Colors.grey),
|
||||||
Icons.group,
|
|
||||||
size: 16,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
group.name,
|
group.name,
|
||||||
style: const TextStyle(
|
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
||||||
fontSize: 14,
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -86,7 +75,10 @@ class _GameHistoryTileState extends State<GameHistoryTile> {
|
|||||||
|
|
||||||
if (winner != null) ...[
|
if (winner != null) ...[
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8,
|
||||||
|
horizontal: 12,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.green.withValues(alpha: 0.1),
|
color: Colors.green.withValues(alpha: 0.1),
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@@ -134,15 +126,13 @@ class _GameHistoryTileState extends State<GameHistoryTile> {
|
|||||||
spacing: 6,
|
spacing: 6,
|
||||||
runSpacing: 6,
|
runSpacing: 6,
|
||||||
children: allPlayers.map((player) {
|
children: allPlayers.map((player) {
|
||||||
return TextIconTile(
|
return TextIconTile(text: player.name, iconEnabled: false);
|
||||||
text: player.name,
|
|
||||||
iconEnabled: false,
|
|
||||||
);
|
|
||||||
}).toList(),
|
}).toList(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,5 +177,4 @@ class _GameHistoryTileState extends State<GameHistoryTile> {
|
|||||||
|
|
||||||
return allPlayers;
|
return allPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user