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

Selecting new date calls onMonthChanged #41

Closed Mmisiek closed 1 year ago

Mmisiek commented 2 years ago

Hi, This is a great plugin but I think there is an issue with onMonthChanged. In my app it is called each time I select new data, even from same month.

It would be cool if you would provide default add event dialog. Thanks Michal

jjvillavicencio commented 1 year ago

Hi, I have the same problem when I select a specific day in the calendar, the plugin calls the MonthChanged event, and the event that should be called is only onDateSelected

rwbr commented 1 year ago

I could change the logic in _launchDateSelectionCallback to only trigger that callback function when the month or the year caged indeed.

    if (widget.onMonthChanged != null && day.month != _selectedDate.month || day.year != _selectedDate.year) {
      widget.onMonthChanged!(day);
    }

I guess that would solve the problem. In case the user selected a different day of the same month the callback would not be called, which should be the correct behavior.