Make game name selectable

This commit is contained in:
2025-04-04 13:46:05 +02:00
parent ba8b669399
commit ad04a6317b

View File

@@ -183,7 +183,10 @@ class _GameCardState extends State<GameCard>
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<GameCard>
),
),
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<GameCard>
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,