samderlust / calendar_day_view

MIT License
6 stars 11 forks source link

Error in endTime calculating #10

Closed KazantsevLev closed 1 year ago

KazantsevLev commented 1 year ago

Hello! I'm using your widget CategoryCalendarDayView. I found 1 issue, that makes my life harder. In getTimeList method you do not take into account the information about timeEnd/start minutes, and carry out all calculations only with hours. It doesn't make sense. If im trying to make timeEnd = 13:15 => last row to draw will be 13:00 - timeGap (if gap = 15, last row to draw will be 12:45, if gap = 1, last row to draw will be 12:59 and etc.). I hope these note will help you to solve this problem. Thank you for your reply.

List getTimeList({ required TimeOfDay startOfDay, TimeOfDay? endOfDay, required int timeGap, }) { final timeEnd = endOfDay ?? const TimeOfDay(hour: 23, minute: 0);

final timeCount = !!!(PROBLEM IS HERE)!!!=> ((timeEnd.hour - startOfDay.hour) * 60) ~/ timeGap; DateTime first = DateTime.parse( "2012-02-27T${startOfDay.hour.toString().padLeft(2, '0')}:00"); List list = []; for (var i = 1; i <= timeCount; i++) { list.add(TimeOfDay.fromDateTime(first)); first = first.add(Duration(minutes: timeGap)); } return list; }

samderlust commented 1 year ago

@KazantsevLev Hi, I'm sorry for the late response. I didn't got notify of this. what version are you using? could you try 3.0.0-dev.1

samderlust commented 1 year ago

closed as inactive