diff --git a/lib/src/table_calendar.dart b/lib/src/table_calendar.dart index bcd52656..27131db0 100644 --- a/lib/src/table_calendar.dart +++ b/lib/src/table_calendar.dart @@ -344,10 +344,6 @@ class _TableCalendarState extends State> { } void _onDayTapped(DateTime day) { - final isOutside = day.month != _focusedDay.value.month; - if (isOutside && _shouldBlockOutsideDays) { - return; - } if (_isDayDisabled(day)) { return widget.onDisabledDayTapped?.call(day); @@ -374,10 +370,6 @@ class _TableCalendarState extends State> { } void _onDayLongPressed(DateTime day) { - final isOutside = day.month != _focusedDay.value.month; - if (isOutside && _shouldBlockOutsideDays) { - return; - } if (_isDayDisabled(day)) { return widget.onDisabledDayLongPressed?.call(day); @@ -556,6 +548,11 @@ class _TableCalendarState extends State> { return dowCell; }, dayBuilder: (context, day, focusedMonth) { + final isOutside = day.month != focusedMonth.month; + + if (isOutside && _shouldBlockOutsideDays) { + return Container(); + } return GestureDetector( behavior: widget.dayHitTestBehavior, onTap: () => _onDayTapped(day), @@ -572,10 +569,6 @@ class _TableCalendarState extends State> { Widget _buildCell(DateTime day, DateTime focusedDay) { final isOutside = day.month != focusedDay.month; - if (isOutside && _shouldBlockOutsideDays) { - return Container(); - } - return LayoutBuilder( builder: (context, constraints) { final shorterSide = constraints.maxHeight > constraints.maxWidth