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

flutter swiper package avoid to swipe to next position, it stay on first #20

Open
nitneuq33 opened this issue Jun 18, 2022 · 0 comments

Comments

@nitneuq33
Copy link

nitneuq33 commented Jun 18, 2022

I have a working code before null safety flutter upgrade. But after the migration, the same code doesn't work.

I had a simple horizontal swipe card, but now something force the swipe to stay on the first position. When I remove didChangeDependencies (function I use to load when data change) the swipe is OK. I think when data is load by didChangeDependencies it refresh new Swiper.children( and force to return always to first index position.

But I can't do without didChangeDependencies, how can I do ?

Here is the package https://pub.dev/packages/flutter_swiper_null_safety/example Here is my code:


@override
void didChangeDependencies() async {
SharedPreferences prefs = await SharedPreferences.getInstance();

final MyInheritedWidgetState state = MyInheritedWidget.of(context);
}                                  
                                                      new Swiper.children(

                                                      viewportFraction: 0.8,
                                                      scale: 0.6,
                                                      autoplay: false,
                                                      loop: false,
                                                      control: new SwiperControl(

                                                        size: 25.0,
                                                        color:  Color(0xffff9a7b),

                                                        disableColor: Colors.transparent ,
                                                        padding: const EdgeInsets.all (5.0),
                                                      ),

                                                      children: <Widget>[
                                                      Card1()
                                                      Card2()
                                                      Card3()
                                                      ]
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

No branches or pull requests

1 participant