Repository navigation
✨ Add timeSlotColorBuilder in MultiDayView - #536
lavigarg-simform wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds timeSlotColorBuilder support to MultiDayView to match the existing DayView/WeekView API, enabling per-slot background coloring for business hours, blocked time, etc.
Changes:
- Exposes
timeSlotColorBuilderonMultiDayViewand wires it through to the internal page implementation. - Renders painted slot background layers in
InternalMultiDayViewPagewhen the builder is provided. - Updates the example and changelog to reflect the new capability.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/src/multi_day_view/multi_day_view.dart | Adds the public timeSlotColorBuilder parameter and passes it into the internal page. |
| lib/src/multi_day_view/_internal_multi_day_view_page.dart | Implements slot background painting for MultiDayView using TimeSlotBackgroundPainter. |
| example/lib/widgets/multi_day_view_widget.dart | Demonstrates usage of timeSlotColorBuilder in MultiDayView. |
| CHANGELOG.md | Notes MultiDayView support for timeSlotColorBuilder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
11b163b to
eb5eb28
Compare
de39e80 to
6f57e9e
Compare
| final TimestampCallback? onTimestampTap; | ||
|
|
||
| /// A callback for rendering custom time slot background colors. | ||
| final TimeSlotColorBuilder? timeSlotColorBuilder; |
There was a problem hiding this comment.
Here, instead of providing just color builder, Can you update it to be widget builder? It will be more flexible for users who want to put some image or other illustrations instead of color.
There was a problem hiding this comment.
Agreed, a widget builder is more flexible, and a plain colour still works by returning a ColoredBox. This changes the API of DayView and WeekView as well, so can I do it in a separate PR? timeSlotColorBuilder isn't released yet, so if the follow-up lands before the next release, no users break.
If that works, could you approve this PR?
6f57e9e to
a8177e0
Compare
Description
Extends the existing timeSlotColorBuilder feature (previously available only in DayView and WeekView) to MultiDayView, and extracts the duplicated slot-background building logic into a single shared TimeSlotBackgrounds widget used by all three calendar views.
Changes
Feature —
timeSlotColorBuilderinMultiDayViewMultiDayView(multi_day_view.dart): AddedtimeSlotColorBuilderparameter (TimeSlotColorBuilder?), threaded it through toInternalMultiDayViewPage.InternalMultiDayViewPage(_internal_multi_day_view_page.dart): Renders the slot-background layer inside the scrollableStackwhentimeSlotColorBuilderis non-null, producing one coloured column per visible day.timeSlotColorBuilderusage example to the demo app (highlights business hours, lunch breaks, and weekends).Refactor — Shared
TimeSlotBackgroundswidgetThe inline implementations of
_buildTimeSlotBackground(DayView),_buildWeekTimeSlotBackgrounds(WeekView), and_buildMultiDayTimeSlotBackgrounds(MultiDayView) were all functionally equivalent column-painting logic. They have been replaced with a single shared widget:TimeSlotBackgroundsadded to common_components.dart:List<DateTime> dates(one column per date), so it works for single-day and multi-column layouts.ClipRect + RepaintBoundaryto isolate repaints.Directionality) layout._buildTimeSlotBackground()now delegates toTimeSlotBackgrounds(dates: [widget.date], ...). Pre-existing unused extensions.dart import removed._buildWeekTimeSlotBackgrounds()now delegates toTimeSlotBackgrounds._buildMultiDayTimeSlotBackgrounds()now delegates toTimeSlotBackgrounds.Tests
MultiDayViewtest case that verifies:timeSlotColorBuilderis invoked for every slot on every visible day column (12 unique date-time slot starts for 3 days × 4 half-hour slots in a 9–11 window).TimeSlotBackgroundPainter(findsNWidgets(3)).MultiDayViewaligns page boundaries relative toDateTime.now().Checklist
fix:,feat:,docs:etc).docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues
Closes #535