Visibility of bottom bar in round view reworked

This commit is contained in:
Felix Kirchner
2025-04-27 11:09:13 +02:00
parent 999c496719
commit be62980fbd
2 changed files with 49 additions and 41 deletions

View File

@@ -2,6 +2,7 @@ import 'package:cabo_counter/data/game_session.dart';
import 'package:cabo_counter/utility/theme.dart' as theme; import 'package:cabo_counter/utility/theme.dart' as theme;
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
class RoundView extends StatefulWidget { class RoundView extends StatefulWidget {
final GameSession gameSession; final GameSession gameSession;
@@ -259,47 +260,53 @@ class _RoundViewState extends State<RoundView> {
left: 0, left: 0,
right: 0, right: 0,
bottom: bottomInset, bottom: bottomInset,
child: Container( child: KeyboardVisibilityBuilder(builder: (context, visible) {
height: 80, if (!visible) {
padding: const EdgeInsets.only(bottom: 20), return Container(
color: theme.backgroundTintColor, height: 80,
child: Row( padding: const EdgeInsets.only(bottom: 20),
mainAxisAlignment: MainAxisAlignment.spaceEvenly, color: theme.backgroundTintColor,
children: [ child: Row(
CupertinoButton( mainAxisAlignment: MainAxisAlignment.spaceEvenly,
onPressed: _areRoundInputsValid() children: [
? () { CupertinoButton(
_finishRound(); onPressed: _areRoundInputsValid()
Navigator.pop(context, widget.gameSession); ? () {
} _finishRound();
: null, Navigator.pop(context, widget.gameSession);
child: const Text('Fertig'), }
: null,
child: const Text('Fertig'),
),
CupertinoButton(
onPressed: _areRoundInputsValid()
? () {
_finishRound();
if (widget.gameSession.finished == true) {
Navigator.pop(context, widget.gameSession);
} else {
Navigator.pushReplacement(
context,
CupertinoPageRoute(
builder: (context) => RoundView(
gameSession: widget.gameSession,
roundNumber: widget.roundNumber + 1,
),
),
);
}
}
: null,
child: const Text('Nächste Runde'),
),
],
), ),
CupertinoButton( );
onPressed: _areRoundInputsValid() } else {
? () { return const SizedBox.shrink();
_finishRound(); }
if (widget.gameSession.finished == true) { }),
Navigator.pop(context, widget.gameSession); )
} else {
Navigator.pushReplacement(
context,
CupertinoPageRoute(
builder: (context) => RoundView(
gameSession: widget.gameSession,
roundNumber: widget.roundNumber + 1,
),
),
);
}
}
: null,
child: const Text('Nächste Runde'),
),
],
),
),
),
], ],
), ),
); );

View File

@@ -2,7 +2,7 @@ name: cabo_counter
description: "Mobile app for the card game CABO" description: "Mobile app for the card game CABO"
publish_to: 'none' publish_to: 'none'
version: 0.1.3+51 version: 0.1.3+54
environment: environment:
sdk: ^3.5.4 sdk: ^3.5.4
@@ -14,6 +14,7 @@ dependencies:
font_awesome_flutter: ^10.8.0 font_awesome_flutter: ^10.8.0
url_launcher: any url_launcher: any
package_info_plus: any package_info_plus: any
flutter_keyboard_visibility: ^6.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: