是否可以为日期提供索引,然后使用 jumpToPage 到该日期?

Is it possible to give index to a date and then use jumpToPage to that date?

这就是我想要的:

我希望每一天都成为 2020 年 1 月的索引。是 31 days + feb. 21 = 52。当我点击 2 月 21 日时,我想跳转到索引为 52 的页面。现在它跳转到 52 因为这个代码:

controller.jumpToPage(52);

您可以使用 DateTime.difference() :

final firstDate = DateTime(2020, 1, 1);
final secondDate = DateTime(2020, 2, 21);
final index = secondDate.difference(firstDate).inDays;
controller.jumpToPage(index) // index : 51