image property
An image that displayed on the CalendarResource view in SfCalendar.
Note: This only applicable when the showAvatar
property set to
true
.
See also:
- ResourceViewSettings, which allows to customize the resource view in the calendar.
- ResourceViewSettings.showAvatar, allows to display the image on the resource view.
- ImageProvider, commonly used to add image in flutter.
- SfCalendar.resourceViewHeaderBuilder, to customize the resource view with a custom widget in calendar.
- Knowledge base: How to add resources
- Knowledge base: How to customize the resource view
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,
image: ExactAssetImage('images/john.png'),
));
return DataSource(appointments, resources);
}
Implementation
final ImageProvider? image;