dooboolab-community / flutter_calendar_carousel

Calendar widget for flutter that is swipeable horizontally. This widget can help you build your own calendar widget highly customizable.
MIT License
837 stars 307 forks source link

Multiple days selection #284

Closed takumade closed 3 years ago

takumade commented 3 years ago

Multiple days selection

Users can programmatically selected more days at once

So here are the steps to do it

  1. Create a MultipleMarkedDates instance:
MultipleMarkedDates multipleMarkedDates = new MultipleMarkedDates(markedDates: []);
  1. Add marked dates to it

    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));
    multipleMarkedDates.add(new MarkedDate(date: DateTime(2021, 7, 2), color: Colors.pink));
    multipleMarkedDates.add(new MarkedDate(date: DateTime(2021, 7, 3), color: Colors.pink, textStyle: TextStyle(color: Colors.white)));
    multipleMarkedDates.add(new MarkedDate(date: DateTime(2021, 7, 29), color: Colors.deepOrange));
  2. Finally add it to CalendarCarousel using the multipleMarkedDates: prop

    final _calendarCarouselNoHeader = CalendarCarousel<Event>(
      ...
      ...
      ...
      multipleMarkedDates: multipleMarkedDates,
     ...
     ...
     ...
    );
More Notes So for a MarkedDate you can specify the following options/props props types defaultValues Description Required
date DateTime Specify which date will be selected True
color Color Specify the color of the day True
textStyle TextStyle Specify the TextStyle of the day number False

image