I have a little problem with flutter Table_Calendar. I guess i misunderstand something.
When i use this :
onVisibleDaysChanged: (first, last, format) {
_onVisibleDayChanged(first, last);
},
It refer to this
void _onVisibleDayChanged(DateTime first, DateTime last) {
setState(() {
firstVisibleDay = first;
});
}
If i put the setState, when i change my month to go before or next, it keep displaying me the same month. It just reload the page.
If i comment the setState it work i can change my months but the value of firstVisibleDay will not be updated in my stream
StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance
.collection('nurseries')
.doc(widget._favoriteNurseryId)
.collection('events')
.orderBy('eventDateStart')
.where('eventDateStart',
isGreaterThanOrEqualTo: firstVisibleDay)
.snapshots(),
builder: (context, eventsSnapshot)
The stream is right before the creation of the tableCalendar.
My main goal is to limit the query my stream will get to only display the month i currently see on my screen. I don't want to fetch entire event's entries, only those from the visible month.