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.

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);
 }
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. [...]
read-only, override
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.
read-only, inherited
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. [...]
@Deprecated('Moved the same [todayTextStyle] to SfCalendar class, use ' '[todayTextStyle] property from SfCalendar class'), 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

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
override