PageController currentIndex: Convert to int properly

It seems using toInt() truncates the number, and sometimes its value is
2.99999 instead of 3.
This commit is contained in:
Vishesh Handa
2019-05-27 11:10:15 +02:00
parent 003b628131
commit acc231f11f

View File

@ -81,7 +81,7 @@ class NoteBrowsingScreenState extends State<NoteBrowsingScreen> {
}
int _currentIndex() {
int currentIndex = pageController.page.toInt();
int currentIndex = pageController.page.round();
assert(currentIndex >= 0);
assert(currentIndex < widget.notes.length);
return currentIndex;