MonthCellStyle class

Sets the style to customize SfCalendar month cells.

Allows to customize the textStyle, trailingDatesTextStyle, leadingDatesTextStyle, backgroundColor, todayBackgroundColor, leadingDatesBackgroundColor and trailingDatesBackgroundColor in month cells of month view in calendar.

See more:

Widget build(BuildContext context) {
   return Container(
     child: SfCalendar(
       view: CalendarView.month,
       dataSource: _getCalendarDataSource(),
       monthViewSettings: MonthViewSettings(
           dayFormat: 'EEE',
           numberOfWeeksInView: 4,
           appointmentDisplayCount: 2,
           appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
           showAgenda: false,
           navigationDirection: MonthNavigationDirection.horizontal,
           monthCellStyle
               : MonthCellStyle(textStyle: TextStyle(fontStyle: FontStyle.
           normal, fontSize: 15, color: Colors.black),
               trailingDatesTextStyle: TextStyle(
                   fontStyle: FontStyle.normal,
                   fontSize: 15,
                   color: Colors.black),
               leadingDatesTextStyle: TextStyle(
                   fontStyle: FontStyle.normal,
                   fontSize: 15,
                   color: Colors.black),
               backgroundColor: Colors.red,
               todayBackgroundColor: Colors.blue,
               leadingDatesBackgroundColor: Colors.grey,
               trailingDatesBackgroundColor: Colors.grey)),
     ),
   );
 }

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

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

   return DataSource(appointments);
 }
Mixed-in types
Annotations

Constructors

MonthCellStyle({Color? backgroundColor, Color? todayBackgroundColor, Color? trailingDatesBackgroundColor, Color? leadingDatesBackgroundColor, TextStyle? textStyle, @Deprecated('Moved the same [todayTextStyle] to SfCalendar class, ' 'use [todayTextStyle] property from SfCalendar class') TextStyle? todayTextStyle, TextStyle? trailingDatesTextStyle, TextStyle? leadingDatesTextStyle})
Creates a month cell style for month view in calendar.
const

Properties

backgroundColor Color?
The background color to fill the background of the SfCalendar month cell.
final
hashCode int
The hash code for this object.
no setteroverride
leadingDatesBackgroundColor Color?
The background color to fill the background of the SfCalendar leading dates month cell.
final
leadingDatesTextStyle TextStyle?
The text style for the text in the leading dates cell of SfCalendar month view.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textStyle TextStyle?
The text style for the text in the SfCalendar month cells.
final
todayBackgroundColor Color?
The background color to fill the background of the SfCalendar today month cell.
final
todayTextStyle TextStyle?
The text style for the text in the today cell of SfCalendar month view.
final
trailingDatesBackgroundColor Color?
The background color to fill the background of the SfCalendar trailing dates month cell.
final
trailingDatesTextStyle TextStyle?
The text style for the text in the trailing dates cell of SfCalendar month view.
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