mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
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:
@ -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;
|
||||
|
Reference in New Issue
Block a user