Skip to content

feat: add ZetaCalendar component and usage example#429

Open
Ashish3789 wants to merge 11 commits into
ZebraDevs:mainfrom
Ashish3789:WFCNG-48025
Open

feat: add ZetaCalendar component and usage example#429
Ashish3789 wants to merge 11 commits into
ZebraDevs:mainfrom
Ashish3789:WFCNG-48025

Conversation

@Ashish3789

@Ashish3789 Ashish3789 commented May 21, 2026

Copy link
Copy Markdown
calendar_component_example.mp4
widgetbook_calendar_component image
  • Implement ZetaCalendar widget with dual-month inline date range selection
  • Support initialStartDate, initialEndDate, minDate, maxDate props
  • Add onRangeChanged, onApply, onCancel, and onReset callbacks
  • Include year/month picker overlay via ZetaCalendarYearPicker
  • Add CalendarExample page demonstrating range selection, apply, cancel, and reset interactions

- Implement ZetaCalendar widget with dual-month inline date range selection
- Support initialStartDate, initialEndDate, minDate, maxDate props
- Add onRangeChanged, onApply, onCancel, and onReset callbacks
- Include year/month picker overlay via ZetaCalendarYearPicker
- Add CalendarExample page demonstrating range selection, apply, cancel, and reset interactions
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

PR Checks complete

  • ✅ - Linting / Formatting
  • ✅ - Static analysis passed
  • ✅ - All tests passed
  • ✅ - Branch is not behind
  • 📈 - Code coverage: 52.79%
    See details
    File Name%Passing?
    packages/zeta_flutter/lib/src/components/accordion/accordion.dart82.2%
    packages/zeta_flutter/lib/src/components/accordion/accordion_item.dart6.5%⛔️
    packages/zeta_flutter/lib/src/components/accordion/accordion_item_ui.dart88%
    packages/zeta_flutter/lib/src/components/avatar_rail/avatar_rail.dart53.7%⛔️
    packages/zeta_flutter/lib/src/components/avatars/avatar.dart93.1%
    packages/zeta_flutter/lib/src/components/badges/indicator.dart97%
    packages/zeta_flutter/lib/src/components/badges/label.dart100%
    packages/zeta_flutter/lib/src/components/badges/priority_pill.dart96.8%
    packages/zeta_flutter/lib/src/components/badges/status_label.dart100%
    packages/zeta_flutter/lib/src/components/badges/tag.dart95.7%
    packages/zeta_flutter/lib/src/components/bottom sheets/bottom_sheet.dart0%⛔️
    packages/zeta_flutter/lib/src/components/bottom sheets/menu_items.dart0%⛔️
    packages/zeta_flutter/lib/src/components/breadcrumb/breadcrumb.dart86.3%
    packages/zeta_flutter/lib/src/components/button_group/button_group.dart0%⛔️
    packages/zeta_flutter/lib/src/components/buttons/button.dart94.4%
    packages/zeta_flutter/lib/src/components/buttons/button_style.dart97%
    packages/zeta_flutter/lib/src/components/buttons/icon_button.dart67.9%⛔️
    packages/zeta_flutter/lib/src/components/buttons/input_icon_button.dart72.7%⛔️
    packages/zeta_flutter/lib/src/components/buttons/tile_button.dart69%⛔️
    packages/zeta_flutter/lib/src/components/calendar/calendar.dart92.2%
    packages/zeta_flutter/lib/src/components/calendar/calendar_day.dart100%
    packages/zeta_flutter/lib/src/components/calendar/calendar_month.dart100%
    packages/zeta_flutter/lib/src/components/calendar/calendar_year_picker.dart98.1%
    packages/zeta_flutter/lib/src/components/card/card_container.dart87.7%
    packages/zeta_flutter/lib/src/components/chat_item/chat_item.dart98.2%
    packages/zeta_flutter/lib/src/components/chat_item/contact_item.dart0%⛔️
    packages/zeta_flutter/lib/src/components/checkbox/checkbox.dart99%
    packages/zeta_flutter/lib/src/components/chips/assist_chip.dart0%⛔️
    packages/zeta_flutter/lib/src/components/chips/chip.dart81.7%
    packages/zeta_flutter/lib/src/components/chips/filter_chip.dart0%⛔️
    packages/zeta_flutter/lib/src/components/chips/input_chip.dart0%⛔️
    packages/zeta_flutter/lib/src/components/chips/status_chip.dart90.9%
    packages/zeta_flutter/lib/src/components/comms_button/comms_button.dart82%
    packages/zeta_flutter/lib/src/components/date_input/date_input.dart0%⛔️
    packages/zeta_flutter/lib/src/components/dial_pad/dial_pad.dart100%
    packages/zeta_flutter/lib/src/components/dialog/dialog.dart0%⛔️
    packages/zeta_flutter/lib/src/components/dropdown/dropdown.dart35.8%⛔️
    packages/zeta_flutter/lib/src/components/empty_state/empty_state.dart100%
    packages/zeta_flutter/lib/src/components/fabs/fab.dart100%
    packages/zeta_flutter/lib/src/components/filter_selection/filter_selection.dart0%⛔️
    packages/zeta_flutter/lib/src/components/global_header/global_header.dart85.1%
    packages/zeta_flutter/lib/src/components/global_header/header_tab_item.dart0%⛔️
    packages/zeta_flutter/lib/src/components/icon/icon.dart100%
    packages/zeta_flutter/lib/src/components/in_page_banner/in_page_banner.dart98.6%
    packages/zeta_flutter/lib/src/components/list_item/dropdown_list_item.dart0%⛔️
    packages/zeta_flutter/lib/src/components/list_item/list_item.dart0%⛔️
    packages/zeta_flutter/lib/src/components/list_item/list_scope.dart0%⛔️
    packages/zeta_flutter/lib/src/components/list_item/notification_list_item.dart0%⛔️
    packages/zeta_flutter/lib/src/components/navigation bar/navigation_bar.dart92.7%
    packages/zeta_flutter/lib/src/components/navigation_rail/navigation_rail.dart0%⛔️
    packages/zeta_flutter/lib/src/components/pagination/pagination.dart0.6%⛔️
    packages/zeta_flutter/lib/src/components/password/password_input.dart100%
    packages/zeta_flutter/lib/src/components/phone_input/phone_input.dart0%⛔️
    packages/zeta_flutter/lib/src/components/progress/progress.dart0%⛔️
    packages/zeta_flutter/lib/src/components/progress/progress_bar.dart0%⛔️
    packages/zeta_flutter/lib/src/components/progress/progress_circle.dart0%⛔️
    packages/zeta_flutter/lib/src/components/radio/radio.dart0%⛔️
    packages/zeta_flutter/lib/src/components/range_selector/range_selector.dart84.5%
    packages/zeta_flutter/lib/src/components/screen_header_bar/screen_header_bar.dart0%⛔️
    packages/zeta_flutter/lib/src/components/search_bar/search_bar.dart96.1%
    packages/zeta_flutter/lib/src/components/segmented_control/segmented_control.dart0%⛔️
    packages/zeta_flutter/lib/src/components/select_input/select_input.dart0%⛔️
    packages/zeta_flutter/lib/src/components/slider/slider.dart52.4%⛔️
    packages/zeta_flutter/lib/src/components/snack_bar/snack_bar.dart0%⛔️
    packages/zeta_flutter/lib/src/components/stepper/stepper.dart94.6%
    packages/zeta_flutter/lib/src/components/stepper_input/stepper_input.dart71.9%⛔️
    packages/zeta_flutter/lib/src/components/switch/material_switch.dart0%⛔️
    packages/zeta_flutter/lib/src/components/switch/zeta_switch.dart0%⛔️
    packages/zeta_flutter/lib/src/components/system_banner/system_banner.dart85.4%
    packages/zeta_flutter/lib/src/components/tabs/tab.dart0%⛔️
    packages/zeta_flutter/lib/src/components/tabs/tab_bar.dart0%⛔️
    packages/zeta_flutter/lib/src/components/text_input/hint_text.dart75.9%⛔️
    packages/zeta_flutter/lib/src/components/text_input/input_label.dart0%⛔️
    packages/zeta_flutter/lib/src/components/text_input/internal_text_input.dart73.2%⛔️
    packages/zeta_flutter/lib/src/components/text_input/text_input.dart0%⛔️
    packages/zeta_flutter/lib/src/components/time_input/time_input.dart0%⛔️
    packages/zeta_flutter/lib/src/components/tooltip/tooltip.dart97.7%
    packages/zeta_flutter/lib/src/components/top_app_bar/extended_top_app_bar.dart93.9%
    packages/zeta_flutter/lib/src/components/top_app_bar/search_top_app_bar.dart86.6%
    packages/zeta_flutter/lib/src/components/top_app_bar/top_app_bar.dart98.1%
    packages/zeta_flutter/lib/src/components/voice_memo/state/playback_state.dart0%⛔️
    packages/zeta_flutter/lib/src/components/voice_memo/state/recording_state.dart0%⛔️
    packages/zeta_flutter/lib/src/components/voice_memo/state/wav_amplitude_decoder.dart0%⛔️
    packages/zeta_flutter/lib/src/components/voice_memo/state/wav_header.dart0%⛔️
    packages/zeta_flutter/lib/src/components/voice_memo/ui/audio_visualizer.dart0%⛔️
    packages/zeta_flutter/lib/src/components/voice_memo/ui/play_button.dart0%⛔️
    packages/zeta_flutter/lib/src/components/voice_memo/ui/recording_control.dart2.8%⛔️
    packages/zeta_flutter/lib/src/components/voice_memo/ui/voice_memo.dart0%⛔️
    packages/zeta_flutter/lib/src/components/voice_memo/ui/waveform.dart0%⛔️
    packages/zeta_flutter/lib/src/interfaces/audio_decoder.dart0%⛔️
    packages/zeta_flutter/lib/src/interfaces/countries.dart10%⛔️
    packages/zeta_flutter/lib/src/interfaces/form_field.dart81.4%
    packages/zeta_flutter/lib/src/interfaces/phone_number.dart0%⛔️
    packages/zeta_flutter/lib/src/utils/enums.dart100%
    packages/zeta_flutter/lib/src/utils/widget.dart100%
    packages/zeta_flutter_theme/lib/src/breakpoints.dart81.8%
    packages/zeta_flutter_theme/lib/src/color_extensions.dart86.1%
    packages/zeta_flutter_theme/lib/src/color_swatch.dart58.5%⛔️
    packages/zeta_flutter_theme/lib/src/contrast.dart50%⛔️
    packages/zeta_flutter_theme/lib/src/custom_theme.dart55.6%⛔️
    packages/zeta_flutter_theme/lib/src/generated/tokens/primitives.g.dart64.5%⛔️
    packages/zeta_flutter_theme/lib/src/generated/tokens/semantics.g.dart90.5%
    packages/zeta_flutter_theme/lib/src/rounded.dart75%⛔️
    packages/zeta_flutter_theme/lib/src/theme_service.dart17.9%⛔️
    packages/zeta_flutter_theme/lib/src/tokens.dart100%
    packages/zeta_flutter_theme/lib/src/typography.dart81.9%
    packages/zeta_flutter_theme/lib/src/zeta.dart98%
    packages/zeta_flutter_theme/lib/src/zeta_provider.dart93%
    packages/zeta_flutter_theme/lib/src/zeta_theme_override.dart68.4%⛔️
    packages/zeta_flutter_utils/lib/src/debounce.dart100%
    packages/zeta_flutter_utils/lib/src/extensions.dart79.1%⛔️
    packages/zeta_flutter_utils/lib/src/nothing.dart50%⛔️
    packages/zeta_flutter_utils/lib/src/platform/platform_is.dart0%⛔️
    packages/zeta_flutter_utils/lib/src/platform/universal_platform_vm.dart7.1%⛔️
    packages/zeta_icons/lib/src/illustrations.dart0%⛔️

