Skip to content

feat: Enhance calendar event data model to support multiple constructors and recursive settings using built-in weekday enums.#510

Open
kavantrivedi wants to merge 1 commit intomasterfrom
fix/use_timeOfDay_instead_DateTime_eventData
Open

feat: Enhance calendar event data model to support multiple constructors and recursive settings using built-in weekday enums.#510
kavantrivedi wants to merge 1 commit intomasterfrom
fix/use_timeOfDay_instead_DateTime_eventData

Conversation

@kavantrivedi
Copy link
Contributor

…a model to use multiple constructors and TimeOfDay where applicable

Description

Added multi-day calendar view support to the desktop demo for better visualization of extended events.
Refactors the calendar event data model to support Multiple constructors and Used TimeOfDay instead of DateTime for only hours and minutes usage.
Refactors the recursive settings model to support in-built enum of weekdays.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

#509
#293

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces significant breaking changes to enhance the calendar event model and add multi-day view support to the desktop demo. The changes refactor the event data structure to use TimeOfDay instead of DateTime for time representation, introduce multiple factory constructors for different event types, and update the recurrence model to use WeekDays enum.

Changes:

  • Refactored CalendarEventData to use TimeOfDay for start/end times and added factory constructors (timeRanged, wholeDay, multiDay) for better API clarity
  • Updated RecurrenceSettings to use WeekDays enum instead of integer indices for weekday representation
  • Added weekDayEnum extension to DateTime and new extensions to TimeOfDay for time manipulation and comparison

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
lib/src/calendar_event_data.dart Refactored to use TimeOfDay for times and added three factory constructors for different event types
lib/src/modals.dart Updated RecurrenceSettings to use WeekDays enum for weekday representation
lib/src/extensions.dart Added weekDayEnum to DateTime, new TimeOfDay extensions (isDayStart, toDateTime, isSameAs), and static copyFromMinutes method
lib/src/event_controller.dart Updated weekday comparison to use WeekDays enum
lib/src/event_arrangers/side_event_arranger.dart Updated to use new TimeOfDay extension methods for duration calculation
lib/src/event_arrangers/merge_event_arranger.dart Updated to use new TimeOfDay extension methods for duration calculation
lib/src/week_view/week_view.dart Changed weekday indexing to use weekDayEnum
lib/src/multi_day_view/multi_day_view.dart Changed weekday indexing to use weekDayEnum
lib/src/month_view/month_view.dart Changed weekday indexing to use weekDayEnum
test/src/event_controller_test.dart Updated tests to use new CalendarEventData API with TimeOfDay
test/extensions_test.dart Refactored to use weekDayEnum extension
test/event_arranger_test/merge_event_arranger_test.dart Updated all test events to use new API
test/custom_sort_test.dart Updated test events to use new API
example/lib/pages/home_page.dart Demonstrated new factory methods with example events
example/lib/widgets/add_event_form.dart Updated to handle TimeOfDay and WeekDays enum
example/lib/widgets/calendar_views.dart Added multi-day view to calendar options
example/lib/widgets/calendar_configs.dart Added multi-day view translation
example/lib/widgets/week_view_widget.dart Removed maxWidth parameter from SideEventArranger
example/lib/widgets/multi_day_view_widget.dart Removed maxWidth parameter and added backgroundColor
example/lib/l10n/*.arb Added translations for new multi-day event examples
example/lib/extension.dart Added TimeOfDayExtension with time formatting
example/lib/enumerations.dart Added multiDay to CalendarView enum

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kavantrivedi kavantrivedi force-pushed the fix/use_timeOfDay_instead_DateTime_eventData branch from 06f9035 to d4453d7 Compare January 12, 2026 13:18
@kavantrivedi kavantrivedi changed the title feat: Enhance demo with multi-day desktop view and refactor event dat… feat: Enhance calendar event data model to support multiple constructors and recursive settings using built-in weekday enums. Jan 12, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@kavantrivedi kavantrivedi force-pushed the fix/use_timeOfDay_instead_DateTime_eventData branch from d4453d7 to e3adbc3 Compare January 13, 2026 07:48
@kavantrivedi kavantrivedi requested a review from Copilot January 13, 2026 07:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…a model to use multiple constructors and TimeOfDay where applicable
@kavantrivedi kavantrivedi force-pushed the fix/use_timeOfDay_instead_DateTime_eventData branch from e3adbc3 to 5b00792 Compare January 13, 2026 08:05
required DateTime date,
required this.date,
required this.startTime,
required this.endTime,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this optional. Start time and end time should not be required in common constructor.

Text(
widget.weekDayStringBuilder?.call(date.weekday - 1) ??
PackageStrings.currentLocale.weekdays[date.weekday - 1],
widget.weekDayStringBuilder?.call(date.weekDayEnum.index) ??
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can update the builders use WeekDays only instead of index. This will increase the readability

Text(
widget.weekDayStringBuilder?.call(date.weekday - 1) ??
PackageStrings.currentLocale.weekdays[date.weekday - 1],
widget.weekDayStringBuilder?.call(date.weekDayEnum.index) ??
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

width: _cellWidth,
child:
_weekBuilder(weekDays[index].weekday - 1),
child: _weekBuilder(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^

right: 0,
startDuration: startTime.copyFromMinutes(eventStart),
endDuration: endTime.copyFromMinutes(eventEnd),
startDuration: TimeOfDayExtension.copyFromMinutes(eventStart)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if this is valid implementation.

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

Successfully merging this pull request may close these issues.

3 participants