Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update events of one day dynamicly? #29

Open
Gones opened this issue Sep 16, 2021 · 4 comments
Open

How to update events of one day dynamicly? #29

Gones opened this issue Sep 16, 2021 · 4 comments

Comments

@Gones
Copy link

Gones commented Sep 16, 2021

a
The question is how to update the parameter "events" dynamicly?
Such as using a API to fetch new data and update the calendar.
I try to use StreamBuilder to update, but nothing really updated.
Is there another solution to achieve that?

@santa112358
Copy link
Owner

santa112358 commented Sep 18, 2021

@Gones
Is it possible to see your code when you tried to update the events. Thank you.

@Gones
Copy link
Author

Gones commented Sep 18, 2021

events
Just like this. The events data is from the api async call. But the calendar does not update. Please give some advice, thank you.

@Yamasaki-pan961
Copy link

To update the value events, I tried using riverpod instead of StreamBuilder, but the calendar was not updated.
However, I was able to solve the problem by setting the GlobalKey.
Can this be of any help to you?

.....
    return EventCalendar(key: GlobalKey(),);
  }
}

class EventCalendar extends HookWidget {
  EventCalendar({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final ValueNotifier<CellCalendarPageController> cellCalendarPageControllerState = useState(CellCalendarPageController()) ;
    final List<EventModel> eventList = useProvider(eventListProvider).state;
    return CellCalendar(
      cellCalendarPageController: cellCalendarPageControllerState.value,
      events: getCalendarEvent(context.read(eventListProvider).state),
      daysOfTheWeekBuilder: (dayIndex) {
        final labels = ['Sun', 'M', 'T', 'W', 'T', 'F', 'Sat'];
....

(Translated from Japanese)

@thagdet96
Copy link

Im using StatefullWidget and GlobalKey doesn't help.
Is there any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants