initial commit

This commit is contained in:
2025-08-27 23:03:23 +02:00
parent 36ae378cb9
commit ba67074188
6 changed files with 434 additions and 178 deletions
+24 -9
View File
@@ -36,15 +36,6 @@ Widget mono(String s) =>
String fmtTimeOfDay(TimeOfDay t) =>
'${t.hour.toString().padLeft(2, '0')}:${t.minute.toString().padLeft(2, '0')}';
int minutesBetween(TimeOfDay a, TimeOfDay b) {
final aMin = a.hour * 60 + a.minute;
final bMin = b.hour * 60 + b.minute;
final d = bMin - aMin;
if (d <= 0) return 0;
if (d >= 24 * 60) return 24 * 60;
return d;
}
String minutesToHHMM(int minutes) {
final h = minutes ~/ 60;
final m = minutes % 60;
@@ -102,3 +93,27 @@ List<WorkDay> fillMonth(DateTime monthStart, List<WorkDay> existing) {
}
return out;
}
/// "HH:MM:SS" → Minuten (Sekunden ignoriert). Ungültig => null.
int? minutesFromHHMMSS(String? s) {
if (s == null) return null;
final parts = s.split(':');
if (parts.length != 3) return null;
final h = int.tryParse(parts[0]) ?? 0;
final m = int.tryParse(parts[1]) ?? 0;
return h * 60 + m;
}
// Abwesenheitscodes und Labels
const List<String> kAbsenceCodes = ['GZ', 'K', 'U', 'SU', 'T'];
String codeLabel(String? code) {
switch (code) {
case 'GZ': return 'Gleitzeit';
case 'K': return 'Krankenstand';
case 'U': return 'Urlaub';
case 'SU': return 'Sonderurlaub';
case 'T': return 'Training';
default: return '';
}
}
+2 -1
View File
@@ -1,5 +1,6 @@
import 'package:flutter/services.dart';
/// Tippt „HHMM“ und formatiert live zu „HH:MM“ (nur Ziffern erlaubt).
class HHmmInputFormatter extends TextInputFormatter {
const HHmmInputFormatter();
@@ -17,7 +18,7 @@ class HHmmInputFormatter extends TextInputFormatter {
} else {
final hh = digits.substring(0, 2);
final mm = digits.substring(2);
text = '$hh:$mm'; // ← Interpolation statt + ':' +
text = '$hh:$mm';
}
final offset = text.length;