casvanluijtelaar / paged_vertical_calendar

A simple paginated framework for implementing calendar based interfaces.
Apache License 2.0
39 stars 33 forks source link

How can I jump to current month? #11

Closed desmeit closed 2 years ago

desmeit commented 2 years ago

if i have dates in the past, the current view is always the oldest date (startdate). is it not possible to set an initial date?

body: SafeArea(
            child: PagedVerticalCalendar(
          startDate: DateTime(2010, 10, 16),
          endDate: DateTime(2030, 3, 14),
          invisibleMonthsThreshold: 1,
          addAutomaticKeepAlives: true,
          onMonthLoaded: (year, month) {
            // on month widget load
          },
          onDayPressed: (value) {
            // on day widget pressed
          },
          onPaginationCompleted: () {
            // on pagination completion
          },
        )));
casvanluijtelaar commented 2 years ago

take a look at https://github.com/casvanluijtelaar/paged_vertical_calendar/issues/2 to jump to dates

desmeit commented 2 years ago

Thanks. I'm able to scroll with a scrollcontroller. But I have one problem: If I set invisibleMonthsThreshold: 10 and scroll with _controller.jumpTo to nr. 10, then I'm not able to scroll to 11. It stucks on loading. If I scroll from 1 to 11 without _controller.jumpTo, then it is working. What I'm doing wrong?

I did a few more tests. the issue also occurs when I scroll very quickly to the last month in the treshhold. Then it also stucks on loading.

casvanluijtelaar commented 2 years ago

Are any errors being thrown? If not can you make a minimal reproducible example so I can test it myself.

desmeit commented 2 years ago

https://user-images.githubusercontent.com/9454529/150962631-95f02543-bc7d-4f2b-b116-c217820ee9ee.mov

you can take my example above and scroll very quickly.