-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide onTap function for BasicEvent type or add a BasicTouchEvent type #11
Comments
Thanks for the feature request! That's definitely a nice feature to have, I'll probably implement it tomorrow morning |
This is now implemented in v0.2.2. For a cleaner separation of concerns (data vs. UI), the |
After thinking a while about this my mind raised a question. Adding the So what would be the solution if I need different callbacks depending on the event? I hope my question is clear. |
While all taps invoke the same lambda, you know the event at creation time of the Timetable<BasicEvent>(
eventBuilder: (event) {
return BasicEventWidget(
event,
onTap: () {
if (event.something) {
// ...
}
},
// or like this:
onTap: () => myOnTapHandler(event),
);
},
);
void myOnTapHandler(BasicEvent event) {
// ...
} I hope this answers your question. |
Hey there, I think it would be helpful if I could touch the basic widget and provide a function to handle the touch. This would allow me for example to mark events in the timetable or perform any other action while touching on the event body.
You could easily write your own Event to support that functionality how ever I think it's such a common thing that the library maybe should provide either a default event type for that (like for example BasicTouchEvent) or allow to give the BasicEvent an onTap function.
In the following I created a new event type to achieve that (basically taking the BasicEvent and just adding the onTap functionality):
From my opinion that would be a good thing to improve the out of the box functionality of the library. Might do a pull request if wished.
Cheers!
The text was updated successfully, but these errors were encountered: