configurable slot duration: UI picker + genRanges stepMinutes

- Fix TimeOfDayExtension.add() to handle minute overflow via total-minutes math
- genRanges() now takes stepMinutes param (default 30, clamp 5-480)
- Profesional model: slotDurationMinutes field (parsed from slot_duration_minutes)
- ProfessionalFormProvider: saves slot duration alongside schedules on Guardar
- schedule_view: _SlotDurationPicker chip selector (15/20/30/45/60/90/120 min)
- ProfessionalCalendarView + CalendarView: pass slotDurationMinutes to genRanges

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-12 19:25:08 -05:00
co-authored by Claude Sonnet 4.6
parent 46acad0b55
commit 920ae7144d
7 changed files with 105 additions and 20 deletions
+6 -2
View File
@@ -121,7 +121,8 @@ class _CalendarViewState extends State<CalendarView> {
children: [
..._rangesItems(
_getScheduleFromNumDay(numDay, profesional),
context),
context,
stepMinutes: profesional.slotDurationMinutes),
const SizedBox(height: 8),
],
),
@@ -157,7 +158,7 @@ class _CalendarViewState extends State<CalendarView> {
}
}
List<Widget> _rangesItems(ScheduleEntity? schedule, BuildContext context) {
List<Widget> _rangesItems(ScheduleEntity? schedule, BuildContext context, {int stepMinutes = 30}) {
if (schedule == null) {
return [
const Padding(
@@ -187,6 +188,7 @@ class _CalendarViewState extends State<CalendarView> {
List<TimeOfDay> ranges = TimeOfDayUtils.genRanges(
schedule.range1Hour1!,
schedule.range2Hour2!,
stepMinutes: stepMinutes,
);
return rangesItemList(ranges, _services, today, context);
@@ -203,10 +205,12 @@ class _CalendarViewState extends State<CalendarView> {
List<TimeOfDay> ranges1 = TimeOfDayUtils.genRanges(
schedule.range1Hour1!,
schedule.range1Hour2!,
stepMinutes: stepMinutes,
);
List<TimeOfDay> ranges2 = TimeOfDayUtils.genRanges(
schedule.range2Hour1!,
schedule.range2Hour2!,
stepMinutes: stepMinutes,
);
return [