I have below code which was working before but as the nature of the remaining code have changed, this is not working anymore.
I need pageController.page
value to add background
and borderColor
to button in listView
under GestureDetector
.
issue is if I remove the comment from below code, I only get the first value which is in decimal points
and is not like 1,2,3,4,5
in double
. this results in no changes as I am comparing the currentPageValue
to index
in ListView.builder
.
I can get the background & borderColor
set on the GestureDetector onTap()
but then I loose the current scroll position
for listView which is another matter.
What am I doing wrong ?
Listener code :
void initState() {
setUp();
pageController
..addListener(() {
// setState(() {
currentPageValue = pageController.page;
// });
print(currentPageValue);
});
super.initState();
}
output:
flutter: 0.37981
flutter: 0.734
flutter: 0.9924299999999998
flutter: 1.0
flutter: 1.166665
flutter: 1.3333300000000001
flutter: 1.4166599999999998
flutter: 1.49999
flutter: 1.5833300000000001
flutter: 1.6666600000000003
flutter: 1.75
flutter: 1.91671
flutter: 1.999995
flutter: 2.0
flutter: 1.91679
flutter: 1.833465
flutter: 1.7501250000000002
flutter: 1.66679
flutter: 1.583455
flutter: 1.50013
flutter: 1.333445
flutter: 1.250125
flutter: 1.083455
flutter: 1.0
flutter: 1.16666
flutter: 1.33332
flutter: 1.49999
flutter: 1.6666600000000003
flutter: 1.8333199999999998
flutter: 2.0
flutter: 2.3333299999999997
flutter: 2.8983
flutter: 3.0