endTime property
Used to specify the end time of the TimeRegion. endTime value as always greater than or equal to startTime of TimeRegion.
Defaults to 'DateTime.now()'.
See also:
- startTime, the date time value in which the time region will start.
- timeZone, the time zone for the time region, the region will be render by converting the given time based on timeZone 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.week,
specialRegions: _getTimeRegions(),
),
);
}
List<TimeRegion> _getTimeRegions() {
final List<TimeRegion> regions = <TimeRegion>[];
regions.add(TimeRegion(
startTime: DateTime.now(),
endTime: DateTime.now().add(Duration(hours: 1)),
enablePointerInteraction: false,
color: Colors.grey.withOpacity(0.2),
text: 'Break'));
return regions;
}
Implementation
final DateTime endTime;