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

Change month by using arrow will trigger onDateSelected on frist day of month #39

Open cypie92 opened 2 years ago

cypie92 commented 2 years ago
image image

I need to run some function in onDateSelected so i can save the date user pressed in a list, but when user press the arrow the onDateSelected will get called and insert first day of month into my list. Is this a bug ?

rwbr commented 2 years ago

Technically it is not a bug. The navigation using these arrows leads to the selection of a new date, which then triggers the callback. But I get your point. There should be a way to differentiate wether the user clicked on a date, tapped an arrow or used the day picker to select a new date.

cypie92 commented 2 years ago

Technically it is not a bug. The navigation using these arrows leads to the selection of a new date, which then triggers the callback. But I get your point. There should be a way to differentiate wether the user clicked on a date, tapped an arrow or used the day picker to select a new date.

and select on any date will trigger the onMonthChanged too from my testing which is not suppose to happen I assume.

rwbr commented 2 years ago

What could be a proper solution? Should the package provide the possibility to assign callback functions for each of the situations?

cypie92 commented 2 years ago

What could be a proper solution? Should the package provide the possibility to assign callback functions for each of the situations?

I tried to use the onMonthChanged callback to remove the first day of month from list when user press arrow but the onMonthChanged get call even the user select a date on the current month so I'm unable to fix that. now I'm trying another package.

rwbr commented 2 years ago

Sure, you are free to use whatever package you want. But this is open source code. I was just asking you for an idea, how it should work.

cypie92 commented 2 years ago

Sure, you are free to use whatever package you want. But this is open source code. I was just asking you for an idea, how it should work.

  1. Select any day of current month shouldn't trigger onMonthChanged
  2. maybe a boolean value to indicate onDateSelected is trigger by user select date or by pressing the arrow
jjvillavicencio commented 1 year ago

Hi, i think the solution is that, allow provide assign different callbacks

rwbr commented 1 year ago

I think I'll add a parameter that controls the behavior of the callback. This parameter will let you select between two modes:

@cypie92 Do you think, that could work for you?