calendarro
calendarro copied to clipboard
initial dates don't visually update
_calendarro = Calendarro(
key: calendarroStateKey,
startDate: DateTime.now(),
endDate: DateTime.now().add(Duration(days: 60)),
displayMode: DisplayMode.MONTHS,
selectionMode: SelectionMode.MULTI,
dayTileBuilder: MultiPickDayBuilder(),
selectedDates: widget.meeting?.dates ?? [],
onTap: (date) {
setState(() {
...
});
},
);
In the given code, widget.meeting?.dates definitely has dates, but the day tiles are not reflecting that. However reading the data shows the array has the dates and clicking on the day tile unselects it (which does nothing visually because there's nothing to transition out of), then becomes reselectable with the proper visual.
@SwissCheese5 Yes, that's a bug. Working on it ;)
@SwissCheese5 Fixed in Calendarro 1.1.0 :)
@adamstyrc
I am able to repro this in 1.1.0. Selected date is not selected upon calling this function from Build function. It only works on first run. new Calendarro( startDate: DateUtils.getFirstDayOfMonth(startTime), endDate: DateUtils.getLastDayOfMonth(startTime), selectedDate: DateUtils.toMidnight(startTime), ),
Hi! @adamstyrc @SwissCheese5
return Calendarro( startDate: startDate, endDate: endDate, displayMode: DisplayMode.WEEKS, selectionMode: SelectionMode.MULTI, selectedDates: listOfDates, onPageSelected: (DateTime datetime1, DateTime dateTime2) { }, onTap: (date) { if (!listOfDates.contains(date)) { listOfDates.add(date); } else { listOfDates.remove(date); }
setState(() {
});
},
);
List of dates does not get update, Can you please help me regarding this?
Hello @SwissCheese5 did you find any help regarding this, If there is any please help me with the code, I am not getting into it
here is my code
Calendarro( startDate: startDate, endDate: endDate, displayMode: DisplayMode.WEEKS, selectionMode: SelectionMode.MULTI, selectedDates: calendaro.selectedDates, onTap: (date) { if (!listOfDates.contains(date)) { listOfDates.add(date); } else { listOfDates.remove(date); }
calendaro.selectedDates.clear();
calendaro.selectedDates.addAll(listOfDates);
setState(() {
});
},
);
regards
Haven't touched the project I used calendarro in in a long time, sorry. I'll reopen the issue for you though.
Thanks @SwissCheese5
@AbdulBasitSaleem I don't know if this is still useful for you but i fixed this problem by using two differents List<DateTime>:
Calendarro(
startDate: startDate,
endDate: endDate,
selectedDates: datesToSendCalendaro,
displayMode: DisplayMode.MONTHS,
selectionMode: SelectionMode.MULTI,
weekdayLabelsRow: CustomWeekdayLabelsRow(visibleDateString),
onTap: (date) {
if(!datesToSend.contains(date)){
datesToSend.add(date);
}else{
datesToSend.remove(date);
}
},
onPageSelected: (pageStartDate, pageEndDate) {
setState(() {
_updateMonthLabelFromVisibleDate(pageStartDate);
});
})
I initiate datesToSendCalendaro with values at :
@override
void initState() {
super.initState();
initializeDateFormatting();
_checkedMattino=currentWorkerInfo.turn.morning;
_checkedPausaPranzo=currentWorkerInfo.turn.lunch_break;
_checkedPomeriggio=currentWorkerInfo.turn.afternoon;
datesToSend.addAll(datesWorker);
datesToSendCalendaro.addAll(datesToSend);
}
Regards