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

Multiple days selection using addRange method #285

Merged

Conversation

takumade
Copy link
Contributor

@takumade takumade commented Aug 3, 2021

Hi This is more of a cosmetic feature

I ve added addRange method which allows you to select multiple days without calling the add method multiple times.

So Instead of doing this to select multiple days programmatically:

MultipleMarkedDates multipleMarkedDates = new MultipleMarkedDates(markedDates: []);
multipleMarkedDates.add(new MarkedDate(date: DateTime(2021, 7, 12), color: Colors.purple));
multipleMarkedDates.add(new MarkedDate(date: DateTime(2021, 7, 13), color: Colors.purple));
multipleMarkedDates.add(new MarkedDate(date: DateTime(2021, 7, 14), color: Colors.purple));

They can now do this instead:

MultipleMarkedDates multipleMarkedDates = new MultipleMarkedDates(markedDates: []);
multipleMarkedDates.addRange(new MarkedDate(date: DateTime(2021, 8, 4), color: Colors.purple), plus: 5);

This will select the following days

2021 / 8 / 4
2021 / 8 / 5
2021 / 8 / 6
2021 / 8 / 7
2021 / 8 / 8
2021 / 8 / 9

addRange Method

addRange methods accepts the following arguments

Argument Type Description Required Default
date MarkedDate Specify which date will be selected Yes
plus int The number of days to select after date No 0
minus int The number of days to select before date No 0

FAQ
1. Did you remove the add method?
No

2. What if a user leaves plus and minus arguments?
It will just select date only

@hyochan hyochan added enhancement New feature or request feature labels Aug 7, 2021
Copy link
Member

@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.

LGTM!

@hyochan hyochan merged commit dd1fc9b into dooboolab-community:master Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants