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,8 +1,18 @@
// * Widget for managing camera trap dismantling dates
// * Features:
// * - Date picker for selecting dismantling date
// * - Date display and reset functionality
// * - Localized text support
import 'package:flutter/material.dart';
import 'package:fforte/l10n/app_localizations.dart';
/// Widget for selecting and displaying camera trap dismantling dates
/// Allows users to pick a date or clear the selection
class AbbauDat extends StatefulWidget {
/// Initial dismantling date, can be null if not set
final DateTime? initAbbauDat;
/// Callback function when date is changed
final Function(DateTime) onDateChanged;
const AbbauDat({super.key, required this.initAbbauDat, required this.onDateChanged});
@@ -11,7 +21,9 @@ class AbbauDat extends StatefulWidget {
State<AbbauDat> createState() => _AbbauDatState();
}
/// State class for the dismantling date widget
class _AbbauDatState extends State<AbbauDat> {
/// Currently selected dismantling date
DateTime? abbauDat;
@override
@@ -25,6 +37,7 @@ class _AbbauDatState extends State<AbbauDat> {
return Row(
children: [
Column(children: [
// Date picker button
SizedBox(
width: 140,
child: ElevatedButton(
@@ -38,34 +51,34 @@ class _AbbauDatState extends State<AbbauDat> {
),
Row(
children: [
const SizedBox(
width: 10,
),
Builder(builder: (context) {
if (abbauDat != null) {
return Text(
'${abbauDat?.day}. ${abbauDat?.month}. ${abbauDat?.year}');
} else {
return Text(AppLocalizations.of(context)!.nichts);
}
}),
const SizedBox(
width: 10,
),
ElevatedButton(
onPressed: () {
setState(() {
abbauDat = null;
});
},
child: const Text("X"))
]),
],
)
const SizedBox(width: 10),
// Display selected date or "nothing" text
Builder(builder: (context) {
if (abbauDat != null) {
return Text(
'${abbauDat?.day}. ${abbauDat?.month}. ${abbauDat?.year}');
} else {
return Text(AppLocalizations.of(context)!.nichts);
}
}),
const SizedBox(width: 10),
// Clear date button
ElevatedButton(
onPressed: () {
setState(() {
abbauDat = null;
});
},
child: const Text("X"))
]),
],
)
],
);
}
/// Show date picker dialog and return selected date
/// @return Future<DateTime?> Selected date or null if cancelled
Future<DateTime?> pickDate() async {
final date = await showDatePicker(
context: context,