// * Widget for selecting camera trap placement type // * Features: // * - Multiple placement options via radio buttons // * - Localized labels for each placement type // * - Support for initial selection // * Available placement types: // * - Bait station (Kirrung) // * - Water source (Wasserstelle) // * - Forest (Wald) // * - Game pass (Wildwechsel) // * - Path/Road (Weg/Straße) // * - Farm/Garden (Hof/Garten) // * - Meadow/Field (Wiese/Feld/Offenfläche) import 'package:flutter/material.dart'; import 'package:fforte/l10n/app_localizations.dart'; /// Widget for selecting the type of location where the camera trap is placed /// Provides various predefined placement options common in wildlife monitoring class Platzung extends StatefulWidget { /// Callback function when placement type selection changes final Function(String) onPlatzungChanged; /// Initial placement type selection final String? initialPlatzung; const Platzung({ super.key, required this.onPlatzungChanged, this.initialPlatzung, }); @override State createState() => _PlatzungState(); } /// State class for the placement type selection widget class _PlatzungState extends State { /// Currently selected placement type String? _selectedPlatzung; @override void initState() { super.initState(); if (widget.initialPlatzung != "") { _selectedPlatzung = widget.initialPlatzung; } } @override Widget build(BuildContext context) { return Column( children: [ // Bait station placement option ListTile( visualDensity: const VisualDensity(vertical: -4), title: Text(AppLocalizations.of(context)!.kirrung), leading: Radio( value: 'Kirrung', groupValue: _selectedPlatzung, onChanged: (value) { setState(() { _selectedPlatzung = value; widget.onPlatzungChanged(value!); }); }, ), ), // Water source placement option ListTile( visualDensity: const VisualDensity(vertical: -4), title: Text(AppLocalizations.of(context)!.wasserstelle), leading: Radio( value: 'Wasserstelle', groupValue: _selectedPlatzung, onChanged: (value) { setState(() { _selectedPlatzung = value; widget.onPlatzungChanged(value!); }); }, ), ), // Forest placement option ListTile( visualDensity: const VisualDensity(vertical: -4), title: Text(AppLocalizations.of(context)!.wald), leading: Radio( value: 'Wald', groupValue: _selectedPlatzung, onChanged: (value) { setState(() { _selectedPlatzung = value; widget.onPlatzungChanged(value!); }); }, ), ), // Game pass placement option ListTile( visualDensity: const VisualDensity(vertical: -4), title: Text(AppLocalizations.of(context)!.wildwechsel), leading: Radio( value: 'Wildwechsel', groupValue: _selectedPlatzung, onChanged: (value) { setState(() { _selectedPlatzung = value; widget.onPlatzungChanged(value!); }); }, ), ), // Path/Road placement option ListTile( visualDensity: const VisualDensity(vertical: -4), title: Text(AppLocalizations.of(context)!.wegstrasse), leading: Radio( value: 'Weg/Straße', groupValue: _selectedPlatzung, onChanged: (value) { setState(() { _selectedPlatzung = value; widget.onPlatzungChanged(value!); }); }, ), ), // Farm/Garden placement option ListTile( visualDensity: const VisualDensity(vertical: -4), title: Text(AppLocalizations.of(context)!.hofgarten), leading: Radio( value: 'Hof/Garten', groupValue: _selectedPlatzung, onChanged: (value) { setState(() { _selectedPlatzung = value; widget.onPlatzungChanged(value!); }); }, ), ), // Meadow/Field placement option ListTile( visualDensity: const VisualDensity(vertical: -4), title: Text(AppLocalizations.of(context)!.wiesefeld), leading: Radio( value: 'Wiese/Feld/Offenfläche', groupValue: _selectedPlatzung, onChanged: (value) { setState(() { _selectedPlatzung = value; widget.onPlatzungChanged(value!); }); }, ), ), ], ); } }