Skip to content
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

Is there a way to have both dayDetectorBuilder without overriding the onDayTap? #398

Open
linoqui14 opened this issue Aug 13, 2024 · 0 comments

Comments

@linoqui14
Copy link

linoqui14 commented Aug 13, 2024

My very goal is make a calendar (Day) where the passed time slot will have different color indicating that the time is already passed.
The screenshot bellow is the example of that.
Screenshot 2024-08-14 at 1 49 24 AM

I achived that using dayDetectorBuilder but it ovirrieden the onDayTap. I read the documentation and it says you will have your custom PressDetector

The problem is that the dayDetectorBuilder only returns a Date value without time so whenever I click to a time it will just show the Date.

Code

dayDetectorBuilder:({
     required DateTime date,
     required double height,
     required double heightPerMinute,
     required MinuteSlotSize minuteSlotSize,
     required double width,
   }) {
     var now = DateTime.now();
     bool isToday = date.compareWithoutTime(now);
     return Container(
       height:!isToday&&date.isBefore(now)?height: 
       isToday?(DateTime.now().difference(now.withoutTime).inMinutes) * heightPerMinute:0,
       color: BColors.blue.withAlpha(30),
   );
 },

Replicate:

  1. Create a DayView() with dayDetectorBuilder
  2. Add onDayTap()

If you have much better way to do this, please share it to me and I will try to implement it.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant