Skip to content

✨ Replace CalendarThemeProvider with ThemeData.extensions and unify color palette#549

Open
lavigarg-simform wants to merge 2 commits into
feat/schedule-viewfrom
feat/update-theme
Open

✨ Replace CalendarThemeProvider with ThemeData.extensions and unify color palette#549
lavigarg-simform wants to merge 2 commits into
feat/schedule-viewfrom
feat/update-theme

Conversation

@lavigarg-simform

@lavigarg-simform lavigarg-simform commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

This PR removes CalendarThemeProvider and CalendarThemeData in favour of
Flutter's standard ThemeData.extensions mechanism, unifying all package color
tokens into a single CalendarViewColors palette (with matching light and
dark sub-palettes).

What changed:

  • CalendarThemeProvider and CalendarThemeData are deleted. Calendar themes
    are now injected and read exclusively via ThemeData.extensions.
  • A new CalendarViewColors token palette replaces the separate
    LightAppColors/DarkAppColors classes. Each …ViewThemeData seeds its
    .light() and .dark() constructors from the shared palette.
  • All five BuildContext theme accessors (context.dayViewColors,
    context.weekViewColors, context.monthViewColors,
    context.multiDayViewColors, context.scheduleViewColors) are now
    brightness-aware: they fall back to .dark() defaults when the ambient
    Theme brightness is dark and no extension is registered (previously always
    fell back to .light()).
  • ScheduleViewThemeData is introduced with full light/dark/copyWith/
    lerp/merge support.
  • The example app's theme layer is rewritten around a single AppColors
    source-of-truth palette and a new ThemeController (InheritedNotifier)
    for runtime theme-mode switching.

Existing behaviour that changes:
Apps using darkTheme without registering calendar ThemeExtensions will now
receive dark-palette calendar defaults instead of light ones. To preserve
customisations in both modes, register extensions on both theme and
darkTheme — see the updated setup example in doc/documentation.md.

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.

Migration instructions

1. Remove CalendarThemeProvider

// Before
CalendarThemeProvider(
  themeData: CalendarThemeData(dayViewTheme: ...),
  child: MyApp(),
)

// After — register extensions directly on ThemeData
ThemeData.light().copyWith(
  extensions: [DayViewThemeData.light().copyWith(...)],
)

2. Rename multiDayViewTheme → multiDayViewColors

// Before
context.multiDayViewTheme

// After
context.multiDayViewColors

3. Register extensions on darkTheme too

The theme accessors now honour dark-mode brightness. Any app setting
darkTheme: should register the calendar extensions there as well:

MaterialApp(
  theme: ThemeData.light().copyWith(extensions: [...light extensions...]),
  darkTheme: ThemeData.dark().copyWith(extensions: [...dark extensions...]),
)

Related Issues

None

UI Screenshots

Updated UI for the example app home page in mobile and web view

Mobile View 1 Mobile View 2
Web View 1 Web View 2

@lavigarg-simform lavigarg-simform changed the title Feat/update theme ✨ Refactor Theme Management Jun 10, 2026
@lavigarg-simform lavigarg-simform changed the title ✨ Refactor Theme Management ✨ Replace CalendarThemeProvider with ThemeData.extensions and unify color palette Jun 11, 2026
@lavigarg-simform lavigarg-simform marked this pull request as ready for review June 11, 2026 09:29
@kavantrivedi kavantrivedi requested a review from Copilot June 11, 2026 09:42

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 modernizes the package’s theming by removing the custom CalendarThemeProvider / CalendarThemeData layer and switching fully to Flutter’s ThemeData.extensions, while unifying the default color tokens into a single CalendarViewColors palette with light/dark sub-palettes. It also updates the example app to use a single palette source-of-truth and adds runtime theme-mode switching.

Changes:

  • Replaced legacy theme provider/data + Light/Dark token classes with ThemeExtension-based theming and a unified CalendarViewColors palette.
  • Made BuildContext theme accessors brightness-aware when no extension is registered (light vs dark defaults).
  • Reworked the example app’s theming to use AppColors + a ThemeController for ThemeMode switching, and updated docs/changelog for the breaking migration.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
