Why do my codes have bouncing animation just for six items, not 7, 8, or 9, here is the full code, I don't want this animation:
Widget courtsTitle(WidgetRef ref, BuildContext context) {
double deviceWidth = MediaQuery.of(context).size.width;
courts = ref.watch(courtProvider).courtsByClubId;
return SizedBox(
height: 56,
child: PageView.builder(
itemCount: courtLengthCalc(ref),
scrollDirection: Axis.horizontal,
controller: pageController,
physics: const NeverScrollableScrollPhysics(),
onPageChanged: (value) => setState(() => currentPage = value),
itemBuilder: (context, index) => Row(
mainAxisAlignment: MainAxisAlignment.start,
children: List.generate(courtLengthCalc(ref), (index) {
int currentIndex = (index + currentCoachState());
return Container(
width:
currentIndex == 0 ? (deviceWidth * 0.21) : deviceWidth * 0.14,
padding: const EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(
border: Border(
right: BorderSide(
color: Colors.grey, width: currentIndex == 0 ? 0 : 1),
top: const BorderSide(color: Colors.grey, width: 1),
),
),
child: Center(
child: Text(
courts[currentIndex].name,
style: const TextStyle(fontSize: 18),
),
),
);
}),
),
),
);
}
void nextPage(WidgetRef ref) {
courts = ref.watch(courtProvider).courtsByClubId;
if (isForwardCourt) {
pageController.nextPage(
duration: const Duration(microseconds: 1),
curve: Curves.easeInOut,
);
currentCoachesNum++;
courtButtonsChecker++;
}
isForwardCourt = courtButtonsChecker * 5 < courts.length;
isBackCourt = courtButtonsChecker > 1;
setState(() {});
}
void previousPage(WidgetRef ref) {
if (isBackCourt) {
pageController.previousPage(
duration: const Duration(microseconds: 1),
curve: Curves.easeInOut,
);
currentCoachesNum--;
courtButtonsChecker--;
}
isForwardCourt = courtButtonsChecker * 5 < courts.length;
isBackCourt = courtButtonsChecker > 1;
setState(() {});
}