- 
                Notifications
    You must be signed in to change notification settings 
- Fork 326
Support specifying inactive dates #395
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 inactiveDatesproperty with a default empty list
- Updates day rendering and tap handling to respect inactiveDates
- Adds a DateTime.isSameDayextension to compare dates without time components
Comments suppressed due to low confidence (2)
lib/flutter_calendar_carousel.dart:128
- Public API fields like inactiveDatesshould 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 _onDayPressedshould have corresponding unit or widget tests to verify that taps on inactive dates do not select those days.
    if (widget.inactiveDates.any(
        
          
                lib/flutter_calendar_carousel.dart
              
                Outdated
          
        
      | } else if (widget.inactiveDates.any( | ||
| (final DateTime inactiveDate) => | ||
| inactiveDate.isSameDay(now), | ||
| )) { | ||
| isSelectable = false; | ||
| } | ||
|  | 
    
      
    
      Copilot
AI
    
    
    
      Jun 6, 2025 
    
  
There was a problem hiding this comment.
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.
| } else if (widget.inactiveDates.any( | |
| (final DateTime inactiveDate) => | |
| inactiveDate.isSameDay(now), | |
| )) { | |
| isSelectable = false; | |
| } | |
| } else if (_isInactive(now)) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed this in 0f997ca
        
          
                lib/flutter_calendar_carousel.dart
              
                Outdated
          
        
      | } else if (now.millisecondsSinceEpoch > | ||
| maxDate.millisecondsSinceEpoch) { | ||
| isSelectable = false; | ||
| } else if (widget.inactiveDates.any( | 
    
      
    
      Copilot
AI
    
    
    
      Jun 6, 2025 
    
  
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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!
| 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 | 
| @hyochan sorry for the lengthly delay. I've replied to the Copilot's review. Would you mind taking an another look at the PR? | 
Non-breaking change
Closes #381
Closes #286