specialRegions property
Defines the collection of special TimeRegion for SfCalendar.
It is used to highlight time slots on day, week, work week and timeline views based on TimeRegion start and end time.
It also used to restrict interaction on time slots.
See also:
- timeRegionBuilder, to set custom widget for the time regions in the calendar
- TimeRegion, to now the details about the special time regions and it's properties in calendar.
- Knowledge base: How to customize special regions with builder
- Knowledge base: How to create time table
- Knowledge base: How to add a special region dynamically using onTap and onViewChanged
- Knowledge base: How to use multiple recurrence rule in special region
- Knowledge base: How to highlight the weekends
- Knowledge base: How to highlight the lunch hours
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 List<TimeRegion>? specialRegions;