isValidRange method
Implementation
bool isValidRange() {
if (filterType == TSelectionFilterType.range ||
filterType == TSelectionFilterType.dateRange ||
filterType == TSelectionFilterType.dateRangeCalendar) {
DateTime minTime = DateTime.parse(TSelectionConstant.datePickerMinDatetime);
DateTime maxTime = DateTime.parse(TSelectionConstant.datePickerMaxDatetime);
int limitMin = int.tryParse(extMap['min']?.toString() ?? "") ??
(filterType == TSelectionFilterType.dateRange ||
filterType == TSelectionFilterType.dateRangeCalendar
? minTime.millisecondsSinceEpoch
: 0);
// 日期最大值没设置 默认是2121年01月01日 08:00:00
int limitMax = int.tryParse(extMap['max']?.toString() ?? "") ??
(filterType == TSelectionFilterType.dateRange ||
filterType == TSelectionFilterType.dateRangeCalendar
? maxTime.millisecondsSinceEpoch
: 9999);
if (customMap != null && customMap!.isNotEmpty) {
String min = customMap!['min'] ?? "";
String max = customMap!['max'] ?? "";
if (min.isEmpty && max.isEmpty) {
return true;
}
int? inputMin = int.tryParse(customMap!['min'] ?? "");
int? inputMax = int.tryParse(customMap!['max'] ?? "");
if (inputMax != null && inputMin != null) {
if (inputMin >= limitMin &&
inputMax <= limitMax &&
inputMax >= inputMin) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
return true;
}