getCalendarDetailsAtOffset property
Get the calendar details by given the Offset by using the getCalendarDetailsAtOffset method.
class _MyHomePageState extends State<MyHomePage> {
final CalendarController _calendarController = CalendarController();
@override
initState() {
_calendarController.selectedDate = DateTime(2021, 11, 22);
_calendarController.displayDate = DateTime(2021, 11, 22);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: MouseRegion(
onHover: (PointerHoverEvent event) {
CalendarDetails? details = _calendarController
.getCalendarDetailsAtOffset!(event.localPosition);
DateTime date = details!.date!;
dynamic appointments = details.appointments;
CalendarElement calendarElement = details.targetElement;
},
child: SfCalendar(
view: CalendarView.month,
controller: _calendarController,
dataSource: _getCalendarDataSource(),
))),
);
}
}
Implementation
CalendarDetailsCallback? getCalendarDetailsAtOffset;