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