aleksanderwozniak / table_calendar

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

ReorderableDelayedDragStartListener causes changing months not to work #855

Closed Sun3 closed 3 months ago

Sun3 commented 5 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 4 months ago

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