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