Skip to content

Commit 4a24fa2

Browse files
✨ Add MultiDay View option to web example
1 parent 0cc89e4 commit 4a24fa2

9 files changed

Lines changed: 202 additions & 161 deletions

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# [Unreleased- 26 May 2026]
2+
3+
- Added `weekTitleBackgroundColor` to `MultiDayView` to customize the week title background color.
4+
15
# [Unreleased - 11 May 2026]
26

37
- Fixed `MonthViewBuilder` to be generic for improved type safety in `MonthView`. [#524](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/524)

doc/documentation.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ MultiDayView(
476476
// Multi-day configuration
477477
daysInView: 3, // Number of days to display (default is 3)
478478
weekTitleHeight: 50, // Height of week day title
479+
weekTitleBackgroundColor: Colors.grey.shade200, // Background color of week title
479480
showVerticalLines: true, // Show the vertical line between days
480481
showWeekDayAtBottom: false, // Show week day at bottom position
481482
showLiveTimeLineInAllDays: true, // Display live time line in all pages
@@ -1051,6 +1052,45 @@ MonthView(
10511052
* Use `monthViewStyle.showWeekTileBorder` to control week day title border visibility
10521053
* Use `monthViewBuilders.headerBuilder` to customize or completely replace the month header
10531054

1055+
### MultiDay View
1056+
* To customise week number & weekdays use `weekNumberBuilder` & `weekDayBuilder`.
1057+
* Default week day tile color is `multiDayTileColor` in `MultiDayViewThemeData` (defaults to `surfaceContainerHigh`).
1058+
* Use `weekTitleBackgroundColor` to override it per-widget.
1059+
* Default page background color is `pageBackgroundColor` in `MultiDayViewThemeData` (defaults to `surfaceContainerLowest`).
1060+
* Use `backgroundColor` to override it per-widget.
1061+
* Default timeline text color is `timelineTextColor` in `MultiDayViewThemeData` (defaults to `onSurface`).
1062+
* Use `markingStyle` in `DefaultTimeLineMark` to give text style, or `timeLineBuilder` to fully replace the timeline.
1063+
* Default live time indicator color is `liveIndicatorColor` in `MultiDayViewThemeData` (defaults to `primary`).
1064+
* Use `liveTimeIndicatorSettings` to customise it per-widget.
1065+
* Default hour/half hour/quarter hour line color is `hourLineColor` / `halfHourLineColor` / `quarterHourLineColor` in `MultiDayViewThemeData` (all default to `surfaceContainerHighest`).
1066+
* Use `hourIndicatorSettings`, `halfHourIndicatorSettings`, and `quarterHourIndicatorSettings` to customise per-widget.
1067+
* Default vertical line color between days is `verticalLinesColor` in `MultiDayViewThemeData`.
1068+
* To customise the divider between weekdays and full-day events use `dividerSettings`.
1069+
1070+
```dart
1071+
hourIndicatorSettings: HourIndicatorSettings(
1072+
color: Colors.greenAccent,
1073+
lineStyle: LineStyle.dashed,
1074+
),
1075+
showHalfHours: true,
1076+
halfHourIndicatorSettings: HourIndicatorSettings(
1077+
color: Colors.redAccent,
1078+
lineStyle: LineStyle.dashed,
1079+
),
1080+
dividerSettings: DividerSettings(
1081+
thickness: 2,
1082+
height: 2,
1083+
color: Colors.blueAccent,
1084+
indent: 10,
1085+
endIndent: 10,
1086+
),
1087+
```
1088+
1089+
Hide divider in multiday view.
1090+
```dart
1091+
dividerSettings: DividerSettings.none(),
1092+
```
1093+
10541094
# Migration Guides
10551095

10561096
## Migrate from `1.x.x` to latest

example/lib/enumerations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
enum CalendarView { month, day, week }
1+
enum CalendarView { month, day, week, multiday }

example/lib/widgets/calendar_configs.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ class _CalendarConfigState extends State<CalendarConfig> {
126126
case CalendarView.week:
127127
viewName = translate.weekView;
128128
break;
129+
case CalendarView.multiday:
130+
viewName = translate.multidayView;
131+
break;
129132
}
130133
return GestureDetector(
131134
onTap: () => widget.onViewChange(view),

example/lib/widgets/calendar_views.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import '../enumerations.dart';
66
import '../theme/app_colors.dart';
77
import 'day_view_widget.dart';
88
import 'month_view_widget.dart';
9+
import 'multi_day_view_widget.dart';
910
import 'week_view_widget.dart';
1011

1112
class CalendarViews extends StatelessWidget {
@@ -29,7 +30,9 @@ class CalendarViews extends StatelessWidget {
2930
? MonthViewWidget(width: width)
3031
: view == CalendarView.day
3132
? DayViewWidget(width: width)
32-
: WeekViewWidget(width: width),
33+
: view == CalendarView.week
34+
? WeekViewWidget(width: width)
35+
: MultiDayViewWidget(width: width),
3336
),
3437
);
3538
}

example/lib/widgets/multi_day_view_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MultiDayViewWidget extends StatelessWidget {
1616
daysInView: 3,
1717
width: width,
1818
showLiveTimeLineInAllDays: true,
19-
eventArranger: SideEventArranger(maxWidth: 30),
19+
eventArranger: SideEventArranger(),
2020
timeLineWidth: 65,
2121
scrollPhysics: const BouncingScrollPhysics(),
2222
liveTimeIndicatorSettings: LiveTimeIndicatorSettings(

lib/src/calendar_event_data.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import 'package:flutter/material.dart';
66

77
import '../calendar_view.dart';
88

9-
@immutable
10-
119
/// Stores metadata for a calendar event and its date/time boundaries.
10+
@immutable
1211
class CalendarEventData<T extends Object?> {
1312
/// Specifies date on which all these events are.
1413
final DateTime date;
@@ -112,10 +111,10 @@ class CalendarEventData<T extends Object?> {
112111
/// [currentDate] or not.
113112
///
114113
bool occursOnDate(DateTime currentDate) {
115-
return currentDate == date ||
116-
currentDate == endDate ||
117-
(currentDate.isBefore(endDate.withoutTime) &&
118-
currentDate.isAfter(date.withoutTime));
114+
return currentDate.compareWithoutTime(date) ||
115+
currentDate.compareWithoutTime(endDate) ||
116+
(currentDate.withoutTime.isBefore(endDate) &&
117+
currentDate.withoutTime.isAfter(date));
119118
}
120119

121120
/// Returns event data in [Map<String, dynamic>] format.

lib/src/multi_day_view/_internal_multi_day_view_page.dart

Lines changed: 63 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ class InternalMultiDayViewPage<T extends Object?> extends StatefulWidget {
9191
/// Height of week title.
9292
final double weekTitleHeight;
9393

94+
/// Background color of week title
95+
final Color? weekTitleBackgroundColor;
96+
9497
/// Width of week title.
9598
final double weekTitleWidth;
9699

@@ -174,59 +177,64 @@ class InternalMultiDayViewPage<T extends Object?> extends StatefulWidget {
174177
/// This method will be called when user taps on timestamp in timeline.
175178
final TimestampCallback? onTimestampTap;
176179

180+
/// Background color of the calendar page.
181+
final Color? backgroundColor;
182+
177183
/// A single page for week view.
178-
const InternalMultiDayViewPage(
179-
{Key? key,
180-
required this.showVerticalLine,
181-
required this.weekTitleHeight,
182-
required this.weekDayBuilder,
183-
required this.weekNumberBuilder,
184-
required this.width,
185-
required this.dates,
186-
required this.eventTileBuilder,
187-
required this.controller,
188-
required this.timeLineBuilder,
189-
required this.hourIndicatorSettings,
190-
required this.hourLinePainter,
191-
required this.halfHourIndicatorSettings,
192-
required this.quarterHourIndicatorSettings,
193-
required this.dividerSettings,
194-
required this.showLiveLine,
195-
required this.liveTimeIndicatorSettings,
196-
required this.heightPerMinute,
197-
required this.timeLineWidth,
198-
required this.timeLineOffset,
199-
required this.height,
200-
required this.hourHeight,
201-
required this.eventArranger,
202-
required this.verticalLineOffset,
203-
required this.weekTitleWidth,
204-
required this.onTileTap,
205-
required this.onTileLongTap,
206-
required this.onDateLongPress,
207-
required this.onDateTap,
208-
required this.weekDays,
209-
required this.minuteSlotSize,
210-
required this.scrollConfiguration,
211-
required this.startHour,
212-
required this.fullDayEventBuilder,
213-
required this.weekDetectorBuilder,
214-
required this.showWeekDayAtBottom,
215-
required this.showHalfHours,
216-
required this.showQuarterHours,
217-
required this.emulateVerticalOffsetBy,
218-
required this.onTileDoubleTap,
219-
required this.endHour,
220-
required this.onTimestampTap,
221-
this.fullDayHeaderTitle = '',
222-
required this.fullDayHeaderTextConfig,
223-
required this.scrollPhysics,
224-
required this.scrollListener,
225-
required this.multiDayViewScrollController,
226-
this.lastScrollOffset = 0.0,
227-
this.keepScrollOffset = false,
228-
this.showMutliDayBottomLine = true})
229-
: super(key: key);
184+
const InternalMultiDayViewPage({
185+
Key? key,
186+
required this.showVerticalLine,
187+
required this.weekTitleHeight,
188+
required this.weekDayBuilder,
189+
required this.weekNumberBuilder,
190+
required this.width,
191+
required this.dates,
192+
required this.eventTileBuilder,
193+
required this.controller,
194+
required this.timeLineBuilder,
195+
required this.hourIndicatorSettings,
196+
required this.hourLinePainter,
197+
required this.halfHourIndicatorSettings,
198+
required this.quarterHourIndicatorSettings,
199+
required this.dividerSettings,
200+
required this.showLiveLine,
201+
required this.liveTimeIndicatorSettings,
202+
required this.heightPerMinute,
203+
required this.timeLineWidth,
204+
required this.timeLineOffset,
205+
required this.height,
206+
required this.hourHeight,
207+
required this.eventArranger,
208+
required this.verticalLineOffset,
209+
required this.weekTitleWidth,
210+
required this.weekTitleBackgroundColor,
211+
required this.onTileTap,
212+
required this.onTileLongTap,
213+
required this.onDateLongPress,
214+
required this.onDateTap,
215+
required this.weekDays,
216+
required this.minuteSlotSize,
217+
required this.scrollConfiguration,
218+
required this.startHour,
219+
required this.fullDayEventBuilder,
220+
required this.weekDetectorBuilder,
221+
required this.showWeekDayAtBottom,
222+
required this.showHalfHours,
223+
required this.showQuarterHours,
224+
required this.emulateVerticalOffsetBy,
225+
required this.onTileDoubleTap,
226+
required this.endHour,
227+
required this.onTimestampTap,
228+
required this.fullDayHeaderTextConfig,
229+
required this.scrollPhysics,
230+
required this.scrollListener,
231+
required this.multiDayViewScrollController,
232+
this.backgroundColor,
233+
this.fullDayHeaderTitle = '',
234+
this.lastScrollOffset = 0.0,
235+
this.keepScrollOffset = false,
236+
this.showMutliDayBottomLine = true,
237+
}) : super(key: key);
230238

231239
@override
232240
_InternalMultiDayViewPageState<T> createState() =>
@@ -280,6 +288,7 @@ class _InternalMultiDayViewPageState<T extends Object?>
280288
final direction = Directionality.of(context);
281289

282290
return Container(
291+
color: widget.backgroundColor ?? themeColor.pageBackgroundColor,
283292
height: widget.height + widget.weekTitleHeight,
284293
width: widget.width,
285294
child: Column(
@@ -289,7 +298,8 @@ class _InternalMultiDayViewPageState<T extends Object?>
289298
crossAxisAlignment: CrossAxisAlignment.end,
290299
children: [
291300
ColoredBox(
292-
color: themeColor.headerBackgroundColor,
301+
color:
302+
widget.weekTitleBackgroundColor ?? themeColor.multiDayTileColor,
293303
child: SizedBox(
294304
width: widget.width,
295305
child: Row(

0 commit comments

Comments
 (0)