mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +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() {
|
||||||
int currentIndex = pageController.page.toInt();
|
int currentIndex = pageController.page.round();
|
||||||
assert(currentIndex >= 0);
|
assert(currentIndex >= 0);
|
||||||
assert(currentIndex < widget.notes.length);
|
assert(currentIndex < widget.notes.length);
|
||||||
return currentIndex;
|
return currentIndex;
|
||||||
|
Reference in New Issue
Block a user