animateTo method
Implementation
Future<void> animateTo(int index, {Duration? duration, Curve? curve}) async {
// Calculate the offset based on the smaller page width
double screenWidth = state.context.size!.width;
double pageWidth = screenWidth * pageFraction;
double offset = index * pageWidth; // Updated to use the page width fraction
if (state.boardViewController.hasClients) {
await state.boardViewController
.animateTo(offset, duration: duration!, curve: curve!);
}
}