Skip to content

Conversation

@vanyasem
Copy link
Contributor

@vanyasem vanyasem commented Mar 19, 2025

Non-breaking change

Closes #381
Closes #286

@hyochan hyochan added the enhancement New feature or request label Mar 20, 2025
@hyochan hyochan requested a review from Copilot June 6, 2025 10:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for specifying dates that should be rendered and treated as inactive (unselectable) in the calendar widget.

  • Introduces a new inactiveDates property with a default empty list
  • Updates day rendering and tap handling to respect inactiveDates
  • Adds a DateTime.isSameDay extension to compare dates without time components
Comments suppressed due to low confidence (2)

lib/flutter_calendar_carousel.dart:128

  • Public API fields like inactiveDates should have doc comments explaining their purpose and behavior (e.g., how dates are matched and what rendering changes occur).
final List<DateTime> inactiveDates;

lib/flutter_calendar_carousel.dart:871

  • The new inactive-date blocking logic in _onDayPressed should have corresponding unit or widget tests to verify that taps on inactive dates do not select those days.
    if (widget.inactiveDates.any(

Comment on lines 692 to 698
} else if (widget.inactiveDates.any(
(final DateTime inactiveDate) =>
inactiveDate.isSameDay(now),
)) {
isSelectable = false;
}

Copy link

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inactiveDates.any(...) check is duplicated in multiple rendering branches. Consider extracting this into a helper method (e.g. bool _isInactive(DateTime day)) to reduce duplication and improve readability.

Suggested change
} else if (widget.inactiveDates.any(
(final DateTime inactiveDate) =>
inactiveDate.isSameDay(now),
)) {
isSelectable = false;
}
} else if (_isInactive(now)) {

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed this in 0f997ca

} else if (now.millisecondsSinceEpoch >
maxDate.millisecondsSinceEpoch) {
isSelectable = false;
} else if (widget.inactiveDates.any(
Copy link

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using List.any for each day render can be O(n) per cell; if inactiveDates grows large, consider storing dates in a Set or hashing normalized date keys for constant-time lookups.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not going to address this

Copy link
Owner

@hyochan hyochan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vanyasem Thank you again for the PR! Do you need this PR urgently? If you have a chance, I’d appreciate it if you could check Copilot’s review and let me know if there’s anything I can help address.

Thanks in advance!

@github-actions
Copy link

github-actions bot commented Sep 5, 2025

This PR is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days

@vanyasem
Copy link
Contributor Author

vanyasem commented Sep 9, 2025

@hyochan sorry for the lengthly delay. I've replied to the Copilot's review. Would you mind taking an another look at the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can I disable specific days?

2 participants