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


So this is what I want basicly:
enter image description here

I want every day to be and index so 2020 jan. is 31 days + feb. 21 = 52. When I click on feb 21 I want to jump to page with index 52. Right now Its jump to 52 because of this code:



You can use 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

Answered By – Augustin R

Answer Checked By – Jay B. (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *