Search code examples
flutterdartsetstatestate-managementsfcalendar

Widget wont refresh with setstate sfcalendar custom agenda


The Picture shows how it should look like. But in my App, the agenda is inside a TAB!

this is how it schould look like at the end. except my agenda is inside a TabCan anyone tell me why my code wont work?

I am trying to display data from DataSource but it wont show up! (SFCalendar - Custom Agenda)

(Basically - to get it to show my appointments in a separate widget "far up the tree" <onTap: calendarTapped>)

I recreated the code on github since its too much code for stackoverflow - i guess its easier with vcs anyway:

https://github.com/panval/sfcalcustagenda.git

I simply can't manage to get it to work! What am I missing?


Solution

  • You arent passing the selected item on Tabs widget. You can use constructor the way you did for CustomAgenda.

    class Tabs extends StatefulWidget {
      Tabs({Key? key, required this.appointmentDetails});
    

    and use

       CustomAgenda(appointmentDetails: widget.appointmentDetails),
    

    You can remove the state variable from here.