Added comments

This commit is contained in:
2025-08-19 19:18:31 +02:00
parent 2cc7253626
commit af92aa621a
23 changed files with 163 additions and 31 deletions

View File

@@ -56,7 +56,7 @@ class AboutView extends StatelessWidget {
sizeStyle: CupertinoButtonSize.medium,
padding: EdgeInsets.zero,
child: Text(AppLocalizations.of(context).imprint),
onPressed: () => launchUrl(Uri.parse(Constants.kImprintLink)),
onPressed: () => launchUrl(Uri.parse(Constants.kLegalLink)),
),
CupertinoButton(
sizeStyle: CupertinoButtonSize.medium,

View File

@@ -3,8 +3,13 @@ import 'package:cabo_counter/l10n/generated/app_localizations.dart'
show AppLocalizations;
import 'package:flutter/cupertino.dart';
/// A view that displays the details of a specific open source software license.
/// It shows the title and the full license text in a scrollable view.
/// Displays the details of a specific open source software license in a Cupertino-style view.
///
/// This view presents the license title and its full text in a scrollable layout.
///
/// Required parameters:
/// - [title]: The name of the license.
/// - [license]: The full license text to display.
class LicenseDetailView extends StatelessWidget {
final String title, license;
const LicenseDetailView(

View File

@@ -6,8 +6,14 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
/// A view that displays a list of the open source software licenses used in the app.
/// It allows users to tap on a license to view its details in a separate screen.
/// Displays a list of open source software licenses used in the app.
///
/// Users can tap on a license to view its details on a separate screen.
/// This view uses a Cupertino design and supports localization.
///
/// See also:
/// - [LicenseDetailView] for displaying license details.
/// - [ossLicenses] for the list of licenses.
class LicenseView extends StatelessWidget {
const LicenseView({super.key});

View File

@@ -15,6 +15,13 @@ import 'package:confetti/confetti.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// Displays the active game view, showing game details, player rankings, rounds, and statistics.
///
/// This view allows users to interact with an ongoing game session, including viewing player scores,
/// navigating through rounds, ending or deleting the game, exporting game data, and starting a new game
/// with the same settings. It also provides visual feedback such as confetti animation when the game ends.
///
/// The widget listens to changes in the provided [GameSession] and updates the UI accordingly.
class ActiveGameView extends StatefulWidget {
final GameSession gameSession;
const ActiveGameView({super.key, required this.gameSession});

View File

@@ -4,6 +4,11 @@ import 'package:cabo_counter/l10n/generated/app_localizations.dart';
import 'package:flutter/cupertino.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
/// A widget that displays the cumulative scoring history of a game session as a line graph.
///
/// The [GraphView] visualizes the progression of each player's score over multiple rounds
/// using a line chart. It supports dynamic coloring for each player, axis formatting,
/// and handles cases where insufficient data is available to render the graph.
class GraphView extends StatefulWidget {
final GameSession gameSession;

View File

@@ -8,6 +8,12 @@ enum GameMode {
unlimited,
}
/// A stateless widget that displays a menu for selecting the game mode.
///
/// The [ModeSelectionMenu] allows the user to choose between different game modes:
/// - Point limit mode with a specified [pointLimit]
/// - Unlimited mode
/// - Optionally, no default mode if [showDeselection] is true
class ModeSelectionMenu extends StatelessWidget {
final int pointLimit;
final bool showDeselection;

View File

@@ -4,6 +4,13 @@ import 'package:cabo_counter/l10n/generated/app_localizations.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// Displays an overview of points for each player and round in the current game session.
///
/// The [PointsView] widget shows a table with all rounds and player scores,
/// including score updates and highlights for players who said "Cabo".
/// It uses a Cupertino-style layout and adapts to the number of players.
///
/// Requires a [GameSession] to provide player and round data.
class PointsView extends StatefulWidget {
final GameSession gameSession;

View File

@@ -8,6 +8,19 @@ import 'package:flutter/services.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
/// A view for displaying and managing a single round
///
/// This widget allows users to input and review scores for each player in a round,
/// select the player who called CABO, and handle special cases such as Kamikaze rounds.
/// It manages the round state, validates input, and coordinates navigation between rounds.
///
/// Features:
/// - Rotates player order based on the previous round's winner.
/// - Supports Kamikaze rounds with dedicated UI and logic.
/// - Handles score input, validation, and updates to the game session.
/// - Displays bonus point popups when applicable.
///
/// Requires a [GameSession] and the current [roundNumber].
class RoundView extends StatefulWidget {
final GameSession gameSession;
final int roundNumber;

View File

@@ -20,6 +20,12 @@ enum CreateStatus {
noPlayerName,
}
/// A view for creating a new game session in the Cabo Counter app.
///
/// The [CreateGameView] allows users to input a game title, select a game mode,
/// add and reorder player names, and validate all required fields before
/// starting a new game. It provides feedback dialogs for missing or invalid
/// input and navigates to the active game view upon successful creation.
class CreateGameView extends StatefulWidget {
final GameMode gameMode;
final String? gameTitle;

View File

@@ -16,6 +16,11 @@ enum PreRatingDialogDecision { yes, no, cancel }
enum BadRatingDialogDecision { email, cancel }
/// Home screen of the app that displays a list of game sessions.
///
/// The [MainMenuView] is the main entry point for the app's home screen.
/// It displays a list of existing game sessions, allows users to create new games,
/// access settings, and handles user feedback dialogs for app rating and support.
class MainMenuView extends StatefulWidget {
const MainMenuView({super.key});

View File

@@ -11,6 +11,10 @@ import 'package:flutter/cupertino.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
/// Settings and information page for the app.
///
/// [SettingsView] is a settings page for the app, allowing users to configure game options,
/// manage game data (import, export, delete), and view app information.
class SettingsView extends StatefulWidget {
const SettingsView({super.key});

View File

@@ -4,7 +4,15 @@ import 'package:cabo_counter/presentation/views/about/about_view.dart';
import 'package:cabo_counter/presentation/views/home/main_menu_view.dart';
import 'package:flutter/cupertino.dart';
/// A view that provides a tabbed interface for navigating between the main menu and the about section.
/// TabBar for navigating between the main menu and about section.
///
/// [TabView] is a [StatefulWidget] that provides a tabbed interface for navigating
/// between the main menu and the about section of the app. It uses a
/// [CupertinoTabScaffold] with two tabs:
/// - Home (MainMenuView)
/// - About (AboutView)
///
/// The tab labels are provided via localization.
class TabView extends StatefulWidget {
const TabView({super.key});

View File

@@ -1,6 +1,10 @@
import 'package:cabo_counter/core/custom_theme.dart';
import 'package:flutter/cupertino.dart';
/// A customizable button widget using Cupertino style.
///
/// Displays a button with a child widget and optional callback.
/// The button uses a medium size, rounded corners, and a custom background color.
class CustomButton extends StatelessWidget {
final Widget child;
final VoidCallback? onPressed;

View File

@@ -2,6 +2,11 @@ import 'package:cabo_counter/core/custom_theme.dart';
import 'package:cabo_counter/presentation/widgets/custom_stepper.dart';
import 'package:flutter/cupertino.dart';
/// A customizable form row widget with a prefix icon, text, and optional suffix widget.
///
/// Displays a row with an icon and text on the left side.
/// Optionally, a suffix widget (e.g. a stepper) can be shown on the right side.
/// The row is styled as a [CupertinoButton] and can react to taps.
class CustomFormRow extends StatefulWidget {
final String prefixText;
final IconData prefixIcon;

View File

@@ -1,6 +1,17 @@
import 'package:cabo_counter/core/custom_theme.dart';
import 'package:flutter/cupertino.dart'; // Für iOS-Style
/// A custom stepper widget for incrementing and decrementing a value.
///
/// The [CustomStepper] widget allows increasing and decreasing a value
/// within a defined range ([minValue] to [maxValue]) in fixed steps.
///
/// Properties:
/// - [minValue]: The minimum value.
/// - [maxValue]: The maximum value.
/// - [initialValue]: The initial value (optional, defaults to [minValue]).
/// - [step]: The step size.
/// - [onChanged]: Callback triggered when the value changes.
class CustomStepper extends StatefulWidget {
final int minValue;
final int maxValue;