Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if(initial page != 0) the selected page is updated wrong in the slider #40

Closed
somnath121 opened this issue Apr 14, 2019 · 7 comments · Fixed by #55
Closed

if(initial page != 0) the selected page is updated wrong in the slider #40

somnath121 opened this issue Apr 14, 2019 · 7 comments · Fixed by #55

Comments

@somnath121
Copy link

No description provided.

@samuelgunawan
Copy link

I also encountered this problem.

@SalehHub
Copy link

SalehHub commented May 2, 2019

same here

@vanelizarov
Copy link

vanelizarov commented May 22, 2019

@serenader2014 Same here
When passing initialPage other than zero and setting enableInfiniteScroll to false, PageView always remains on the first page, even after rebuilding the whole widget
Seems like it's similar to flutter's #27020

@vanelizarov
Copy link

@somnath121 @samuelgunawan @salehahmedZ have you resolved it in some way?

@samuelgunawan
Copy link

Not yet. Still waiting for patch

@SalehHub
Copy link

@vanelizarov

This code is working fine for me.

  @override
  void initState() {
    _current = widget.initialPage ?? 0;
    pageController = new PageController(initialPage: widget.initialPage);
    cs = CarouselSlider(
      items: widget.images,
      height: double.infinity,
      viewportFraction: 1.0,
      initialPage: widget.initialPage,
      enableInfiniteScroll: false,
      autoPlay: false,
      onPageChanged: (index) {
        setState(() {
          _current = pageController.page.round();
        });
      },
      enlargeCenterPage: false,
      scrollDirection: Axis.horizontal,
    );

    pageController = cs.pageController;

    super.initState();
  }

dawidstefaniak added a commit to dawidstefaniak/flutter_carousel_slider that referenced this issue Jun 10, 2019
huobazi added a commit to huobazi/flutter_carousel_slider that referenced this issue Jul 12, 2019
@huobazi huobazi mentioned this issue Jul 12, 2019
@JesperBllnbm
Copy link

JesperBllnbm commented Jul 30, 2019

Both fixes are not solving the problem for me, any updates on this topic?

My bad - the fix works, problem was that I didn't do a full restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants