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

Set up SwiperPagination.rect Indicator does not display #169

Open
chenghui-0829 opened this issue Jan 4, 2020 · 2 comments
Open

Set up SwiperPagination.rect Indicator does not display #169

chenghui-0829 opened this issue Jan 4, 2020 · 2 comments

Comments

@chenghui-0829
Copy link

code

Swiper(
itemBuilder: (BuildContext context, int index) {
return Image.asset(
'images/part1_header_background.png',
fit: BoxFit.fill,
);
},
itemCount: 3,
pagination: new SwiperPagination(
alignment: Alignment.bottomRight,
margin: EdgeInsets.only(bottom: 20, right: 25),
builder: SwiperPagination.rect,
),
autoplay: true)

@chenghui-0829
Copy link
Author

Modify the code under RectSwiperPaginationBuilder

for (int i = 0; i < itemCount; ++i) {
bool active = i == activeIndex;
Size size = active ? this.activeSize : this.size;
list.add(SizedBox(
width: size.width,
height: size.height,
child: Container(
color: active ? activeColor : color,
key: Key("pagination_$i"),
margin: EdgeInsets.all(space),
),
));
}

to

for (int i = 0; i < itemCount; ++i) {
bool active = i == activeIndex;
Size size = active ? this.activeSize : this.size;
list.add(Container(
width: size.width,
height: size.height,
color: active ? activeColor : color,
key: Key("pagination_$i"),
margin: EdgeInsets.all(space),
));
}

Can solve this problem

@georgeherby
Copy link

Thanks @chenghui-0829 this fixed worked for me :)

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

2 participants