changed leading and made buttons flexible

main
Oeyuu 2024-06-07 20:49:32 +02:00
parent 1a3e92483f
commit 93ebd4befe
2 changed files with 36 additions and 39 deletions

View File

@ -115,41 +115,45 @@ class _FlipingCardState extends State<FlipingCard> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
OutlinedButton( Flexible(
onPressed: () { child: OutlinedButton(
setState(() { onPressed: () {
if (index > 0 && index <= widget.players.length) { setState(() {
index--; if (index > 0 && index <= widget.players.length) {
if (!_controller.state!.isFront) { index--;
_controller.toggleCardWithoutAnimation(); if (!_controller.state!.isFront) {
_controller.toggleCardWithoutAnimation();
}
} }
} });
}); },
}, child: const Text("Zurück"),
child: const Text("Zurück"), ),
), ),
ElevatedButton( Flexible(
onPressed: () { child: ElevatedButton(
setState(() { onPressed: () {
if (index >= 0 && index < widget.players.length - 1) { setState(() {
index++; if (index >= 0 && index < widget.players.length - 1) {
if (!_controller.state!.isFront) { index++;
_controller.toggleCardWithoutAnimation(); if (!_controller.state!.isFront) {
_controller.toggleCardWithoutAnimation();
}
} else if (index == widget.players.length - 1) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PlayerGridView(players: widget.players),
),
);
} }
} else if (index == widget.players.length - 1) { });
Navigator.push( },
context, child: Text(index != widget.players.length - 1
MaterialPageRoute( ? "Nächster Spieler"
builder: (context) => : "Spiel anfangen!"),
PlayerGridView(players: widget.players), ),
),
);
}
});
},
child: Text(index != widget.players.length - 1
? "Nächster Spieler"
: "Spiel anfangen!"),
), ),
], ],
), ),

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:werwolf/screens/flippingcards.dart'; import 'package:werwolf/screens/flippingcards.dart';
import '../models/game.dart'; import '../models/game.dart';
@ -31,12 +30,6 @@ class _GameSettingsState extends State<GameSettings> {
style: Theme.of(context).textTheme.titleLarge, // Apply text theme style: Theme.of(context).textTheme.titleLarge, // Apply text theme
), ),
centerTitle: true, centerTitle: true,
leading: IconButton(
icon: const Icon(FontAwesomeIcons.xmark),
onPressed: () {
Navigator.popUntil(context, ModalRoute.withName('/'));
},
),
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.fromLTRB(30.0, 40.0, 30.0, 8.0), padding: const EdgeInsets.fromLTRB(30.0, 40.0, 30.0, 8.0),