flutter_carousel_widget icon indicating copy to clipboard operation
flutter_carousel_widget copied to clipboard

[Bug]: initialPage parameter should affect the slide indicators

Open canbi opened this issue 1 year ago • 2 comments

Contact Details

[email protected]

What happened?

Given the initialPage parameter in CarouselOptions, the slide indicators always start with index 0.

I extended one of the slide indicators and wrote this and it works as expected:

class ModifiedCircularSlideIndicator extends CircularSlideIndicator {
  const ModifiedCircularSlideIndicator({
    super.itemSpacing,
    super.indicatorRadius,
    super.indicatorBorderWidth,
    super.indicatorBorderColor,
    super.padding,
    super.alignment,
    super.currentIndicatorColor,
    super.indicatorBackgroundColor,
    required this.startIndex,
  });

  final int startIndex;

  @override
  Widget build(int currentPage, double pageDelta, int itemCount) {
    final newCurrentPage = (startIndex + currentPage) % itemCount
    return super.build(newCurrentPage, pageDelta, itemCount);
  }
}

Version

2.2.0

What devices are you seeing the problem on?

Android, iPhone

OS

iOS 16

Relevant log output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

canbi avatar Mar 05 '24 09:03 canbi

Hi @canbi,

Thank you for raising this issue. It's a bug and I will look into the issue. If you have any questions, please talk about them more. You may also make a PR if you have a tested solution.

Regards, Nikhil

nixrajput avatar Mar 06 '24 04:03 nixrajput

Is there an estimated completion time for this? Thanks!

jdbenito-atco avatar Jun 11 '24 19:06 jdbenito-atco