Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
316 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...