2 Commits

Author SHA1 Message Date
ad04a6317b Make game name selectable 2025-04-04 13:46:05 +02:00
ba8b669399 Trim whitespace for game fields 2025-02-27 11:58:34 +01:00

View File

@@ -64,10 +64,10 @@ class _GameCardState extends State<GameCard>
if (name.isNotEmpty) {
widget.onGameUpdated(
Game(
name: name,
name: name.trim(),
versionRegex: _versionRegexController.text,
lastPlayed: _lastPlayedController.text,
rssFeedUrl: _rssFeedUrlController.text,
lastPlayed: _lastPlayedController.text.trim(),
rssFeedUrl: _rssFeedUrlController.text.trim(),
actualVersion: widget.game.actualVersion,
lastUpdated: widget.game.lastUpdated,
imageData: widget.game.imageData,
@@ -156,10 +156,10 @@ class _GameCardState extends State<GameCard>
final imageBytes = await image.readAsBytes();
final updatedGame = await GameRepository.updateImage(
Game(
name: widget.game.name,
name: widget.game.name.trim(),
versionRegex: _versionRegexController.text,
lastPlayed: _lastPlayedController.text,
rssFeedUrl: _rssFeedUrlController.text,
lastPlayed: _lastPlayedController.text.trim(),
rssFeedUrl: _rssFeedUrlController.text.trim(),
actualVersion: widget.game.actualVersion,
lastUpdated: widget.game.lastUpdated,
imageData: imageBytes,
@@ -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,