How can I set Directionality widget on SfCalendar properly?

40 views Asked by At

I'm having issues following the documentation of syncfusion. I'm doing it perfectly fine but somehow I manage to get errors. Some part of my code:

selectedDate != null
                ? Expanded(
                    child: Directionality(
                      textDirection: TextDirection.rtl,
                      child: SfCalendar(
                        view: CalendarView.day,
                        initialSelectedDate: _parseDate(selectedDate!),
                        initialDisplayDate: _parseDate(selectedDate!),
                        controller: _calendarController,
                        timeSlotViewSettings: TimeSlotViewSettings(
                          timeIntervalHeight: 120,
                          startHour: 8,
                          endHour: 22,
                          timeFormat: 'HH:mm a',
                        ),
                        viewNavigationMode: ViewNavigationMode.none,
                        dataSource: AppointmentDataSource(fetchedAppointments),
                        onTap: (CalendarTapDetails details) {
                          if (details.targetElement ==
                              CalendarElement.appointment) {
                            final my_models.Appointment appointment =
                                details.appointments![0];
                            // Perform actions based on the clicked appointment
                            print(
                                'Clicked on appointment');
                          }
                        },
                      ),
                    ),
                  )
                : Container(),

For some reason I'm not able to use .rtl here. Somewhere else in another dart file I can use it without any issues. The error I'm having: The getter 'rtl' isn't defined for the type 'TextDirection'. Try importing the library that defines 'rtl', correcting the name to the name of an existing getter, or defining a getter or field named 'rtl'.

Of course, my imports if it matters:

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
import 'package:intl/intl.dart';

It works and running without any issues if I'm not wrapping SfCalendar with Directionality. Maybe I'm not doing that correctly but checking the documentation I'm not seeing any issues. I checked versions and all seems to be updated. Anyone familiar with that problem?

0

There are 0 answers