Updated and added comments
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m4s
Pull Request Pipeline / lint (pull_request) Successful in 2m9s

This commit is contained in:
2026-01-13 22:24:31 +01:00
parent e483fc38f3
commit bb79eecdfd
39 changed files with 177 additions and 219 deletions

View File

@@ -6,15 +6,21 @@ import 'package:game_tracker/presentation/widgets/text_input/custom_search_bar.d
import 'package:game_tracker/presentation/widgets/tiles/title_description_list_tile.dart';
class ChooseGameView extends StatefulWidget {
final List<(String, String, Ruleset)> games;
final int initialGameIndex;
/// A view that allows the user to choose a game from a list of available games
/// - [games]: A list of tuples containing the game name, description and ruleset
/// - [initialGameIndex]: The index of the initially selected game
const ChooseGameView({
super.key,
required this.games,
required this.initialGameIndex,
});
/// A list of tuples containing the game name, description and ruleset
final List<(String, String, Ruleset)> games;
/// The index of the initially selected game
final int initialGameIndex;
@override
State<ChooseGameView> createState() => _ChooseGameViewState();
}

View File

@@ -7,15 +7,21 @@ import 'package:game_tracker/presentation/widgets/tiles/group_tile.dart';
import 'package:game_tracker/presentation/widgets/top_centered_message.dart';
class ChooseGroupView extends StatefulWidget {
final List<Group> groups;
final String initialGroupId;
/// A view that allows the user to choose a group from a list of groups.
/// - [groups]: A list of available groups to choose from
/// - [initialGroupId]: The ID of the initially selected group
const ChooseGroupView({
super.key,
required this.groups,
required this.initialGroupId,
});
/// A list of available groups to choose from
final List<Group> groups;
/// The ID of the initially selected group
final String initialGroupId;
@override
State<ChooseGroupView> createState() => _ChooseGroupViewState();
}
@@ -140,10 +146,11 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
filteredGroups.clear();
filteredGroups.addAll(
widget.groups.where(
(group) =>
group.name.toLowerCase().contains(query.toLowerCase()) ||
(group) =>
group.name.toLowerCase().contains(query.toLowerCase()) ||
group.members.any(
(player) => player.name.toLowerCase().contains(query.toLowerCase()),
(player) =>
player.name.toLowerCase().contains(query.toLowerCase()),
),
),
);

View File

@@ -5,15 +5,21 @@ import 'package:game_tracker/l10n/generated/app_localizations.dart';
import 'package:game_tracker/presentation/widgets/tiles/title_description_list_tile.dart';
class ChooseRulesetView extends StatefulWidget {
final List<(Ruleset, String)> rulesets;
final int initialRulesetIndex;
/// A view that allows the user to choose a ruleset from a list of available rulesets
/// - [rulesets]: A list of tuples containing the ruleset and its description
/// - [initialRulesetIndex]: The index of the initially selected ruleset
const ChooseRulesetView({
super.key,
required this.rulesets,
required this.initialRulesetIndex,
});
/// A list of tuples containing the ruleset and its description
final List<(Ruleset, String)> rulesets;
/// The index of the initially selected ruleset
final int initialRulesetIndex;
@override
State<ChooseRulesetView> createState() => _ChooseRulesetViewState();
}

View File

@@ -18,9 +18,13 @@ import 'package:game_tracker/presentation/widgets/tiles/choose_tile.dart';
import 'package:provider/provider.dart';
class CreateMatchView extends StatefulWidget {
final VoidCallback? onWinnerChanged;
/// A view that allows creating a new match
/// [onWinnerChanged]: Optional callback invoked when the winner is changed
const CreateMatchView({super.key, this.onWinnerChanged});
/// Optional callback invoked when the winner is changed
final VoidCallback? onWinnerChanged;
@override
State<CreateMatchView> createState() => _CreateMatchViewState();
}
@@ -202,7 +206,8 @@ class _CreateMatchViewState extends State<CreateMatchView> {
if (selectedGroup != null) {
filteredPlayerList = playerList
.where(
(p) => !selectedGroup!.members.any((m) => m.id == p.id),
(p) =>
!selectedGroup!.members.any((m) => m.id == p.id),
)
.toList();
} else {