Merge pull request #150 from flixcoo/bug/149-hide-keyboard-when-button-create-game-is-pressed

Hide keyboard when button create game is pressed
This commit is contained in:
2025-07-31 23:05:46 +02:00
committed by GitHub
5 changed files with 17 additions and 10 deletions

View File

@@ -21,11 +21,14 @@ 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;
}

View File

@@ -473,7 +473,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
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);
}
@@ -489,7 +489,7 @@ class _ActiveGameViewState extends State<ActiveGameView> {
confettiController.play();
await Future.delayed(const Duration(milliseconds: Constants.popUpDelay));
await Future.delayed(const Duration(milliseconds: Constants.kPopUpDelay));
if (context.mounted) {
showCupertinoDialog(

View File

@@ -216,7 +216,7 @@ class _CreateGameViewState extends State<CreateGameView> {
? 1.0
: 0.0,
duration: const Duration(
milliseconds: Constants.fadeInDuration),
milliseconds: Constants.kFadeInDuration),
child: Padding(
padding: const EdgeInsets.only(right: 8.0),
child: ReorderableDragStartListener(
@@ -289,7 +289,6 @@ class _CreateGameViewState extends State<CreateGameView> {
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,12 @@ class _CreateGameViewState extends State<CreateGameView> {
),
),
onPressed: () {
FocusScope.of(context).unfocus();
Future.delayed(
const Duration(
milliseconds: Constants.kKeyboardDelay), () {
_checkAllGameAttributes();
});
},
),
),

View File

@@ -245,7 +245,7 @@ class _MainMenuViewState extends State<MainMenuView> {
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:

View File

@@ -2,7 +2,7 @@ name: cabo_counter
description: "Mobile app for the card game Cabo"
publish_to: 'none'
version: 0.5.5+606
version: 0.5.4+609
environment:
sdk: ^3.5.4