Don't refresh new games
This commit is contained in:
@@ -19,7 +19,8 @@ class GameCard extends StatefulWidget {
|
|||||||
State<GameCard> createState() => _GameCardState();
|
State<GameCard> createState() => _GameCardState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GameCardState extends State<GameCard> with SingleTickerProviderStateMixin {
|
class _GameCardState extends State<GameCard>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
late final AnimationController _controller;
|
late final AnimationController _controller;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
int _deleteClickCount = 0;
|
int _deleteClickCount = 0;
|
||||||
@@ -93,14 +94,17 @@ class _GameCardState extends State<GameCard> with SingleTickerProviderStateMixin
|
|||||||
decoration: const InputDecoration.collapsed(
|
decoration: const InputDecoration.collapsed(
|
||||||
hintText: 'New Game',
|
hintText: 'New Game',
|
||||||
),
|
),
|
||||||
onChanged: (value) => widget.onGameUpdated(Game(
|
onChanged:
|
||||||
name: value,
|
(value) => widget.onGameUpdated(
|
||||||
versionRegex: widget.game.versionRegex,
|
Game(
|
||||||
lastPlayed: widget.game.lastPlayed,
|
name: value,
|
||||||
rssFeedUrl: widget.game.rssFeedUrl,
|
versionRegex: widget.game.versionRegex,
|
||||||
actualVersion: widget.game.actualVersion,
|
lastPlayed: widget.game.lastPlayed,
|
||||||
lastUpdated: widget.game.lastUpdated,
|
rssFeedUrl: widget.game.rssFeedUrl,
|
||||||
)),
|
actualVersion: widget.game.actualVersion,
|
||||||
|
lastUpdated: widget.game.lastUpdated,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
@@ -114,13 +118,14 @@ class _GameCardState extends State<GameCard> with SingleTickerProviderStateMixin
|
|||||||
),
|
),
|
||||||
onPressed: _handleDeleteClick,
|
onPressed: _handleDeleteClick,
|
||||||
),
|
),
|
||||||
RotationTransition(
|
if (!widget.isNameEditable)
|
||||||
turns: _controller,
|
RotationTransition(
|
||||||
child: IconButton(
|
turns: _controller,
|
||||||
icon: const Icon(Icons.refresh),
|
child: IconButton(
|
||||||
onPressed: _isLoading ? null : _refreshVersion,
|
icon: const Icon(Icons.refresh),
|
||||||
|
onPressed: _isLoading ? null : _refreshVersion,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -130,10 +135,15 @@ class _GameCardState extends State<GameCard> with SingleTickerProviderStateMixin
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120,
|
width: 120,
|
||||||
child: Text('Version:', style: Theme.of(context).textTheme.bodyLarge),
|
child: Text(
|
||||||
|
'Version:',
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
widget.game.actualVersion.isEmpty ? 'Unknown' : widget.game.actualVersion,
|
widget.game.actualVersion.isEmpty
|
||||||
|
? 'Unknown'
|
||||||
|
: widget.game.actualVersion,
|
||||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
color: isUpToDate ? Colors.green : Colors.red,
|
color: isUpToDate ? Colors.green : Colors.red,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -145,10 +155,15 @@ class _GameCardState extends State<GameCard> with SingleTickerProviderStateMixin
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120,
|
width: 120,
|
||||||
child: Text('Last Updated:', style: Theme.of(context).textTheme.bodyLarge),
|
child: Text(
|
||||||
|
'Last Updated:',
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
widget.game.lastUpdated.isEmpty ? 'Never' : DateTime.parse(widget.game.lastUpdated).toString(),
|
widget.game.lastUpdated.isEmpty
|
||||||
|
? 'Never'
|
||||||
|
: DateTime.parse(widget.game.lastUpdated).toString(),
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -157,7 +172,10 @@ class _GameCardState extends State<GameCard> with SingleTickerProviderStateMixin
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 120,
|
width: 120,
|
||||||
child: Text('Last Played:', style: Theme.of(context).textTheme.bodyLarge),
|
child: Text(
|
||||||
|
'Last Played:',
|
||||||
|
style: Theme.of(context).textTheme.bodyLarge,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
widget.game.lastPlayed,
|
widget.game.lastPlayed,
|
||||||
@@ -172,42 +190,60 @@ class _GameCardState extends State<GameCard> with SingleTickerProviderStateMixin
|
|||||||
TextField(
|
TextField(
|
||||||
controller: TextEditingController(text: widget.game.versionRegex),
|
controller: TextEditingController(text: widget.game.versionRegex),
|
||||||
decoration: const InputDecoration(labelText: 'Version Regex'),
|
decoration: const InputDecoration(labelText: 'Version Regex'),
|
||||||
onChanged: (value) => widget.onGameUpdated(Game(
|
onChanged:
|
||||||
name: widget.isNameEditable ? _nameController.text : widget.game.name,
|
(value) => widget.onGameUpdated(
|
||||||
versionRegex: value,
|
Game(
|
||||||
lastPlayed: widget.game.lastPlayed,
|
name:
|
||||||
rssFeedUrl: widget.game.rssFeedUrl,
|
widget.isNameEditable
|
||||||
actualVersion: widget.game.actualVersion,
|
? _nameController.text
|
||||||
lastUpdated: widget.game.lastUpdated,
|
: widget.game.name,
|
||||||
)),
|
versionRegex: value,
|
||||||
|
lastPlayed: widget.game.lastPlayed,
|
||||||
|
rssFeedUrl: widget.game.rssFeedUrl,
|
||||||
|
actualVersion: widget.game.actualVersion,
|
||||||
|
lastUpdated: widget.game.lastUpdated,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: TextEditingController(text: widget.game.rssFeedUrl),
|
controller: TextEditingController(text: widget.game.rssFeedUrl),
|
||||||
decoration: const InputDecoration(labelText: 'RSS Feed URL'),
|
decoration: const InputDecoration(labelText: 'RSS Feed URL'),
|
||||||
onChanged: (value) => widget.onGameUpdated(Game(
|
onChanged:
|
||||||
name: widget.isNameEditable ? _nameController.text : widget.game.name,
|
(value) => widget.onGameUpdated(
|
||||||
versionRegex: widget.game.versionRegex,
|
Game(
|
||||||
lastPlayed: widget.game.lastPlayed,
|
name:
|
||||||
rssFeedUrl: value,
|
widget.isNameEditable
|
||||||
actualVersion: widget.game.actualVersion,
|
? _nameController.text
|
||||||
lastUpdated: widget.game.lastUpdated,
|
: widget.game.name,
|
||||||
)),
|
versionRegex: widget.game.versionRegex,
|
||||||
|
lastPlayed: widget.game.lastPlayed,
|
||||||
|
rssFeedUrl: value,
|
||||||
|
actualVersion: widget.game.actualVersion,
|
||||||
|
lastUpdated: widget.game.lastUpdated,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: TextEditingController(text: widget.game.lastPlayed),
|
controller: TextEditingController(text: widget.game.lastPlayed),
|
||||||
decoration: const InputDecoration(labelText: 'Last Played'),
|
decoration: const InputDecoration(labelText: 'Last Played'),
|
||||||
onChanged: (value) => widget.onGameUpdated(Game(
|
onChanged:
|
||||||
name: widget.isNameEditable ? _nameController.text : widget.game.name,
|
(value) => widget.onGameUpdated(
|
||||||
versionRegex: widget.game.versionRegex,
|
Game(
|
||||||
lastPlayed: value,
|
name:
|
||||||
rssFeedUrl: widget.game.rssFeedUrl,
|
widget.isNameEditable
|
||||||
actualVersion: widget.game.actualVersion,
|
? _nameController.text
|
||||||
lastUpdated: widget.game.lastUpdated,
|
: widget.game.name,
|
||||||
)),
|
versionRegex: widget.game.versionRegex,
|
||||||
|
lastPlayed: value,
|
||||||
|
rssFeedUrl: widget.game.rssFeedUrl,
|
||||||
|
actualVersion: widget.game.actualVersion,
|
||||||
|
lastUpdated: widget.game.lastUpdated,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user