horario del profesional

This commit is contained in:
Felipe
2024-03-27 16:42:50 -05:00
parent ac16be0406
commit d7fe33cf30
26 changed files with 927 additions and 163 deletions
+19
View File
@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
extension TimeOfDayExtension on TimeOfDay {
TimeOfDay add({int hour = 0, int minute = 0}) {
return replacing(hour: this.hour + hour, minute: this.minute + minute);
}
int compareTo(TimeOfDay other) {
if (hour < other.hour) return -1;
if (hour > other.hour) return 1;
if (minute < other.minute) return -1;
if (minute > other.minute) return 1;
return 0;
}
bool isBefore(TimeOfDay other) {
return compareTo(other) == -1;
}
}
+15
View File
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
import 'package:prosappco/utils/time_of_day_extension.dart';
class TimeOfDayUtils {
static List<TimeOfDay> genRanges(TimeOfDay timeStart, TimeOfDay timeEnd) {
List<TimeOfDay> ranges = [];
TimeOfDay current = timeStart;
while (current.isBefore(timeEnd)) {
ranges.add(current);
// Sumar 2 horas al objeto DateTime
current = current.add(hour: 2);
}
return ranges;
}
}