Giter VIP home page Giter VIP logo

Comments (9)

yousifAlneamy avatar yousifAlneamy commented on May 19, 2024 5

Hey, I was able to solve this by dispose/recreate the wrapper widget of the swiper() by giving a UniqueKey each time I was going to pass data to the swiper.

the state is maintained in the parent widget, sample code:

MySwiperWrapper(key: UniqueKey(), images: images, ......)

class MySwiperWrapper extends StatefulWidget { ....... MySwiperWrapper ({ @required Key key, @required this.images, }) : super(key: key); ..... }

NOTE: it's not an efficient solution, but it works

@zeromaro, hope this helps you

from flutter_swiper.

deimantasa avatar deimantasa commented on May 19, 2024 1

Hey, was this issue fixed? As I face exactly same thing. I receive an error
ScrollController not attached to any scroll views. 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 110 pos 12: '_positions.isNotEmpty'
After I remove an item from Swiper.

Cheers

from flutter_swiper.

sbesnard avatar sbesnard commented on May 19, 2024

Same problem here ! You can avoid it by saving a reference to the SwiperController and call its previous method just before deleting the widget (Future.delayed() may come handy...)

from flutter_swiper.

sbesnard avatar sbesnard commented on May 19, 2024

Actually, the problem occurs when deleting the first element as well, and I have no solution for that yet.

from flutter_swiper.

Xingefb avatar Xingefb commented on May 19, 2024

嵌套在CustomScrollView使用抛出异常,进行swiper count 判断,如果数量为空则不显示,数量不为空在显示 if (null == _swipers || _swipers.isEmpty) ? SizedBox() : _swiper() ;

from flutter_swiper.

ZeroMoment avatar ZeroMoment commented on May 19, 2024

Hey, I was able to solve this by dispose/recreate the wrapper widget of the swiper() by giving a UniqueKey each time I was going to pass data to the swiper.

the state is maintained in the parent widget, sample code:

MySwiperWrapper(key: UniqueKey(), images: images, ......)

class MySwiperWrapper extends StatefulWidget { ....... MySwiperWrapper ({ @required Key key, @required this.images, }) : super(key: key); ..... }

NOTE: it's not an efficient solution, but it works

@zeromaro, hope this helps you

it's worked,but i don't know why

from flutter_swiper.

him123 avatar him123 commented on May 19, 2024

Hey, I was able to solve this by dispose/recreate the wrapper widget of the swiper() by giving a UniqueKey each time I was going to pass data to the swiper.

the state is maintained in the parent widget, sample code:

MySwiperWrapper(key: UniqueKey(), images: images, ......)

class MySwiperWrapper extends StatefulWidget { ....... MySwiperWrapper ({ @required Key key, @required this.images, }) : super(key: key); ..... }

NOTE: it's not an efficient solution, but it works

It works....thank you so much

from flutter_swiper.

holtalanm avatar holtalanm commented on May 19, 2024

Hey, I was able to solve this by dispose/recreate the wrapper widget of the swiper() by giving a UniqueKey each time I was going to pass data to the swiper.

the state is maintained in the parent widget, sample code:

MySwiperWrapper(key: UniqueKey(), images: images, ......)

class MySwiperWrapper extends StatefulWidget { ....... MySwiperWrapper ({ @required Key key, @required this.images, }) : super(key: key); ..... }

NOTE: it's not an efficient solution, but it works

@zeromaro, hope this helps you

this fixed my issue, as well. thanks!

from flutter_swiper.

tamnhoskins avatar tamnhoskins commented on May 19, 2024

I am using the SwipperController with the Swiper object and calling the move function, which was causing the "ScrollController not attached to any scroll views" exception. Adding a unique key to my Swiper object did not resolve the exception. What finally fixed the problem for me was setting the animation field to false when move is called: swiperController.move(provider.getCurrentActiveIndex(), animation: false);

from flutter_swiper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.