endTime property
The end time for an Appointment in SfCalendar.
Defaults to DateTime.now()
.
Note: If this property set with the time prior to the startTime, then the Appointment will render with half hour time period from the startTime.
If the difference between startTime and endTime is greater than 24 hour the appointment will be rendered on the all day panel of the time slot views in SfCalendar.
See also:
- CalendarDataSource.getEndTime, which maps the custom business objects corresponding property to this property.
- isAllDay, which defines whether the event is all-day long or not
- startTime, the date time value in which the appointment will start.
- endTimeZone, the timezone for the end time, the appointment will render by converting the end time based on the endTimeZone, and SfCalendar.timeZone.
- SfCalendar.timeZone, to set the timezone for the calendar.
- The documentation for time zone
Widget build(BuildContext context) {
return Container(
child: SfCalendar(
view: CalendarView.day,
dataSource: _getCalendarDataSource(),
),
);
}
class DataSource extends CalendarDataSource {
DataSource(List<Appointment> source) {
appointments = source;
}
}
DataSource _getCalendarDataSource() {
List<Appointment> appointments = <Appointment>[];
appointments.add(
Appointment(
startTime: DateTime.now(),
endTime: DateTime.now().add(
Duration(hours: 2)),
isAllDay: true,
subject: 'Meeting',
color: Colors.blue,
startTimeZone: '',
endTimeZone: ''
));
return DataSource(appointments);
}
Implementation
DateTime endTime;