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

Loop attribute not working for swiper control #176

Open
takaoandrew opened this issue Jan 21, 2020 · 0 comments
Open

Loop attribute not working for swiper control #176

takaoandrew opened this issue Jan 21, 2020 · 0 comments

Comments

@takaoandrew
Copy link

I noticed that when I had loop set to off, the buttons on the swiper control still looped. I added this to fix it in a class I copied.

This is the new buildButton in swiper_control.dart.
*** means an added line

Widget buildButton(SwiperPluginConfig config, Color color, IconData iconDaga,
int quarterTurns, bool previous) {
return new GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
*** bool prevActivated = true;
*** bool nextActivated = true;
*** if (config.loop) {
*** } else {
*** nextActivated = config.activeIndex < config.itemCount - 1;
*** prevActivated = config.activeIndex > 0;
*** }
if (previous) {
*** if (prevActivated)
config.controller.previous(animation: true);
} else {
*** if (nextActivated)
config.controller.next(animation: true);
}
},
child: Padding(
padding: padding,
child: RotatedBox(
quarterTurns: quarterTurns,
child: Icon(
iconDaga,
semanticLabel: previous ? "Previous" : "Next",
size: size,
color: color,
))),
);
}

@takaoandrew takaoandrew changed the title Loop not active for swiper control Loop attribute not working for swiper control Jan 21, 2020
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