view property

CalendarView? get view

The displayed view of the SfCalendar.

Implementation

CalendarView? get view => _view;
set view (CalendarView? value)

Change the calendar view programmatically in the SfCalendar.

class MyAppState extends State<MyApp>{

 CalendarController _calendarController = CalendarController();
 @override
 initState(){
   _calendarController.view = CalendarView.week;
   super.initState();
 }

 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     home: Scaffold(
       body: SfCalendar(
         view: CalendarView.month,
         controller: _calendarController,
       ),
     ),
   );
 }
}

Implementation

set view(CalendarView? value) {
  if (value == null || _view == value) {
    return;
  }

  _view = value;
  notifyPropertyChangedListeners('calendarView');
}