Fixed keyboard behaviour

This commit is contained in:
2025-07-20 19:28:38 +02:00
parent 68a1a5052e
commit 59ff4df83c
2 changed files with 90 additions and 73 deletions

View File

@@ -8,6 +8,7 @@ import 'package:cabo_counter/presentation/widgets/custom_button.dart';
import 'package:cabo_counter/services/config_service.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
enum CreateStatus {
noGameTitle,
@@ -66,12 +67,13 @@ class _CreateGameViewState extends State<CreateGameView> {
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
resizeToAvoidBottomInset: false,
navigationBar: CupertinoNavigationBar(
previousPageTitle: AppLocalizations.of(context).overview,
middle: Text(AppLocalizations.of(context).new_game),
),
child: SafeArea(
child: Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -102,13 +104,7 @@ class _CreateGameViewState extends State<CreateGameView> {
prefix: Text(AppLocalizations.of(context).mode),
suffix: Row(
children: [
Text(
gameMode == GameMode.none
? AppLocalizations.of(context).no_mode_selected
: (gameMode == GameMode.pointLimit
? '${ConfigService.getPointLimit()} ${AppLocalizations.of(context).points}'
: AppLocalizations.of(context).unlimited),
),
_getDisplayedGameMode(),
const SizedBox(width: 3),
const CupertinoListTileChevron(),
],
@@ -137,10 +133,9 @@ class _CreateGameViewState extends State<CreateGameView> {
style: CustomTheme.rowTitle,
),
),
Flexible(
child: ReorderableListView.builder(
ReorderableListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
physics: const BouncingScrollPhysics(),
padding: const EdgeInsets.all(8),
itemCount: _playerNameTextControllers.length,
onReorder: (oldIndex, newIndex) {
@@ -205,7 +200,6 @@ class _CreateGameViewState extends State<CreateGameView> {
),
);
}),
),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 50),
child: Center(
@@ -259,6 +253,15 @@ class _CreateGameViewState extends State<CreateGameView> {
),
),
),
KeyboardVisibilityBuilder(builder: (context, visible) {
if (visible) {
return const SizedBox(
height: 250,
);
} else {
return const SizedBox.shrink();
}
})
],
),
)));
@@ -412,6 +415,19 @@ class _CreateGameViewState extends State<CreateGameView> {
return true;
}
Text _getDisplayedGameMode() {
if (gameMode == GameMode.none) {
return Text(AppLocalizations.of(context).no_mode_selected);
} else if (gameMode == GameMode.pointLimit) {
return Text(
'${ConfigService.getPointLimit()} ${AppLocalizations.of(context).points}',
style: TextStyle(color: CustomTheme.primaryColor));
} else {
return Text(AppLocalizations.of(context).unlimited,
style: TextStyle(color: CustomTheme.primaryColor));
}
}
@override
void dispose() {
_gameTitleTextController.dispose();

View File

@@ -16,6 +16,7 @@ class _TabViewState extends State<TabView> {
@override
Widget build(BuildContext context) {
return CupertinoTabScaffold(
resizeToAvoidBottomInset: false,
tabBar: CupertinoTabBar(
backgroundColor: CustomTheme.mainElementBackgroundColor,
iconSize: 27,