Created with Flutter code quality action

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new inline, dual-month date range selection component (ZetaCalendar) to the Zeta Flutter component library, along with a year/month picker overlay and an example page demonstrating common interactions (range selection, reset, cancel, apply).

Changes:

  • Added ZetaCalendar widget with dual-month range selection, min/max bounds, and footer actions.
  • Added internal calendar building blocks (ZetaCalendarMonth, ZetaCalendarDay, ZetaCalendarYearPicker).
  • Added a new CalendarExample page and wired it into the example app’s component routing.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
packages/zeta_flutter/lib/zeta_components.dart Exports the new calendar component from the library barrel.
packages/zeta_flutter/lib/src/components/calendar/calendar.dart Implements the main dual-month calendar with range selection, navigation, and actions.
packages/zeta_flutter/lib/src/components/calendar/calendar_year_picker.dart Adds an overlay year/month picker used by the calendar header.
packages/zeta_flutter/lib/src/components/calendar/calendar_month.dart Renders a month grid and computes per-day visual states (disabled/in-range/etc.).
packages/zeta_flutter/lib/src/components/calendar/calendar_day.dart Renders individual day cells with selection/range styling.
example/lib/pages/components/calendar_example.dart Demonstrates calendar usage and interactions in the example app.
example/lib/config/components_config.dart Registers the new Calendar example route and deferred import.

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

Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar.dart
Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar.dart
Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar.dart
Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar.dart Outdated
Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar.dart
Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar_year_picker.dart Outdated
Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar_year_picker.dart Outdated
Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar_year_picker.dart Outdated
Comment thread packages/zeta_flutter/lib/src/components/calendar/calendar_day.dart Outdated
Comment thread example/lib/pages/components/calendar_example.dart Outdated
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Visit the preview URL for this PR (updated for commit 52e4391):

https://zeta-flutter-main--pr-429-wfcng-48025-h3saz5nu.web.app

(expires Mon, 22 Jun 2026 16:31:52 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 5ca681de0a0ad9185b252304c113355d5ee04ca6

…etbook

Enhance `packages/zeta_flutter/lib/src/components/calendar/calendar.dart`
with configurable multi-month display, initial range support, min/max bounds,
range callbacks, and apply/cancel/reset actions.

Add `widgetbook/lib/src/components/calendar.widgetbook.dart` use case to
preview `ZetaCalendar` with knobs (including pre-selected range and month count).

Add `example/lib/pages/components/calendar_example.dart` to demonstrate
interactive range selection, formatted selected state, and action feedback.
…etbook

Enhance `packages/zeta_flutter/lib/src/components/calendar/calendar.dart`
with configurable multi-month display, initial range support, min/max bounds,
range callbacks, and apply/cancel/reset actions.

Add `widgetbook/lib/src/components/calendar.widgetbook.dart` use case to
preview `ZetaCalendar` with knobs (including pre-selected range and month count).

Add `example/lib/pages/components/calendar_example.dart` to demonstrate
interactive range selection, formatted selected state, and action feedback.
…etbook

Enhance `packages/zeta_flutter/lib/src/components/calendar/calendar.dart`
with configurable multi-month display, initial range support, min/max bounds,
range callbacks, and apply/cancel/reset actions.

Add `widgetbook/lib/src/components/calendar.widgetbook.dart` use case to
preview `ZetaCalendar` with knobs (including pre-selected range and month count).

Add `example/lib/pages/components/calendar_example.dart` to demonstrate
interactive range selection, formatted selected state, and action feedback.
@thelukewalton thelukewalton requested review from aygurs and Copilot May 26, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@thelukewalton thelukewalton left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry for not reviewing this yet, I have been very busy. @aygurs Please can you review and if its good merge

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 17 out of 18 changed files in this pull request and generated 3 comments.

Comment on lines +182 to +186
if (date.isBefore(_startDate!)) {
_endDate = _startDate;
_startDate = date;
} else if (date.isAtSameMomentAs(_startDate!)) {
_startDate = null;
Comment on lines +16 to +44
final minYearOffset = context.knobs.object.dropdown(
label: 'Min date (years from now)',
options: [-10, -5, -3, -1, 0],
labelBuilder: (value) => value == 0 ? 'Today' : '$value years',
initialOption: -5,
);
final maxYearOffset = context.knobs.object.dropdown(
label: 'Max date (years from now)',
options: [0, 1, 3, 5, 10],
labelBuilder: (value) => value == 0 ? 'Today' : '+$value years',
initialOption: 5,
);

return ZetaCalendar(
visibleMonthCount: context.knobs.object.dropdown(
label: 'Number of months',
options: [1, 2, 3],
labelBuilder: (value) => '$value',
initialOption: 2,
),
initialStartDate: preSelect ? DateTime(now.year, now.month, 10) : null,
initialEndDate: preSelect ? DateTime(now.year, now.month + 1, 15) : null,
minDate: DateTime(now.year + minYearOffset),
maxDate: DateTime(now.year + maxYearOffset),
onRangeChanged: (range) {},
onApply: (range) {},
onCancel: () {},
onReset: () {},
);
Comment on lines +155 to +160
..._buildWeeks(daysInMonth, firstWeekday, colors),
],
);
}

List<Widget> _buildWeeks(int daysInMonth, int firstWeekday, ZetaColors colors) {
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.

4 participants