5 Commits

Author SHA1 Message Date
b5234c765c Changed create game button size
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m6s
Pull Request Pipeline / lint (pull_request) Successful in 2m8s
2025-11-26 12:40:06 +01:00
919c9f57ac Fixed button state 2025-11-26 12:35:34 +01:00
27424694ce Removed unnecessary prints 2025-11-26 12:31:33 +01:00
84338f8f66 Changed title 2025-11-26 12:28:11 +01:00
733df2dcb5 Changed highlight color 2025-11-26 12:27:07 +01:00
5 changed files with 25 additions and 22 deletions

View File

@@ -16,9 +16,9 @@ class CustomTheme {
static BoxDecoration highlightedBoxDecoration = BoxDecoration(
color: boxColor,
border: Border.all(color: Colors.blue),
border: Border.all(color: primaryColor),
borderRadius: BorderRadius.circular(12),
boxShadow: [BoxShadow(color: Colors.blue.withAlpha(120), blurRadius: 12)],
boxShadow: [BoxShadow(color: primaryColor.withAlpha(120), blurRadius: 12)],
);
static AppBarTheme appBarTheme = AppBarTheme(

View File

@@ -36,7 +36,7 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
backgroundColor: CustomTheme.backgroundColor,
scrolledUnderElevation: 0,
title: const Text(
'Choose Gametype',
'Choose Ruleset',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
centerTitle: true,

View File

@@ -52,6 +52,9 @@ class _CreateGameViewState extends State<CreateGameView> {
/// the [ChooseRulesetView]
int selectedRulesetIndex = -1;
/// The currently selected players
List<Player>? selectedPlayers;
/// List of available rulesets with their display names and descriptions
/// as tuples of (Ruleset, String, String)
List<(Ruleset, String, String)> rulesets = [
@@ -174,14 +177,6 @@ class _CreateGameViewState extends State<CreateGameView> {
selectedGroupIndex = groupsList.indexWhere(
(g) => g.id == selectedGroup?.id,
);
print('selectedGroup: $selectedGroup');
print(
playerList
.where(
(p) => !selectedGroup!.members.any((m) => m.id == p.id),
)
.toList(),
);
setState(() {});
},
child: Container(
@@ -221,7 +216,9 @@ class _CreateGameViewState extends State<CreateGameView> {
)
.toList(),
onChanged: (value) {
print(value);
setState(() {
selectedPlayers = value;
});
},
),
),
@@ -230,21 +227,19 @@ class _CreateGameViewState extends State<CreateGameView> {
text: 'Create game',
sizeRelativeToWidth: 0.95,
buttonType: ButtonType.primary,
onPressed:
(_gameNameController.text.isEmpty ||
selectedGroup == null ||
selectedRuleset == null)
? null
: () async {
onPressed: _enableCreateGameButton()
? () async {
Game game = Game(
name: _gameNameController.text.trim(),
createdAt: DateTime.now(),
group: selectedGroup!,
players: selectedPlayers,
);
// TODO: Replace with navigation to GameResultView()
print('Created game: $game');
Navigator.pop(context);
},
}
: null,
),
const SizedBox(height: 20),
],
@@ -266,4 +261,13 @@ class _CreateGameViewState extends State<CreateGameView> {
return 'Least Points';
}
}
/// Determines whether the "Create Game" button should be enabled based on
/// the current state of the input fields.
bool _enableCreateGameButton() {
return _gameNameController.text.isNotEmpty &&
(selectedGroup != null ||
(selectedPlayers != null && selectedPlayers!.isNotEmpty)) &&
selectedRuleset != null;
}
}

View File

@@ -178,12 +178,12 @@ class _GameHistoryViewState extends State<GameHistoryView> {
),
),
Positioned(
bottom: 110,
bottom: MediaQuery.paddingOf(context).bottom,
width: MediaQuery.of(context).size.width,
child: Center(
child: CustomWidthButton(
text: 'Create Game',
sizeRelativeToWidth: 0.95,
sizeRelativeToWidth: 0.90,
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(

View File

@@ -92,7 +92,6 @@ class _GroupsViewState extends State<GroupsView> {
);
},
),
Positioned(
bottom: MediaQuery.paddingOf(context).bottom,
child: CustomWidthButton(