CalendarResource class

The resource data for calendar.

An object that contains properties to hold the detailed information about the data, which will be rendered in SfCalendar.

See also:

Note: The resources will render only on the timeline view of SfCalendar, and it's not applicable for other calendar views.

The id property must not be null, to filter appointments based on resource.


@override
 Widget build(BuildContext context) {
   return Container(
     child: SfCalendar(
       view: CalendarView.timelineMonth,
       dataSource: _getCalendarDataSource(),
     ),
   );
 }
}

class DataSource extends CalendarDataSource {
 DataSource(List<Appointment> source, List<CalendarResource> resourceColl) {
   appointments = source;
   resources = resourceColl;
 }
}

DataSource _getCalendarDataSource() {
 List<Appointment> appointments = <Appointment>[];
 List<CalendarResource> resources = <CalendarResource>[];
 appointments.add(Appointment(
     startTime: DateTime.now(),
     endTime: DateTime.now().add(Duration(hours: 2)),
     isAllDay: true,
     subject: 'Meeting',
     color: Colors.blue,
     resourceIds: <Object>['0001'],
     startTimeZone: '',
     endTimeZone: ''));

 resources.add(CalendarResource(
   displayName: 'John',
   id: '0001',
   color: Colors.red
 ));

 return DataSource(appointments, resources);
}

Constructors

CalendarResource({String displayName, @required Object id, ImageProvider<Object> image, Color color})
Creates an resource data for SfCalendar. [...]

Properties

color Color
The color that fills the background of the CalendarResource view in SfCalendar. [...]
final
displayName String
The name which displayed on the CalendarResource view of SfCalendar. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
id Object
The unique id for the CalendarResource view of SfCalendar. [...]
final
image ImageProvider<Object>
An image that displayed on the CalendarResource view in SfCalendar. [...]
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited