Updated game tile
This commit is contained in:
@@ -161,10 +161,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
return GameTile(
|
||||
title: game.name,
|
||||
description: game.description,
|
||||
badgeText: translateRulesetToString(
|
||||
game.ruleset,
|
||||
context,
|
||||
),
|
||||
subtitle: translateRulesetToString(game.ruleset, context),
|
||||
badgeColor: getColorFromGameColor(game.color),
|
||||
isHighlighted: selectedGameId == game.id,
|
||||
onTap: () async {
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:tallee/core/enums.dart';
|
||||
class GameTile extends StatelessWidget {
|
||||
/// A list tile widget that displays a title and description, with optional highlighting and badge.
|
||||
/// - [title]: The title text displayed on the tile.
|
||||
/// - [subtitle]: An optional subtitle displayed under the title.
|
||||
/// - [description]: The description text displayed below the title.
|
||||
/// - [onTap]: The callback invoked when the tile is tapped.
|
||||
/// - [onLongPress]: The callback invoked when the tile is tapped.
|
||||
@@ -17,6 +18,7 @@ class GameTile extends StatelessWidget {
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.description,
|
||||
this.subtitle,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
this.isHighlighted = false,
|
||||
@@ -24,25 +26,20 @@ class GameTile extends StatelessWidget {
|
||||
this.badgeColor,
|
||||
});
|
||||
|
||||
/// The title text displayed on the tile.
|
||||
final String title;
|
||||
|
||||
/// The description text displayed below the title.
|
||||
final String? subtitle;
|
||||
|
||||
final String description;
|
||||
|
||||
/// The callback invoked when the tile is tapped.
|
||||
final VoidCallback? onTap;
|
||||
|
||||
/// The callback invoked when the tile is long-pressed.
|
||||
final VoidCallback? onLongPress;
|
||||
|
||||
/// A boolean to determine if the tile should be highlighted.
|
||||
final bool isHighlighted;
|
||||
|
||||
/// Optional text to display in a badge on the right side of the title.
|
||||
final String? badgeText;
|
||||
|
||||
/// Optional color for the badge background.
|
||||
final Color? badgeColor;
|
||||
|
||||
@override
|
||||
@@ -119,6 +116,21 @@ class GameTile extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
|
||||
// Title
|
||||
if (subtitle != null && subtitle!.isNotEmpty) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
subtitle!,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
softWrap: false,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: CustomTheme.hintColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
// Badge
|
||||
if (badgeText != null) ...[
|
||||
const SizedBox(height: 5),
|
||||
|
||||
Reference in New Issue
Block a user