Muhammad Shafique
Muhammad Shafique

Reputation: 609

How to select multiple dates in flutter

I want to select multiple dates from date picker (not range). Actually in my app I have added a workshop that will be hosted on multiple days, like 1 June, 7 June, 9 June. So i want to add add multiple dates. Is there a option to select multiple dates in date picker?

Upvotes: 1

Views: 7184

Answers (4)

Ahmed Sabahi
Ahmed Sabahi

Reputation: 1

Even though I know it is too late, the solution is

initialSelectedDates

It requires a List of DateTimes.

Upvotes: -1

Use syncfusion_flutter_datepicker 20.4.42 plugin

SfDateRangePicker(
         view: DateRangePickerView.month,
         monthViewSettings: DateRangePickerMonthViewSettings(firstDayOfWeek: 6),
         selectionMode: DateRangePickerSelectionMode.multiple,
         showActionButtons: true,
         onSubmit: ( val) {
         print(val);
         },
         onCancel: (){
         _datePickerController.selectedRanges = null;
         }
         ),

Upvotes: 1

anDres
anDres

Reputation: 111

If someone else is looking for this question it is best to use showDateRangePicker()

you can use it like this

    DateTimeRange? result = await showDateRangePicker(
      context: context,
      firstDate: DateTime(2022, 1, 1), // the earliest allowable
      lastDate: DateTime(2030, 12, 31), // the latest allowable
      currentDate: DateTime.now(),
      saveText: 'Done',
    );

Reference flutter

Reference 2

Upvotes: 2

Ravindra S. Patil
Ravindra S. Patil

Reputation: 14885

Try to refer table_calendar package and daterangepicker use syncfusion_flutter_datepicker package for that hope its help to you.

Upvotes: 2

Related Questions