From ca9d55c29b417b4652ba26ca1b990526e35f2590 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Mon, 21 Jul 2025 00:07:20 +0200 Subject: [PATCH] Added focus nodes for autofocus and navigation between textfields --- lib/presentation/views/create_game_view.dart | 12 ++++++++++++ pubspec.yaml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/presentation/views/create_game_view.dart b/lib/presentation/views/create_game_view.dart index b81437c..201ce9d 100644 --- a/lib/presentation/views/create_game_view.dart +++ b/lib/presentation/views/create_game_view.dart @@ -188,6 +188,18 @@ class _CreateGameViewState extends State { '${AppLocalizations.of(context).player} ${index + 1}', padding: const EdgeInsets.all(12), decoration: const BoxDecoration(), + textInputAction: + index + 1 < _playerNameTextControllers.length + ? TextInputAction.next + : TextInputAction.done, + onSubmitted: (_) { + if (index + 1 < _playerNameFocusNodes.length) { + _playerNameFocusNodes[index + 1] + .requestFocus(); + } else { + FocusScope.of(context).unfocus(); + } + }, ), ), AnimatedOpacity( diff --git a/pubspec.yaml b/pubspec.yaml index 0c5c712..65c736c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: cabo_counter description: "Mobile app for the card game Cabo" publish_to: 'none' -version: 0.5.2+585 +version: 0.5.2+586 environment: sdk: ^3.5.4