Skip to content

Bug : scroll position is not set properly when passing initialItem to CustomCarouselScrollController #7

@giboin

Description

@giboin

Describe the bug

When I specify an initialItem other than 0 to the controller of the slider, it shows the right item selected, but the scroll stays at 0, like if the selected item was the first one
Then if we move a bit the slider after it was created, it immediately jumps to the position where it should have been

Steps to Reproduce

  • open the file record_box_view.dart in the example of the package
  • in the _buildCarousel method, in the CustomCarousel widget:
    • remove the loop property (not required but it makes the bug more obvious)
    • add controller: CustomCarouselScrollController(initialItem: 4),
  • launch the project and go to the Record Box section
actual behavior expected behavior
same thing than if you don't pass any controller to the slider the slider's ScrollPosition has the same offset than after calling controller.jumpToItem(4)
simulator_screenshot_D12591DF-A2CF-477F-9E8D-4BE95DC81550 simulator_screenshot_57596F92-889F-4858-BE90-F119A53E9F2A

environement

tested on Android 12
Version 0.1.0+1

Great package by the way, thanks! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions