Allowed view listener
Hello,
i want to catch controller.view when allowed view is changed from view.month to view.timlinemonth ,but on tap method is not including changing allowed view .
Can anyone help me?
Scaffold(
body: SfCalendar(
headerHeight: 60,
showNavigationArrow: true,
viewNavigationMode: ViewNavigationMode.snap,
headerStyle: const CalendarHeaderStyle(
textAlign: TextAlign.center,
backgroundColor: Color(0xff015176),
textStyle: TextStyle(color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20)
),
view: CalendarView.month,
allowedViews: [
CalendarView.day,
CalendarView.week,
CalendarView.month,
CalendarView.timelineMonth
],
viewHeaderHeight: 60,
viewHeaderStyle: ViewHeaderStyle(backgroundColor: Colors.grey,
dayTextStyle: TextStyle(color: Colors.white, fontSize: 15)),
backgroundColor: _calendarColor,
controller: _controller,
initialDisplayDate: DateTime.now(),
todayHighlightColor: Colors.black,
monthViewSettings: MonthViewSettings(showAgenda: true),
timeSlotViewSettings:
TimeSlotViewSettings(timelineAppointmentHeight: 100),
dataSource: MeetingDataSource(_getDataSource()),
appointmentBuilder: appointmentBuilder,
onTap: calendarTapped,
)
void calendarTapped(CalendarTapDetails details) {
if(_controller.view==Month){
isScheduler=false;}else{
isScheduler=true;}
}
SIGN IN To post a reply.
3 Replies
IR
Indumathi Ravichandran
Syncfusion Team
June 29, 2021 07:36 AM UTC
Hi Ergi,
Thank you for contacting Syncfusion support.
Regarding Query: i want to catch controller.view when allowed view is changed from view.month to view.timlinemonth ,but on tap method is not including changing allowed view .
Based on the shared information, we have checked and your requirement is “Getting the calendar view while tapping allowed views”. As per the calendar implementation, by tapping any cells of the calendar, you can get the view from controller. But you can’t get the calendar view from the onTap callback of the calendar through allowed views. Kindly use the onViewChanged callback for achieving your requirement. We have attached the code snippet for the same.
Code snippet:
|
body: SfCalendar(
view: CalendarView.month, controller: _controller, dataSource: _getCalendarDataSource(), allowedViews: [CalendarView.month,CalendarView.timelineMonth,CalendarView.timelineWeek], onViewChanged: viewChanged, ) void viewChanged(ViewChangedDetails viewChangedDetails) { if(_controller.view==CalendarView.month) { // To do your requirement here. } else { // To do your requirement here. } } |
We hope that this helps you. Please let us know if you need further assistance.
Regards,
Indumathi R
EL
Ergi Lamce
June 29, 2021 07:49 AM UTC
Hello
Indumathi,
I want when i click one of allowed views to get the value of what i am clicking.
Is there any possibility?
Thank you!
IR
Indumathi Ravichandran
Syncfusion Team
June 30, 2021 07:12 AM UTC
Hi Ergi,
Thank you for the update.
Regarding Query: I want when i click one of allowed views to get the value of what i am clicking.
We regret to inform you that as per the current implementation of the Flutter Calendar, does not have support to get the view details when click the allowed views label. Please let us know if you require any other assistance. We will be happy to assist you.
Regards,
Indumathi R
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
EL Ergi Lamce
- Jun 28, 2021 12:26 PM UTC
- Jun 30, 2021 07:12 AM UTC