kalender 0.24.0-dev.3
kalender: ^0.24.0-dev.3 copied to clipboard
A highly customizable calendar widget with day, multi-day, month and schedule views, drag-and-drop rescheduling, event resizing, and timezone support.
Kalender #
A highly customizable Flutter calendar widget with Day, Multi-day, Month and Schedule views. It supports drag-and-drop rescheduling, event resizing, timezones, and full control over appearance and behavior.
Live Demo · Benchmarks · Migration Guide
Warning
This package is still in development. API changes may occur before version 1.0.0, so pin an exact version in your pubspec.yaml rather than a caret range like ^0.24.0.
1.0.0 is close. If part of the API does not work for you, please open an issue.
Features #
- Four views, one widget. Day, Multi-day, Month and Schedule. Swap the configuration and your events, controllers and styling carry over.
- Reschedule by hand. Drag events between days and times, resize with handles that adapt to mouse, stylus, trackpad and touch, and zoom the day in and out.
- Snapping that fits your app. Snap to an interval, to the time indicator, to other events, or to a rule you write.
- Your data on every event. Subclass
CalendarEventand read your own fields in every builder. There is no fixed event model to work around. - Driven from code too. Controllers navigate, jump to a date and expose what is on screen. Callbacks fire on taps, long presses, event creation and changes.
- Replaceable, not just configurable. Swap any default widget for your own, or keep it and restyle it. Follows your Material 3 theme out of the box.
- Timezone aware. Events are stored as UTC and displayed in any IANA location, so a calendar can show a zone the device is not in.
- Localized, down to the last string. Day and month names come from intl, and every piece of text the calendar writes can be replaced.
Installation #
flutter pub add kalender
If you plan to use location/timezones support, also add:
flutter pub add timezone
If you plan to use locale support, also add:
flutter pub add intl
Quick Start #
The minimal setup, using only the base CalendarEvent class with no custom fields:
import 'package:flutter/material.dart';
import 'package:kalender/kalender.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(body: MyCalendar()),
);
}
}
class MyCalendar extends StatefulWidget {
const MyCalendar({super.key});
@override
State<MyCalendar> createState() => _MyCalendarState();
}
class _MyCalendarState extends State<MyCalendar> {
final eventsController = DefaultEventsController();
final calendarController = CalendarController();
@override
Widget build(BuildContext context) {
return CalendarView(
eventsController: eventsController,
calendarController: calendarController,
viewConfiguration: MultiDayViewConfiguration.week(
// Without this the day opens at midnight.
initialTimeOfDay: const TimeOfDay(hour: 7, minute: 0),
),
callbacks: CalendarCallbacks(
onEventCreated: (event) => eventsController.addEvent(event),
),
header: CalendarHeader(),
body: CalendarBody(),
);
}
}
For a real app you almost always want custom fields on your events. See Custom Events.
Examples #
Runnable apps in examples/:
| Example | Shows |
|---|---|
| Basic | All view types with a toolbar, sample events, and custom tiles. Start here. |
| Advanced | A custom event layout with a lane per person, zoom, and tap-location-aware event creation. |
| Recurrence | Recurring events built on top of the package, which has no recurrence of its own. |
| ICS | Importing and exporting .ics files, expanding RRULE recurrence lazily over the visible range. |
| Riverpod | Sharing the controllers and the selected view through providers. |
| Web demo | The source behind the live demo: every option, theming, locales, and a split view. |
Documentation #
The detailed guides live in doc/:
- Views: the four view families, what carries over when you switch, and each view's configuration class.
- Events: attach your own data by subclassing
CalendarEvent, and what counts as multi-day. - Interaction: creating, rescheduling, resizing, snapping and zooming.
- Controllers & Callbacks: drive the calendar from code, react to the user, and build a toolbar around it.
- Appearance: tile builders, theming, and custom components.
- Layout: where tiles are placed and sized. Advanced, only needed for a custom strategy.
- Timezones & Locales: display timezones, localized names, and custom text.
Contributing #
Contributions are welcome! Please open an issue or pull request on GitHub.
License #
This project is licensed under the MIT License. See the LICENSE file for details.