From ad04a6317b67736ee9a6de7b7494875375393b31 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Fri, 4 Apr 2025 13:46:05 +0200 Subject: [PATCH] Make game name selectable --- lib/widgets/game_card.dart | 44 +++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/lib/widgets/game_card.dart b/lib/widgets/game_card.dart index 4b4f1e2..b71b102 100644 --- a/lib/widgets/game_card.dart +++ b/lib/widgets/game_card.dart @@ -183,7 +183,10 @@ class _GameCardState extends State borderRadius: BorderRadius.circular(12), child: Opacity( opacity: 0.4, - child: Image.memory(widget.game.imageData!, fit: BoxFit.cover), + child: Image.memory( + widget.game.imageData!, + fit: BoxFit.cover, + ), ), ), ), @@ -205,7 +208,10 @@ class _GameCardState extends State ), ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 24.0), + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 24.0, + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -215,17 +221,29 @@ class _GameCardState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded( - child: TextField( - controller: _nameController, - focusNode: _nameFocus, - style: Theme.of(context).textTheme.titleLarge - ?.copyWith(color: hasImage ? Colors.white : null), - enabled: widget.isNameEditable, - decoration: const InputDecoration.collapsed( - hintText: 'New Game', - ), - onSubmitted: (_) => _nameFocus.unfocus(), - ), + child: + widget.isNameEditable + ? TextField( + controller: _nameController, + focusNode: _nameFocus, + style: Theme.of( + context, + ).textTheme.titleLarge?.copyWith( + color: hasImage ? Colors.white : null, + ), + decoration: const InputDecoration.collapsed( + hintText: 'New Game', + ), + onSubmitted: (_) => _nameFocus.unfocus(), + ) + : SelectableText( + widget.game.name, + style: Theme.of( + context, + ).textTheme.titleLarge?.copyWith( + color: hasImage ? Colors.white : null, + ), + ), ), Row( mainAxisSize: MainAxisSize.min,