From 7fd5fab8c08e39db7f737e61ccd5d296a55abacb Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Thu, 31 Jul 2025 22:45:31 +0200 Subject: [PATCH 1/3] Fixed keyboard bug --- lib/presentation/views/create_game_view.dart | 6 ++++-- pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/presentation/views/create_game_view.dart b/lib/presentation/views/create_game_view.dart index 193cdff..a767991 100644 --- a/lib/presentation/views/create_game_view.dart +++ b/lib/presentation/views/create_game_view.dart @@ -289,7 +289,6 @@ class _CreateGameViewState extends State { Padding( padding: const EdgeInsets.fromLTRB(0, 0, 0, 50), child: Center( - key: const ValueKey('create_game_button'), child: CustomButton( child: Text( AppLocalizations.of(context).create_game, @@ -298,7 +297,10 @@ class _CreateGameViewState extends State { ), ), onPressed: () { - _checkAllGameAttributes(); + FocusScope.of(context).unfocus(); + Future.delayed(const Duration(milliseconds: 300), () { + _checkAllGameAttributes(); + }); }, ), ), diff --git a/pubspec.yaml b/pubspec.yaml index abca6e8..216777c 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.4+605 +version: 0.5.4+608 environment: sdk: ^3.5.4 From a4befd5bb8ca771c2d7d04ea7bfba015bfafd18c Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Thu, 31 Jul 2025 23:02:24 +0200 Subject: [PATCH 2/3] Implemented named constant --- lib/core/constants.dart | 3 +++ lib/presentation/views/create_game_view.dart | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/core/constants.dart b/lib/core/constants.dart index e1c2f8d..4a215f7 100644 --- a/lib/core/constants.dart +++ b/lib/core/constants.dart @@ -28,4 +28,7 @@ class Constants { /// Duration in milliseconds for the fade-in animation of texts. static const int fadeInDuration = 300; + + /// Duration in milliseconds for the keyboard to fully disappear. + static const int kKeyboardDelay = 300; } diff --git a/lib/presentation/views/create_game_view.dart b/lib/presentation/views/create_game_view.dart index a767991..6eab929 100644 --- a/lib/presentation/views/create_game_view.dart +++ b/lib/presentation/views/create_game_view.dart @@ -298,7 +298,9 @@ class _CreateGameViewState extends State { ), onPressed: () { FocusScope.of(context).unfocus(); - Future.delayed(const Duration(milliseconds: 300), () { + Future.delayed( + const Duration( + milliseconds: Constants.kKeyboardDelay), () { _checkAllGameAttributes(); }); }, From e201a26b6d59c300eb93abe4584204c67e1c95d7 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Thu, 31 Jul 2025 23:02:52 +0200 Subject: [PATCH 3/3] Updated constant names --- lib/core/constants.dart | 6 +++--- lib/presentation/views/active_game_view.dart | 4 ++-- lib/presentation/views/create_game_view.dart | 2 +- lib/presentation/views/main_menu_view.dart | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/core/constants.dart b/lib/core/constants.dart index 4a215f7..54c2c62 100644 --- a/lib/core/constants.dart +++ b/lib/core/constants.dart @@ -21,13 +21,13 @@ class Constants { remindLaunches: 40); /// Delay in milliseconds before a pop-up appears. - static const int popUpDelay = 300; + static const int kPopUpDelay = 300; /// Delay in milliseconds before the round view appears after the previous one is closed. - static const int roundViewDelay = 600; + static const int kRoundViewDelay = 600; /// Duration in milliseconds for the fade-in animation of texts. - static const int fadeInDuration = 300; + static const int kFadeInDuration = 300; /// Duration in milliseconds for the keyboard to fully disappear. static const int kKeyboardDelay = 300; diff --git a/lib/presentation/views/active_game_view.dart b/lib/presentation/views/active_game_view.dart index b05daba..1a944f5 100644 --- a/lib/presentation/views/active_game_view.dart +++ b/lib/presentation/views/active_game_view.dart @@ -472,7 +472,7 @@ class _ActiveGameViewState extends State { if (round != null && round >= 0) { WidgetsBinding.instance.addPostFrameCallback((_) async { await Future.delayed( - const Duration(milliseconds: Constants.roundViewDelay)); + const Duration(milliseconds: Constants.kRoundViewDelay)); if (context.mounted) { _openRoundView(context, round); } @@ -488,7 +488,7 @@ class _ActiveGameViewState extends State { confettiController.play(); - await Future.delayed(const Duration(milliseconds: Constants.popUpDelay)); + await Future.delayed(const Duration(milliseconds: Constants.kPopUpDelay)); if (context.mounted) { showCupertinoDialog( diff --git a/lib/presentation/views/create_game_view.dart b/lib/presentation/views/create_game_view.dart index 6eab929..a85f14f 100644 --- a/lib/presentation/views/create_game_view.dart +++ b/lib/presentation/views/create_game_view.dart @@ -216,7 +216,7 @@ class _CreateGameViewState extends State { ? 1.0 : 0.0, duration: const Duration( - milliseconds: Constants.fadeInDuration), + milliseconds: Constants.kFadeInDuration), child: Padding( padding: const EdgeInsets.only(right: 8.0), child: ReorderableDragStartListener( diff --git a/lib/presentation/views/main_menu_view.dart b/lib/presentation/views/main_menu_view.dart index 0ad5cfa..f2ab020 100644 --- a/lib/presentation/views/main_menu_view.dart +++ b/lib/presentation/views/main_menu_view.dart @@ -245,7 +245,7 @@ class _MainMenuViewState extends State { BadRatingDialogDecision badRatingDecision = BadRatingDialogDecision.cancel; // so that the bad rating dialog is not shown immediately - await Future.delayed(const Duration(milliseconds: Constants.popUpDelay)); + await Future.delayed(const Duration(milliseconds: Constants.kPopUpDelay)); switch (preRatingDecision) { case PreRatingDialogDecision.yes: