0

这是我的代码的相关部分:

SfDateRangePicker(
                      selectionMode: DateRangePickerSelectionMode.range,
                      monthViewSettings: DateRangePickerMonthViewSettings(
                          specialDates: datesWithHotels),
                      monthCellStyle: DateRangePickerMonthCellStyle(
                        blackoutDatesDecoration: BoxDecoration(
                          border: Border.all(color: Colors.red, width: 1),
                          shape: BoxShape.circle,
                        ),
                        specialDatesDecoration: BoxDecoration(
                          color: Colors.green,
                          border: Border.all(color: Colors.green, width: 1),
                          shape: BoxShape.circle,
                        ),
                        specialDatesTextStyle: TextStyle(color: Colors.white),
                      ),
                      view: DateRangePickerView.month,
                      showActionButtons: true,
                      controller: dateRangePickerController,
                      onSubmit: (Object val) {
                        chooseDates(val, context, chosenDestination);
                      },
                      onCancel: () {
                        dateRangePickerController.selectedRange = null;
                      },
                      confirmText: 'Choose hotel for the selected dates',
                      cancelText: 'Cancel chosen dates',
                      minDate: tripDates['startDate'],
                      maxDate: DateTime(
                          tripDates['endDate'].year,
                          tripDates['endDate'].month,
                          tripDates['endDate'].day - 1),
                    )

目前选择模式设置为范围,但我想允许范围选择和单选。有没有办法做到这一点?我正在使用特殊日期以一种颜色为某些日期着色,但我想用另一种颜色为另一组日期着色。有没有办法做到这一点?

4

0 回答 0