aleksanderwozniak / table_calendar

Highly customizable, feature-packed calendar widget for Flutter
Apache License 2.0
1.85k stars 1k forks source link

ReorderableDelayedDragStartListener causes changing months not to work #855

Closed Sun3 closed 8 months ago

Sun3 commented 9 months ago

Describe the bug When you wrap a Table Calendar in a ReorderableDelayedDragStartListener() and trying to view previous or next months, it let's you scroll a few months then it bounces back to last scrolled month.

To reproduce Please include a short code sample that can be used to reproduce the problem.

body: CustomScrollView(
  slivers: [
    SliverReorderableList(
      itemBuilder: (context, index) {
        return ReorderableDelayedDragStartListener(
          index: index,
          child: TableCalendar(
            calendarFormat: CalendarFormat.month,
            firstDay: DateTime.utc(2023, 1, 01),
            lastDay: DateTime.utc(2024, 2, 29),
            focusedDay: DateTime.now(),
          ),
        );
      },
      itemCount: 7,
      onReorder: (oldIndex, newIndex) {},
    ),
  ],
),

Steps to reproduce the behavior:

  1. In TableCalendar navigate back or forward a few months
  2. It will show a few months, then it stops navigating back
  3. It will now show the previous last month scrolled

Expected behavior I expected the TableCalendar to keep scrolling backwards in months

aleksanderwozniak commented 9 months ago

For this to work you will need to store focusedDay and update it in onPageChanged callback: