TimeRegion class

It is used to highlight time slots on day, week, work week and timeline views based on start and end time and also used to restrict interaction on time slots.

Note: If time region have both the text and iconData then the region will draw icon only.

See also:

 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;
 }

Mixed-in types
Annotations

Constructors

TimeRegion({required DateTime startTime, required DateTime endTime, String? text, String? recurrenceRule, Color? color, bool enablePointerInteraction = true, List<DateTime>? recurrenceExceptionDates, List<Object>? resourceIds, String? timeZone, IconData? iconData, TextStyle? textStyle})
Creates a Time region for timeslot views in calendar.

Properties

color Color?
Used to specify the background color of TimeRegion.
final
enablePointerInteraction bool
Used to allow or restrict the interaction of TimeRegion.
final
endTime DateTime
Used to specify the end time of the TimeRegion. endTime value as always greater than or equal to startTime of TimeRegion.
final
hashCode int
The hash code for this object.
no setteroverride
iconData IconData?
Used to specify the icon of TimeRegion.
final
recurrenceExceptionDates List<DateTime>?
Used to restrict the occurrence for an recurrence region.
final
recurrenceRule String?
Used to specify the recurrence of TimeRegion. It used to recur the TimeRegion and it value like 'FREQ=DAILY;INTERVAL=1'
final
resourceIds List<Object>?
The ids of the CalendarResource that shares this TimeRegion.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startTime DateTime
Used to specify the start time of the TimeRegion.
final
text String?
Used to specify the text of TimeRegion.
final
textStyle TextStyle?
Used to specify the text style for TimeRegion text and icon.
final
timeZone String?
Used to specify the time zone of TimeRegion start and end time.
final

Methods

copyWith({DateTime? startTime, DateTime? endTime, String? text, String? recurrenceRule, Color? color, bool? enablePointerInteraction, List<DateTime>? recurrenceExceptionDates, String? timeZone, IconData? iconData, TextStyle? textStyle, List<Object>? resourceIds}) TimeRegion
Creates a copy of this TimeRegion but with the given fields replaced with the new values.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override