Coder Social home page Coder Social logo

Comments (4)

JonasWanke avatar JonasWanke commented on July 26, 2024 1

Thanks for the feature request! That's definitely a nice feature to have, I'll probably implement it tomorrow morning

from timetable.

JonasWanke avatar JonasWanke commented on July 26, 2024 1

This is now implemented in v0.2.2. For a cleaner separation of concerns (data vs. UI), the onTap-parameter can be specified in BasicEventWidget & BasicAllDayEventWidget as opposed to specifying it in BasicEvent.

from timetable.

JonasWanke avatar JonasWanke commented on July 26, 2024 1

While all taps invoke the same lambda, you know the event at creation time of the BasicEventWidget and using code like the following you can also access it in the onTap-handler:

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.

from timetable.

raLaaaa avatar raLaaaa commented on July 26, 2024

After thinking a while about this my mind raised a question. Adding the onTap parameter to the BasicEventWidget sounds legit regarding the seperation of concerns. How ever doesnt this lead to the fact that regardless of the event the onTap` will trigger the same method?

So what would be the solution if I need different callbacks depending on the event? I hope my question is clear.

from timetable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.