rwbr / flutter_neat_and_clean_calendar

Simple and clean flutter calendar with ability to slide up/down to show weekly/monthly calendar. Forked from [flutter_clean_calender](https://pub.dev/packages/flutter_clean_calendar)
MIT License
104 stars 51 forks source link

onMonthChanged is not being triggered #67

Closed fbelluco closed 7 months ago

fbelluco commented 8 months ago

Environment

Description

I recently updated to version 0.3.15+35 from 0.2.3+11, which, according to the changelog, includes a fix for the onMonthChanged callback not being triggered. However, I am still experiencing this issue in my application.

Expected Behavior

The onMonthChanged callback should be triggered as documented when changing to a different month.

Actual Behavior

The onMonthChanged callback is not being triggered upon changing months.

Code Snippet

Calendar(
  hideBottomBar: true,
  hideTodayIcon: true,
  startOnMonday: true,
  events: sReserva.hasData && sReserva.data != null
      ? sReserva.data
      : {},
  isExpandable: false,
  isExpanded: true,
  defaultDayColor: Colors.black,
  selectedColor: Colors.blue.shade800,
  todayColor: Colors.black,
  eventListBuilder: (BuildContext context,
      List<NeatCleanCalendarEvent> _selectesdEvents) {
    return SizedBox();
  },
  onDateSelected: (date) async {
    _bloc.inDay.add(date);
    await _bloc.findReserve(date);
    await _bloc.isReserve(date);
  },
  onMonthChanged: (date) async {
    await _bloc.findDays(date); // It won't trigger
  },
  locale:
      localizationDelegate.currentLocale.toString(),
  weekDays: [
    translate("SEMANA.SEG"),
    translate("SEMANA.TER"),
    translate("SEMANA.QUA"),
    translate("SEMANA.QUI"),
    translate("SEMANA.SEX"),
    translate("SEMANA.SAB"),
    translate("SEMANA.DOM"),
  ],
  dayOfWeekStyle: TextStyle(
      color: Colors.black,
      fontWeight: FontWeight.w800,
      fontSize: 11),
  );
jnelle commented 8 months ago

Same issue here and I'm using the same version

FloPMT commented 8 months ago

Same here. Methods nextMonth, nextWeek, previousMonth, previousWeek don't trigger the callbacks

rwbr commented 8 months ago

I can confirm, that onMonthChanged currently only triggers, when the user selects a day in the calendar view, that belongs to another month. Selecting a new date by using the date picker or changing the month by using the arrow buttons doesn't trigger.

jnelle commented 7 months ago

@rwbr this issue can be closed, it was fixed with the last release

rwbr commented 7 months ago

@jnelle Thank you for your confirmation.