ResourceViewSettings class
The settings have properties which allow to customize the resource view of the SfCalendar.
Allows to customize the visibleResourceCount,showAvatar, size, and displayNameTextStyle in resource view of calendar.
See also:
- CalendarResource, which holds the data for the resource in the
- CalendarDataSource.resources, which used to set and handle the resource collection for the calendar.
- SfCalendar.resourceViewHeaderBuilder, which used to set custom widget for the resource view header in calendar.
- Knowledge base: How to customize the resource view
- Knowledge base: How to add resources
@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);
}
- Mixed-in types
- Annotations
Constructors
- ResourceViewSettings({double size = 75, int visibleResourceCount = -1, bool showAvatar = true, TextStyle? displayNameTextStyle})
-
Creates a resource view settings for calendar.
const
Properties
- displayNameTextStyle → TextStyle?
-
The text style for the text in the CalendarResource view of
SfCalendar.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showAvatar → bool
-
Shows a circle that represents a user.
final
- size → double
-
The size of the resource view panel in timeline views of SfCalendar.
final
- visibleResourceCount → int
-
The number of resources to be displayed in the available screen height in
SfCalendar
final
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 ==(
dynamic other) → bool -
The equality operator.
override