- 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>
21 lines
582 B
Dart
21 lines
582 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:prosapp_web_app/utils/time_of_day_extension.dart';
|
|
|
|
class TimeOfDayUtils {
|
|
static List<TimeOfDay> genRanges(
|
|
TimeOfDay timeStart,
|
|
TimeOfDay timeEnd, {
|
|
int stepMinutes = 30,
|
|
}) {
|
|
final List<TimeOfDay> ranges = [];
|
|
int curr = timeStart.hour * 60 + timeStart.minute;
|
|
final end = timeEnd.hour * 60 + timeEnd.minute;
|
|
final step = stepMinutes.clamp(5, 480);
|
|
while (curr < end) {
|
|
ranges.add(TimeOfDay(hour: curr ~/ 60, minute: curr % 60));
|
|
curr += step;
|
|
}
|
|
return ranges;
|
|
}
|
|
}
|