textStyle property
Used to specify the text style for TimeRegion text and icon.
See also:
- color, which used to fill the background of 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,
timeZone: 'Eastern Standard Time',
textStyle: TextStyle(color: Colors.black45, fontSize: 15),
color: Colors.grey.withOpacity(0.2),
text: 'Break'));
return regions;
}
Implementation
final TextStyle? textStyle;