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

Alternative to currentlyVisibleDates? #119

Closed
IoanaAlexandru opened this issue Apr 10, 2022 · 1 comment
Closed

Alternative to currentlyVisibleDates? #119

IoanaAlexandru opened this issue Apr 10, 2022 · 1 comment
Labels
T: Feature Type: :tada: New Features

Comments

@IoanaAlexandru
Copy link

After the package was reworked, the DateController no longer has currentlyVisibleDates. I couldn't find any clean way to find what the dates are, and resorted to looking at the pages manually. I think it would be nice to have this functionality back. (Also, for the record, the documentation still states that you can use DateController to check the currently visible dates)

My use-case is that I'd like to show a toast when the user presses the "Show today" button when they're already on the current week. Before the update, the condition was simply _controller.currentlyVisibleDates.contains(LocalDate.today()). After the update, I did the following:

  bool showingCurrentWeek() {
    final todayPage = DateTime.now().toUtc().atStartOfDay.datePage;
    final currentPage = _dateController.value.page;
    final visibleDayCount = _dateController.visibleRange.visibleDayCount;
    return currentPage <= todayPage &&
        todayPage <= currentPage + visibleDayCount - 1;
  }
@IoanaAlexandru IoanaAlexandru added the T: Feature Type: :tada: New Features label Apr 10, 2022
@JonasWanke
Copy link
Owner

As part of v1.0.0-alpha.7, there are now dateController.visibleDates , datePageValue.visibleDates, .firstVisibleDate, .firstVisiblePage,.lastVisibleDate, and .lastVisiblePage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: Feature Type: :tada: New Features
Projects
None yet
Development

No branches or pull requests

2 participants