resourceViewSettings property
The resource settings allows to customize the resource view of timeline views.
See also:
- CalendarResource, the object which contains the data for the resource in calendar.
dataSource.resources
, the collection of resource to be displayed in the timeline views of SfCalendar.- ResourceViewSettings, which contains options to customize the resource view of calendar.
- resourceViewHeaderBuilder, to set custom widget for the resource header in the calendar.
- Knowledge base: How to customize the resource view
@override
Widget build(BuildContext context) {
return Container(
child: SfCalendar(
view: CalendarView.timelineMonth,
dataSource: _getCalendarDataSource(),
resourceViewSettings: ResourceViewSettings(
visibleResourceCount: 4,
size: 150,
displayNameTextStyle: TextStyle(
fontStyle: FontStyle.italic,
fontSize: 15,
fontWeight: FontWeight.w400)),
),
);
}
}
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);
}
Implementation
final ResourceViewSettings resourceViewSettings;