lib/src/theme/week_view_theme_data.dart Seed defaults from CalendarViewColors.light/dark instead of legacy token classes.
lib/src/theme/schedule_view_theme_data.dart Introduces/updates ScheduleView theming with light/dark defaults seeded from unified palette.
lib/src/theme/multi_day_view_theme_data.dart Seed defaults from CalendarViewColors.light/dark.
lib/src/theme/month_view_theme_data.dart Seed defaults from unified palette; rename copyWith param to cellHighlightColor.
lib/src/theme/light_app_colors.dart Removes legacy light token palette class.
lib/src/theme/day_view_theme_data.dart Seed defaults from CalendarViewColors.light/dark.
lib/src/theme/dark_app_colors.dart Removes legacy dark token palette class.
lib/src/theme/calendar_view_colors.dart Adds unified raw design-token palette (light/dark sub-palettes + shared tokens).
lib/src/theme/calendar_theme_data.dart Removes legacy CalendarThemeData wrapper.
lib/src/schedule_view/schedule_view.dart Updates docs to describe ThemeData.extensions-based styling.
lib/src/extensions.dart Makes theme accessors brightness-aware and removes the old multiDayViewTheme accessor extension.
lib/src/calendar_theme_provider.dart Removes legacy CalendarThemeProvider InheritedWidget.
lib/calendar_view.dart Updates public exports to drop legacy theming types.
example/lib/widgets/week_view_widget.dart Simplifies time-slot color logic (removes weekend special-case).
example/lib/widgets/day_view_widget.dart Migrates example usage from provider-based theme lookup to context.dayViewColors.
example/lib/widgets/calendar_configs.dart Reworks settings UI to use themed dropdowns + ThemeController ThemeMode selection.
example/lib/theme/theme_controller.dart Adds ThemeController (InheritedNotifier) to drive runtime ThemeMode switching.
example/lib/theme/dark_app_colors.dart Removes legacy example dark palette class.
example/lib/theme/app_theme.dart Rebuilds example ThemeData around AppColors.light/dark and registers calendar ThemeExtensions on both themes.
example/lib/theme/app_theme_extension.dart Updates example ThemeExtension to seed from AppColors.light/dark instead of a separate dark palette.
example/lib/theme/app_colors.dart Consolidates example palette into AppColors.light/dark plus shared accent constants.
example/lib/pages/web/web_home_page.dart Removes old boolean dark-mode callback wiring.
example/lib/pages/mobile/mobile_home_page.dart Replaces boolean dark-mode toggle with a themed ThemeMode selection dialog.
example/lib/pages/home_page.dart Removes old theme callback plumbing; pages now rely on ThemeController.
example/lib/main.dart Rewires app composition to use ThemeController and a stable EventController.
example/lib/l10n/app_es.arb Updates strings for ThemeMode selection UI (system/light/dark).
example/lib/l10n/app_en.arb Updates strings for ThemeMode selection UI (system/light/dark).
example/lib/l10n/app_ar.arb Updates strings for ThemeMode selection UI (system/light/dark).
example/lib/extension.dart Makes example context.appColors brightness-aware when no extension is registered.
example/lib/constants.dart Updates constants to reference the new AppColors.light palette values.
doc/documentation.md Updates theming documentation and adds migration guidance for removed provider/accessors.
CHANGELOG.md Records breaking theming changes and API renames for the upcoming release.

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

Comment thread example/lib/main.dart
Comment thread lib/src/theme/schedule_view_theme_data.dart
Comment thread lib/src/theme/schedule_view_theme_data.dart
Comment thread lib/src/extensions.dart
…olor palette

Removes CalendarThemeProvider and CalendarThemeData in favor of standard
ThemeData.extensions, unifies all color tokens into a single CalendarViewColors
palette (with matched light/dark sub-palettes), and makes all five BuildContext
theme accessors brightness-aware. Adds ScheduleView theming, updates the example
app to drive all calendar and chrome colors from a single AppColors source of
truth, and introduces runtime theme-mode switching via ThemeController.
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