Skip to content

custom view View Header sticks and stopped week sweep with Calendar.workweek with 6 days week #1

@div3791

Description

@div3791

I have implemented SfCalendar with the CalendarView.workWeek calendar view and added a custom header and view the header by using this code as a reference. but when I try to set nonworking days: [DateTime.sunday], my calendar stopped week swiping and time slot scrolling.
setState continuously calling.

Here is screen recording video: Video File link

Below is my code:

Expanded(
            child: Theme(
              data: ThemeData.light(),
              child: SfCalendar(
                headerHeight: 0,
                viewHeaderHeight: 0,
                timeSlotViewSettings: TimeSlotViewSettings(
                  timeRulerSize: timeRulerSize,
                  timeIntervalHeight: 100,
                  timeFormat: "hh:mm a",
                  dateFormat: "EEE dd",
                  startHour: 7,
                  nonWorkingDays: [DateTime.sunday],
                  endHour: 19,
                  timeTextStyle: TextStyle(
                      color: Colors.grey.shade400,
                      fontSize: 16,
                      fontFamily: AppFonts.regular),
                ),
                view: calendarView,
                onViewChanged: (ViewChangedDetails viewChangedDetails) {
                  if (calendarView == CalendarView.workWeek) {
                    monthLbl = DateFormat('MMMM yyyy')
                        .format(viewChangedDetails.visibleDates[
                            viewChangedDetails.visibleDates.length ~/ 2])
                        .toString();
                    day1 = viewChangedDetails.visibleDates[0];
                    day2 = viewChangedDetails.visibleDates[1];
                    day3 = viewChangedDetails.visibleDates[2];
                    day4 = viewChangedDetails.visibleDates[3];
                    day5 = viewChangedDetails.visibleDates[4];
                    day6 = viewChangedDetails.visibleDates[5];
                    SchedulerBinding.instance.addPostFrameCallback((duration) {
                      setState(() {});
                    });
                  }
                },
              ),
            ),
          ),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions