Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# [Unreleased - 11 May 2026]

- [BREAKING] Added `BuildContextExtension` to public API for theme access.
- Added `ScheduleView`, a scrollable, agenda-style calendar that groups events by day and month. [#101](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/101)
- Added localized `months` and `monthsAbbr` fields to `CalendarLocalizations`, with the `DateTime.getMonthName({abbreviated})` and `DateTime.getMonthYear({abbreviatedMonth})` extensions.
- [BREAKING] Changed `RecurrenceSettings.weekdays` type from `List<int>` to `List<WeekDays>`. [#509](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/509)
- [BREAKING] `WeekDayBuilder`'s parameter changed from `int day` to `WeekDays weekDay`.
- [BREAKING] Removed `startTime` and `endTime` from `CalendarEventData` constructor and `copyWith` parameters. Time is now embedded in the `date` and `endDate` `DateTime` parameters. [#231](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/231)
Expand Down
133 changes: 133 additions & 0 deletions doc/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This package is a comprehensive Flutter solution that enables you to easily impl
- Day View
- Week View
- MultiDay View
- Schedule View
- Highly customisable UI components
- Manage events (add, remove, update)
- Manage reminders (add, remove, update)
Expand Down Expand Up @@ -109,6 +110,14 @@ Scaffold(
);
```

### Schedule View

```dart
Scaffold(
body: ScheduleView(),
);
```

## Managing Events

### Adding an event
Expand Down Expand Up @@ -553,6 +562,84 @@ MultiDayView(
);
```

## Schedule View Customization

`ScheduleView` is a scrollable, agenda-style calendar that groups events by day and month. Months are built lazily as they scroll into view, and the list is anchored at `initialDay`.

```dart
ScheduleView(
controller: EventController(),
// Anchor and date boundaries
initialDay: DateTime.now(), // Date pinned to the top of the viewport
minDay: DateTime(2000), // Earliest date the view will display
maxDay: DateTime(2050), // Latest date the view will display
// Which days/months are rendered
showEmptyMonths: true, // Render months that contain no events (default true)
showDaysWithoutEvents: false, // Render a row for every day, even empty ones (default false)
// Date placement
dateLayout: ScheduleDateLayout.left, // .left (date column) or .top (full-width date header)
// Custom builders
monthHeaderBuilder: (date) => Text(date.getMonthYear()),
dateHeaderBuilder: (date, events, layout) => Text('${date.day}'),
// dayDetectorBuilder takes full control of the date column, including gestures.
// When set, onDateTap / onDateLongPress are ignored.
dayDetectorBuilder: (date, events, layout) => Container(),
eventTileBuilder: (event, date) => ListTile(
leading: CircleAvatar(backgroundColor: event.color),
title: Text(event.title),
),
emptyMonthBuilder: (date) => Text('No events this month'), // Replaces empty months (showEmptyMonths must be true)
emptyTextWidget: Text('No events'), // Empty-day placeholder (needs showDaysWithoutEvents: true)
todayEmptyWidget: Text('Nothing planned today'), // Takes precedence over emptyTextWidget for today
// Floating month header pinned above the scroll view
floatingMonthHeaderBuilder: (context, visibleMonth) => Padding(
padding: const EdgeInsets.all(12),
child: Text(visibleMonth.getMonthYear()),
),
onVisibleMonthChanged: (month) => print('Visible month: $month'),
// Sentinels shown once the scroll limits are reached
pastSentinelBuilder: (context) => const Center(child: Text('Start of calendar')),
futureSentinelBuilder: (context) => const Center(child: Text('End of calendar')),
// I18n / formatting for the default renderers
dateStringBuilder: (date, {secondaryDate}) => date.getMonthYear(),
weekDayStringBuilder: (weekday) => ['M', 'T', 'W', 'T', 'F', 'S', 'S'][weekday - 1],
// Sort events within a single day (defaults to ascending start time)
eventSorter: (a, b) => a.title.compareTo(b.title),
// Divider beneath the default date header in ScheduleDateLayout.top
defaultDateHeaderDividerSettings: DividerSettings(thickness: 1, color: Colors.grey),
// Event callbacks (each receives a single-element list + the date)
onEventTap: (events, date) => print(events),
onEventDoubleTap: (events, date) => print(events),
onEventLongTap: (events, date) => print(events),
onDateTap: (date) => print('Tapped: $date'),
onDateLongPress: (date) => print('Long pressed: $date'),
// Boundary callbacks (fire once when each end of the range is reached)
onHasReachedStart: () => print('Reached earliest available month'),
onHasReachedEnd: () => print('Reached latest available month'),
// Appearance
backgroundColor: Colors.white,
width: 400, // Explicit width; null fills available space
scrollPhysics: const BouncingScrollPhysics(),
);
```

### Navigating programmatically

Use a `GlobalKey<ScheduleViewState>` to jump to a specific date. The target date is pinned to the top of the viewport, with earlier days reachable by scrolling up.

```dart
final key = GlobalKey<ScheduleViewState>();

ScheduleView(key: key);

key.currentState?.jumpToDate(DateTime(2026, 1, 1));
```

### Sparse vs. dense rendering

- **Dense (default)** — `showEmptyMonths: true` always renders every month in range, and/or `showDaysWithoutEvents: true` renders a row for every day.
- **Sparse** — set `showEmptyMonths: false` (with `showDaysWithoutEvents: false`) so only days with events (plus today) render, and the scrollable range is clamped to the actual extent of the controller's events. This keeps the view responsive even when `minDay`/`maxDay` span decades.

## Show Only Working Days in `WeekView`

You can control visible weekdays using the `weekDays` parameter:
Expand Down Expand Up @@ -857,6 +944,7 @@ The package supports dark mode out of the box. Each calendar view has a dedicate
| `DayViewThemeData` | `DayView` |
| `WeekViewThemeData` | `WeekView` |
| `MultiDayViewThemeData` | `MultiDayView` |
| `ScheduleViewThemeData` | `ScheduleView` |

## Default colours

Expand Down Expand Up @@ -926,6 +1014,25 @@ The package supports dark mode out of the box. Each calendar view has a dedicate
| `headerTextColor` | `onPrimary` |
| `headerBackgroundColor` | `primary` |

### ScheduleViewThemeData

| Property | Default (light) |
|----------|----------------|
| `todayHighlightColor` | `primary` |
| `todayTextColor` | `onPrimary` |
| `dateTextColor` | `onSurface` |
| `weekdayTextColor` | `outlineVariant` |
| `dateDividerColor` | `outlineVariant` |
| `emptyContentColor` | `emptyContent` |
| `eventTitleColor` | `onSurface` |
| `eventSecondaryTextColor` | `outline` |
| `eventTileAlpha` | `28` (light) / `45` (dark) |
| `eventTimeColorLightnessAdjust` | `-0.1` (light) / `0.0` (dark) |
| `monthHeaderTextColor` | `monthHeaderText` |
| `monthHeaderGradientStartColor` | `transparent` |
| `monthHeaderGradientEndColor` | `monthHeaderGradientEnd` |
| `monthHeaderTextShadowColor` | `monthHeaderTextShadow` |

To customise `MonthView`, `DayView`, `WeekView` & `MultiDayView` page header use `HeaderStyle`.

```dart
Expand Down Expand Up @@ -953,6 +1060,7 @@ There are two main ways to customize the theme for calendar views:
dayViewTheme: DayViewThemeData.light(),
weekViewTheme: WeekViewThemeData.light(),
multiDayViewTheme: MultiDayViewThemeData.light(),
scheduleViewTheme: ScheduleViewThemeData.light(),
),
child: YourApp(),
)
Expand All @@ -973,6 +1081,7 @@ There are two main ways to customize the theme for calendar views:
DayViewThemeData.light(),
WeekViewThemeData.light(),
MultiDayViewThemeData.light(),
ScheduleViewThemeData.light(),
],
);
```
Expand Down Expand Up @@ -1112,6 +1221,30 @@ Hide divider in multiday view.
dividerSettings: DividerSettings.none(),
```

### Schedule View
* All schedule colours resolve from `ScheduleViewThemeData` (`context.scheduleViewColors`), falling back to `.light()` / `.dark()` based on `Theme.of(context).brightness`.
* Today's date badge uses `todayHighlightColor` (background) and `todayTextColor` (number). Other dates use `dateTextColor`, and weekday abbreviations use `weekdayTextColor`.
* Event tiles tint the event's own colour by `eventTileAlpha`; the time label is adjusted by `eventTimeColorLightnessAdjust`. Title and secondary text use `eventTitleColor` and `eventSecondaryTextColor`.
* Empty-state labels (per-day placeholder and the past/future sentinels) use `emptyContentColor`.
* The month-header image overlay uses `monthHeaderGradientStartColor` → `monthHeaderGradientEndColor`, with `monthHeaderTextColor` and `monthHeaderTextShadowColor` for the title.
* In `ScheduleDateLayout.top`, the divider beneath the default date header uses `dateDividerColor`; override it per-widget with `defaultDateHeaderDividerSettings` (use `DividerSettings.none()` to hide it).

```dart
CalendarThemeProvider(
calendarTheme: CalendarThemeData(
monthViewTheme: MonthViewThemeData.light(),
dayViewTheme: DayViewThemeData.light(),
weekViewTheme: WeekViewThemeData.light(),
multiDayViewTheme: MultiDayViewThemeData.light(),
scheduleViewTheme: ScheduleViewThemeData.light().copyWith(
todayHighlightColor: Colors.blue,
eventTileAlpha: 40,
),
),
child: YourApp(),
)
```

# Migration Guides

## Migrating from 2.x.x to latest
Expand Down
Binary file added example/assets/images/april_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/august_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/december_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/february_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/january_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/july_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/june_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/march_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/may_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/november_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/october_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/assets/images/september_header.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion example/lib/enumerations.dart
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
enum CalendarView { month, day, week, multiday }
/// Defines the type of calendar view.
enum CalendarView { month, day, week, multiday, schedule }

/// Defines the months of the year.
enum Months {
january,
february,
march,
april,
may,
june,
july,
august,
september,
october,
november,
december,
}
83 changes: 73 additions & 10 deletions example/lib/extension.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import 'package:calendar_view/calendar_view.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

import 'enumerations.dart';
import 'l10n/app_localizations.dart';
import 'localization/locale_controller.dart';
import 'theme/app_colors.dart';
import 'theme/app_theme_extension.dart';

Expand All @@ -13,9 +16,33 @@ extension NavigatorExtention on BuildContext {

void pop([dynamic value]) => Navigator.of(this).pop(value);

void showSnackBarWithText(String text) => ScaffoldMessenger.of(this)
void showSnackBarWithText(
String text, {
Duration duration = const Duration(seconds: 3),
}) => ScaffoldMessenger.of(this)
..hideCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(text)));
..showSnackBar(SnackBar(content: Text(text), duration: duration));
}

extension MonthHeaderImageExtension on Months {
/// Returns the asset path for this month's header image.
String get imagePath {
const paths = [
'assets/images/january_header.jpg',
'assets/images/february_header.jpg',
'assets/images/march_header.jpg',
'assets/images/april_header.jpg',
'assets/images/may_header.jpg',
'assets/images/june_header.jpg',
'assets/images/july_header.jpg',
'assets/images/august_header.jpg',
'assets/images/september_header.jpg',
'assets/images/october_header.jpg',
'assets/images/november_header.jpg',
'assets/images/december_header.jpg',
];
return paths[index];
}
}

extension DateUtils on DateTime {
Expand All @@ -40,12 +67,15 @@ extension DateUtils on DateTime {
);

String dateToStringWithFormat({String format = 'y-M-d'}) {
return DateFormat(format).format(this);
// Localize the digits of the formatted date so non-Latin locales
// (Arabic, Hindi, …) render their own numerals instead of `0-9`.
return PackageStrings.localizeNumberString(DateFormat(format).format(this));
}

String getTimeInFormat(TimeStampFormat format) => DateFormat(
'h:mm${format == TimeStampFormat.parse_12 ? " a" : ""}',
).format(this).toUpperCase();
/// Formats the time component, delegating to [TimeOfDayExtension] so both
/// the digits and the AM/PM marker follow the current package locale.
String getTimeInFormat(TimeStampFormat format) =>
TimeOfDay.fromDateTime(this).getTimeInFormat(format);
}

extension ColorExtension on Color {
Expand All @@ -58,17 +88,26 @@ extension ColorExtension on Color {
}

extension TimeOfDayExtension on TimeOfDay {
/// Formats the time as a string (e.g., "2:30 PM" or "14:30")
/// Formats the time as a localized string (e.g., "2:30 p. m." or "14:30").
///
/// Digits are localized via [PackageStrings.localizeNumberString] and the
/// AM/PM marker via the current locale's [CalendarLocalizations], so both
/// follow the locale set through [PackageStrings.setLocale].
String getTimeInFormat(TimeStampFormat format) {
final locale = PackageStrings.currentLocale;
if (format == TimeStampFormat.parse_12) {
final period = hour >= 12 ? 'PM' : 'AM';
final period = hour >= 12 ? locale.pm : locale.am;
final displayHour = hour == 0 ? 12 : (hour > 12 ? hour - 12 : hour);
final minuteStr = minute.toString().padLeft(2, '0');
return '$displayHour:$minuteStr $period';
// Localize the whole "h:mm" chunk at once to keep the leading zero.
final time = PackageStrings.localizeNumberString(
'$displayHour:$minuteStr',
);
return '$time $period';
} else {
final hourStr = hour.toString().padLeft(2, '0');
final minuteStr = minute.toString().padLeft(2, '0');
return '$hourStr:$minuteStr';
return PackageStrings.localizeNumberString('$hourStr:$minuteStr');
}
}
}
Expand All @@ -79,6 +118,30 @@ extension BuildContextExtension on BuildContext {
AppThemeExtension.light();
}

extension LocalizedDateExtension on DateTime {
/// Returns the day-of-month as a localized string, rebuilding the widget
/// whenever the locale changes via [LocaleController].
String localizedDay(BuildContext context) {
LocaleController.of(context);
return PackageStrings.localizeNumber(day);
}

/// Returns the date formatted as a localized short date (e.g. "6/4/2026")
/// using the current Flutter locale from [context].
///
/// `intl` provides the locale-aware field order and separators (e.g. the
/// RTL layout for Arabic), but its generic `ar` data carries no native
/// digits, so the digits are localized afterwards through
/// [PackageStrings.localizeNumberString] to stay consistent with
/// [localizedDay].
String localizedShortDate(BuildContext context) {
final locale = Localizations.localeOf(context).toString();
return PackageStrings.localizeNumberString(
DateFormat.yMd(locale).format(this),
);
}
}

extension Translate on BuildContext {
AppLocalizations get translate => AppLocalizations.of(this)!;
}
19 changes: 17 additions & 2 deletions example/lib/l10n/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dayView": "عرض يومي",
"weekView": "عرض أسبوعي",
"multidayView": "عرض متعدد الأيام",
"scheduleView": "عرض الجدول الزمني",
"appTitle": "مثال صفحة تقويم فلاتر",
"projectMeetingTitle": "اجتماع المشروع",
"projectMeetingDesc": "اليوم هو اجتماع المشروع.",
Expand All @@ -17,7 +18,7 @@
"weddingAnniversaryDesc": "حضور ذكرى زواج العم.",
"footballTournamentTitle": "بطولة كرة القدم",
"footballTournamentDesc": "الذهاب إلى بطولة كرة القدم.",
"sprintMeetingTitle": "اجتماع Sprint",
"sprintMeetingTitle": "اجتماع السبرينت",
"sprintMeetingDesc": "آخر يوم لتسليم المشروع للسنة الماضية.",
"teamMeetingTitle": "اجتماع الفريق",
"teamMeetingDesc": "اجتماع الفريق",
Expand Down Expand Up @@ -119,5 +120,19 @@
"lateNightWorkTitle": "عمل متأخر في الليل",
"lateNightWorkDesc": "اختبار حدود نهاية اليوم",
"companyRetreatTitle": "رحلة شركة",
"companyRetreatDesc": "اختبار حدث متعدد الأيام طوال اليوم"
"companyRetreatDesc": "اختبار حدث متعدد الأيام طوال اليوم",
"doctorsAppointmentTitle": "موعد مع الطبيب",
"doctorsAppointmentDesc": "فحص شهري دوري",
"today": "اليوم",
"scheduleAllDay": "طوال اليوم",
"scheduleNoEvents": "لا توجد خطط. اضغط للإنشاء!",
"scheduleNoEventsThisMonth": "لا أحداث هذا الشهر",
"scheduleTodayNoEvents": "لا توجد أحداث اليوم. استمتع بيومك!",
"scheduleLongPressed": "ضغط مطوّل",
"scheduleSettings": "إعدادات الجدول",
"scheduleShowDaysWithoutEvents": "إظهار الأيام بدون أحداث",
"scheduleShowEmptyMonths": "إظهار الأشهر الفارغة",
"scheduleDateLayout": "تخطيط التاريخ",
"scheduleDateLayoutLeft": "عمود",
"scheduleDateLayoutTop": "صف"
}
Loading
Loading