Design polish
This commit is contained in:
@@ -41,7 +41,9 @@ class _GameCardState extends State<GameCard>
|
||||
vsync: this,
|
||||
);
|
||||
_nameController = TextEditingController(text: widget.game.name);
|
||||
_versionRegexController = TextEditingController(text: widget.game.versionRegex);
|
||||
_versionRegexController = TextEditingController(
|
||||
text: widget.game.versionRegex,
|
||||
);
|
||||
_rssFeedUrlController = TextEditingController(text: widget.game.rssFeedUrl);
|
||||
_lastPlayedController = TextEditingController(text: widget.game.lastPlayed);
|
||||
|
||||
@@ -55,14 +57,20 @@ class _GameCardState extends State<GameCard>
|
||||
|
||||
void _setupFocusListeners() {
|
||||
void updateGame() {
|
||||
widget.onGameUpdated(Game(
|
||||
name: widget.isNameEditable ? _nameController.text : widget.game.name,
|
||||
versionRegex: _versionRegexController.text,
|
||||
lastPlayed: _lastPlayedController.text,
|
||||
rssFeedUrl: _rssFeedUrlController.text,
|
||||
actualVersion: widget.game.actualVersion,
|
||||
lastUpdated: widget.game.lastUpdated,
|
||||
));
|
||||
var name =
|
||||
widget.isNameEditable ? _nameController.text : widget.game.name;
|
||||
if (name.isNotEmpty) {
|
||||
widget.onGameUpdated(
|
||||
Game(
|
||||
name: name,
|
||||
versionRegex: _versionRegexController.text,
|
||||
lastPlayed: _lastPlayedController.text,
|
||||
rssFeedUrl: _rssFeedUrlController.text,
|
||||
actualVersion: widget.game.actualVersion,
|
||||
lastUpdated: widget.game.lastUpdated,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
_nameFocus.addListener(() {
|
||||
@@ -133,43 +141,46 @@ class _GameCardState extends State<GameCard>
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _nameController,
|
||||
focusNode: _nameFocus,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
enabled: widget.isNameEditable,
|
||||
decoration: const InputDecoration.collapsed(
|
||||
hintText: 'New Game',
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: _nameController,
|
||||
focusNode: _nameFocus,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
enabled: widget.isNameEditable,
|
||||
decoration: const InputDecoration.collapsed(
|
||||
hintText: 'New Game',
|
||||
),
|
||||
onSubmitted: (_) => _nameFocus.unfocus(),
|
||||
),
|
||||
onSubmitted: (_) => _nameFocus.unfocus(),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.onDelete != null)
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.delete,
|
||||
color: _deleteClickCount > 0 ? Colors.red : null,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (widget.onDelete != null)
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.delete,
|
||||
color: _deleteClickCount > 0 ? Colors.red : null,
|
||||
),
|
||||
onPressed: _handleDeleteClick,
|
||||
),
|
||||
onPressed: _handleDeleteClick,
|
||||
),
|
||||
if (!widget.isNameEditable)
|
||||
RotationTransition(
|
||||
turns: _controller,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: _isLoading ? null : _refreshVersion,
|
||||
if (!widget.isNameEditable)
|
||||
RotationTransition(
|
||||
turns: _controller,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: _isLoading ? null : _refreshVersion,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
|
Reference in New Issue
Block a user