color property
Used to specify the background color of TimeRegion.
See also:
- textStyle, which used to customize the style for the text on the time region view.
- iconData, the icon will which will be displayed on the time region view.
- SfCalendar.timeRegionBuilder, to set custom widget for the time regions in the calendar
- Knowledge base: How to customize special regions with builder
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 Color? color;