turnCalendarMapWithCallBack method
根据转入的日期,切换上月、当月、下月数据;
Implementation
void turnCalendarMapWithCallBack(
String dateStr,
void Function(Map? dic) completeBlk,
) {
String nextMonthStr = titleOfNextMonth(dateStr);
String preMonthStr = titleOfPreMonth(dateStr);
if (_preCalMap != null && (_preCalMap!["monthStr"] == dateStr)) {
Map? tempCur = _currentCalMap;
_currentCalMap = _preCalMap;
completeBlk(_currentCalMap);
if (tempCur != null && (tempCur["monthStr"] == nextMonthStr)) {
_nextCalMap = tempCur;
} else {
_nextCalMap = null;
}
_preCalMap = null;
} else if (_nextCalMap != null &&
(_nextCalMap!["monthStr"] == dateStr)) {
Map? tempCur = _currentCalMap;
_currentCalMap = _nextCalMap;
completeBlk(_currentCalMap);
if (tempCur != null && (tempCur["monthStr"] == preMonthStr)) {
_preCalMap = tempCur;
} else {
_preCalMap = null;
}
_nextCalMap = null;
} else {
if (_currentCalMap!["monthStr"] == dateStr) {
completeBlk(_currentCalMap);
} else {
_currentCalMap =
calendarMapWith(PWSDateTimeService.dateFromMonthString(dateStr));
completeBlk(_currentCalMap);
}
_nextCalMap = null;
_preCalMap = null;
}
_preCalMap ??= getPreCalendarMap(dateStr);
_nextCalMap ??= getNextCalendarMap(dateStr);
}