werner-scholtz / kalender

An elegantly crafted Flutter calendar UI package.
MIT License
108 stars 29 forks source link

customizing the tiles #29

Closed kayatmin closed 7 months ago

kayatmin commented 9 months ago

Hi, is there a way to customize the tiles? not the event tiles, but just the regular tiles in the calendar.

i'd like to make tiles that are past from DateTime.now show in disabled shaded color.

werner-scholtz commented 9 months ago

I'm not really sure what you mean, maybe a image could help. From what I understand you want to change the background color of the days that are in the past. This goes for the MultiDayView and MonthView.

kayatmin commented 9 months ago

@werner-scholtz thanks for the quick reply!

i'd like to achieve something like the following:

image

where the dark bordered tiles are in the past and shaded with grey strips.. preferably also able to disable the click events for these tiles.

werner-scholtz commented 9 months ago

Aaah okay, I take it you also don't want those area's to allow the user to create events ?

kayatmin commented 9 months ago

yes you're right. i could achieve the behavior by checking the current time against the time range given by the event handler on clicks, however i need a way to make those tiles in the past look different.

werner-scholtz commented 9 months ago

To achieve the background I recommend you create a custom hourLineBuilder that can draw the background where you need it (hourlines), you can take a look at how the time-indicator works for some inspiration.

CalendarView<Event>(
      controller: controller,
      eventsController: eventController,
      viewConfiguration: currentConfiguration,
      tileBuilder: _tileBuilder,
      multiDayTileBuilder: _multiDayTileBuilder,
      scheduleTileBuilder: _scheduleTileBuilder,
      components: CalendarComponents(
        hourLineBuilder: _hourlines
      ),
    );
kayatmin commented 9 months ago

ok, thank you! will dive in deeper.

werner-scholtz commented 9 months ago

Cool let me know if you succeed :+1:

werner-scholtz commented 9 months ago

Hi I was thinking this might be a good example to add to the package, would you be able to do it ?