let AI comment everything because well... yeah...

This commit is contained in:
Nico
2025-06-06 21:00:32 +02:00
parent 9c84d0c375
commit cc110ac104
44 changed files with 1230 additions and 646 deletions

View File

@@ -1,10 +1,19 @@
// * Widget for recording presence of dogs and their leash status during excursions
// * Features:
// * - Dog presence selection (yes/no)
// * - Conditional leash status selection
// * - State persistence via text controllers
// * - Localized labels
import 'package:flutter/material.dart';
import 'package:fforte/l10n/app_localizations.dart';
/// Widget for managing information about dogs during wildlife monitoring
/// Tracks both presence of dogs and whether they are leashed
class HundULeine extends StatefulWidget {
// 1. with dog (ja, bzw name oder nein) 2. with leash
// if nothing selected null
/// Controller for dog presence status (yes/name or no)
final TextEditingController mHund;
/// Controller for leash status
final TextEditingController mLeine;
const HundULeine({super.key, required this.mHund, required this.mLeine});
@@ -13,13 +22,18 @@ class HundULeine extends StatefulWidget {
HundULeineState createState() => HundULeineState();
}
/// State class for the dog and leash selection widget
class HundULeineState extends State<HundULeine> {
/// Currently selected dog presence value
late String _selectedMHundValue;
/// Currently selected leash status value
late String _selectedMLeineValue;
/// Whether to show leash selection options
bool visible = false;
@override
void initState() {
// Initialize dog presence selection
if (widget.mHund.text == "") {
_selectedMHundValue = "nein";
} else {
@@ -27,6 +41,7 @@ class HundULeineState extends State<HundULeine> {
visible = true;
}
// Initialize leash status selection
if (widget.mLeine.text == "") {
_selectedMLeineValue = "nein";
} else {
@@ -36,6 +51,9 @@ class HundULeineState extends State<HundULeine> {
super.initState();
}
/// Update widget state and controller values when selections change
/// @param mHund New dog presence value
/// @param mLeine New leash status value
void onValueChanged(String mHund, String mLeine) {
setState(() {
visible = mHund == "ja" ? true : false;
@@ -50,10 +68,12 @@ class HundULeineState extends State<HundULeine> {
Widget build(BuildContext context) {
return Column(
children: [
// Dog presence section header
Align(
alignment: Alignment.bottomLeft,
child: Text(AppLocalizations.of(context)!.mHund),
),
// Dog presence - Yes option
ListTile(
visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.ja),
@@ -65,6 +85,7 @@ class HundULeineState extends State<HundULeine> {
},
),
),
// Dog presence - No option
ListTile(
visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.nein),
@@ -76,19 +97,14 @@ class HundULeineState extends State<HundULeine> {
},
),
),
// Conditional leash status section
if (visible) ...[
// TextField(
// controller: controller,
// onChanged: (value) {
// onValueChanged("ja", _selectedMLeineValue);
// },
// decoration:
// InputDecoration(hintText: AppLocalizations.of(context)!.name),
// ),
// Leash status section header
Align(
alignment: Alignment.bottomLeft,
child: Text(AppLocalizations.of(context)!.mLeine),
),
// Leash status - Yes option
ListTile(
visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.ja),
@@ -100,6 +116,7 @@ class HundULeineState extends State<HundULeine> {
},
),
),
// Leash status - No option
ListTile(
visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.nein),