casvanluijtelaar / paged_vertical_calendar

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

added an initial calendar date to allow for bi-directional pagination #13

Closed desmeit closed 2 years ago

desmeit commented 2 years ago

Added the functionality to use an initial date to which the calendar jumps at start. I have orientated on this principle: https://github.com/EdsonBueno/infinite_scroll_pagination/issues/56#issuecomment-890392710 If no startDate is given, it takes DateTime.now(). same for initDate. If initDate is larger than endDate, it is taken endDate. In addition I added a localization parameter and weekdays as option.

Example:

PagedVerticalCalendar(
      invisibleMonthsThreshold: 1,
      startDate: DateTime(2021, 9, 1),
      endDate: DateTime(2022, 3, 1),
      initDate: DateTime(2022, 2, 1),
      weekDays: true,
      languageCode: 'de',
      onMonthLoaded: (year, month) {
        // on month widget load
      },
      onDayPressed: (value) {
        // on day widget pressed
      },
      onPaginationCompleted: () {
        // on pagination completion
      },
    )
casvanluijtelaar commented 2 years ago

Alright, interesting work. I like the initDate feature to allow pagination in both directions. this would be a nice addition to the package. However tests are currently failing and i'd recommend adding a few more to make sure it works.

you're trying to push several features in one commit, I wouldn't recommend that.

weekdays is feature that won't be added. this package is a minimal framework for creating your own looks. the included example already shows how to add weekdays to the top of every month.

In the same reasoning, included localisation is not needed since you can customize any date visualizations using the builder.

tldr, remove the weekdays and localization and fix the minor issues and I'll happily get this merged. Thanks for your work!

casvanluijtelaar commented 2 years ago

thanks for still working on this! I haven't forgotten this pull request, I have been very busy. I'll find some time to integrate this one of these days.

casvanluijtelaar commented 2 years ago

now available on pub..dev thanks for your contribution! 🎉