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:
- CalendarDataSource.resources, the collection of resource to be displayed in the timeline views of SfCalendar.
- ResourceViewSettings, the settings have properties which allow to customize the resource view of the SfCalendar.
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.
See also:
- Appointment, the object to hold the data for the appointment in the calendar.
- TimeRegion, the object to hold the data for the special time region in the calendar.
- SfCalendar.resourceViewHeaderBuilder, to set custom widget for the resource view in the calendar.
resourceViewSettings
, to customize the resource view in the calendar.- Knowledge base: How to add resources
- Knowledge base: How to handle appointments for multiple resources
- Knowledge base: How to customize the resource view
- Knowledge base: How to add appointment for the selected resources using appointment editor
@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);
}
- Mixed-in types
- Annotations
Constructors
-
CalendarResource({String displayName = '', required Object id, ImageProvider<
Object> ? image, Color color = Colors.lightBlue}) - 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.
no setteroverride
- 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.
no setterinherited
Methods
-
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