Files

74 lines
2.1 KiB
Dart

// * Widget for selecting time zone settings (MEZ/MESZ)
// * Features:
// * - Radio button selection between summer and winter time
// * - Localized labels for time zones
// * - Default selection support
import 'package:flutter/material.dart';
import 'package:fforte/l10n/app_localizations.dart';
/// Widget for selecting between summer time (MESZ) and winter time (MEZ)
/// Used to configure camera trap time settings
class MEZ extends StatefulWidget {
/// Callback function when time zone selection changes
final Function(String) onMEZChanged;
/// Initial time zone selection ('sommerzeit' by default)
final String initialMEZ;
const MEZ(
{super.key, required this.onMEZChanged, this.initialMEZ = 'sommerzeit'});
@override
State<MEZ> createState() => _MEZState();
}
/// State class for the time zone selection widget
class _MEZState extends State<MEZ> {
/// Currently selected time zone
String? _selectedMEZ;
@override
void initState() {
super.initState();
_selectedMEZ = widget.initialMEZ;
}
@override
Widget build(BuildContext context) {
return Column(
children: [
// Summer time (MESZ) radio button
ListTile(
visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.sommerzeit),
leading: Radio<String>(
value: 'Sommerzeit',
groupValue: _selectedMEZ,
onChanged: (value) {
setState(() {
_selectedMEZ = value;
widget.onMEZChanged(value!);
});
},
),
),
// Winter time (MEZ) radio button
ListTile(
visualDensity: const VisualDensity(vertical: -4),
title: Text(AppLocalizations.of(context)!.winterzeit),
leading: Radio<String>(
value: 'Winterzeit',
groupValue: _selectedMEZ,
onChanged: (value) {
setState(() {
_selectedMEZ = value;
widget.onMEZChanged(value!);
});
},
),
),
],
);
}
}