Files
flutter-examples/flutter_date_pickers-master/lib/src/unselectable_period_error.dart
2022-10-22 20:29:43 +02:00

31 lines
1014 B
Dart

import 'date_period.dart';
import 'range_picker.dart';
import 'week_picker.dart';
/// Exception thrown when selected period contains custom disabled days.
class UnselectablePeriodException implements Exception {
/// Dates inside selected period what can't be selected
/// according custom rules.
final List<DateTime> customDisabledDates;
/// Selected period wanted by the user.
final DatePeriod period;
/// Creates exception that stores dates that can not be selected.
///
/// See also:
/// *[WeekPicker.onSelectionError]
/// *[RangePicker.onSelectionError]
UnselectablePeriodException(this.customDisabledDates, this.period);
@override
String toString() =>
"UnselectablePeriodException:"
" ${customDisabledDates.length} dates inside selected period "
"(${period.start} - ${period.end}) "
"can't be selected according custom rules (selectable pridicate). "
"Check 'customDisabledDates' property "
"to get entire list of such dates.";
}