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.
example/README.md
Example #
A complete calendar, using only the base CalendarEvent class with no custom fields.
Tapping an empty slot creates an event, and events can be dragged and resized.
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. The
Events guide
covers subclassing CalendarEvent, and the
documentation index
lists the rest.
Runnable 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. |