kalender 0.24.0-dev.5
kalender: ^0.24.0-dev.5 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.
- Reschedule by hand. Drag, resize and zoom, on mouse, stylus, trackpad or touch.
- Snapping you control. To an interval, the time indicator, other events, or your own rule.
- No fixed event model. Subclass
CalendarEventand read your own fields anywhere. - Controllers and callbacks. Navigate from code, and react to taps, creation and changes.
- Replaceable, not just configurable. Swap any widget, or keep it and restyle it.
- Material 3 by default. Follows your app's theme with no setup.
- Timezone aware. Events stored as UTC, shown in any IANA location.
- Localized. Day and month names from intl, and every string replaceable.
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
void dispose() {
calendarController.dispose();
eventsController.dispose();
super.dispose();
}
@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 three 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.