simplify: dedupe boilerplate and remove dead code across all layers
This commit is contained in:
@@ -116,12 +116,9 @@ class _OutsideDayColumn extends StatelessWidget {
|
||||
|
||||
static String _subtitleFor(Appointment a) {
|
||||
if (isAllDayLike(a)) return 'Ganztägig';
|
||||
return '${_hm(a.startTime)}–${_hm(a.endTime)}';
|
||||
return '${a.startTime.formatHm()}–${a.endTime.formatHm()}';
|
||||
}
|
||||
|
||||
static String _hm(DateTime t) =>
|
||||
'${t.hour.toString().padLeft(2, '0')}:${t.minute.toString().padLeft(2, '0')}';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (appointments.isEmpty) return const SizedBox.shrink();
|
||||
@@ -182,9 +179,7 @@ class _OutsideChip extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final allDay = isAllDayLike(appointment);
|
||||
final timeLabel = allDay
|
||||
? null
|
||||
: '${appointment.startTime.hour.toString().padLeft(2, '0')}:${appointment.startTime.minute.toString().padLeft(2, '0')}';
|
||||
final timeLabel = allDay ? null : appointment.startTime.formatHm();
|
||||
|
||||
// Past chips fade further, future/ongoing ones get a more saturated tint
|
||||
// so the strip no longer reads as one uniform grey block.
|
||||
|
||||
@@ -289,14 +289,11 @@ class _DayColumn extends StatelessWidget {
|
||||
}
|
||||
|
||||
static String _overflowSubtitle(Appointment apt) {
|
||||
final time = '${_formatHm(apt.startTime)}–${_formatHm(apt.endTime)}';
|
||||
final time = '${apt.startTime.formatHm()}–${apt.endTime.formatHm()}';
|
||||
final loc = apt.location?.replaceAll('\n', ' · ');
|
||||
return loc != null && loc.isNotEmpty ? '$time · $loc' : time;
|
||||
}
|
||||
|
||||
static String _formatHm(DateTime t) =>
|
||||
'${t.hour.toString().padLeft(2, '0')}:${t.minute.toString().padLeft(2, '0')}';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
Reference in New Issue
Block a user