zenled / calendar_views

Collection of customisable calendar related widgets for Flutter.
https://pub.dartlang.org/packages/calendar_views
MIT License
102 stars 49 forks source link

Support onTap callback with date and time parameters #8

Closed ryanhz closed 5 years ago

ryanhz commented 5 years ago

It would be useful if there is a callback when you click on any time slot, so as to add event, etc.

ryanhz commented 5 years ago

Never mind, I figured out my way to do it.

vikramkapoor commented 5 years ago

Can you please share the code changes needed for this? I have implemented this by wrapping DayViewSchedule in gestureDetector and then listening to x,y coordinates in onTapDown event. Then I use x,y, scroll positions and fixed offsets to figure out the minute of day and the day column

ryanhz commented 5 years ago

Hi @vikramkapoor, I didn't change the code of this package, but instead, because it is very customizable, you can customize the generatedSupportLineBuilder to response to tap:

SupportLineComponent.intervalGenerated( interval: timelineInterval, generatedSupportLineBuilder: _generatedSupportLineBuilder, ),

instead of return a support line, you can return the line together with InkWell and wrapped them in Stack,