-
Notifications
You must be signed in to change notification settings - Fork 0
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
Swiper 组件 #49
Comments
进阶用法 Container(
width: MediaQuery.of(context).size.width,
height: 200,
margin: EdgeInsets.only(bottom: 20),
child: Swiper(
itemCount: 6,
autoplay: true,
loop: true,
/// 内建样式
layout: SwiperLayout.STACK,
itemWidth: 300,
itemHeight: 400,
scrollDirection: Axis.horizontal,
itemBuilder: _swiperBuilderB,
pagination: SwiperPagination(
builder: DotSwiperPaginationBuilder(
color: Colors.black12, activeColor: Colors.white)),
),
)
Widget _swiperBuilderB(BuildContext context, int index) {
return (Image.network(
'http://via.placeholder.com/350x150',
fit: BoxFit.fill,
));
} |
自定义用法 Container(
width: MediaQuery.of(context).size.width,
height: 160,
child: Swiper(
itemCount: 6,
loop: true,
autoplay: true,
layout: SwiperLayout.CUSTOM,
itemWidth: 300,
itemHeight: 160,
itemBuilder: _swiperBuilderC,
scrollDirection: Axis.horizontal,
pagination: SwiperPagination(
builder: DotSwiperPaginationBuilder(
color: Colors.black12, activeColor: Colors.white)),
/// 自定义轮播效果
/// 描述布局和动画
customLayoutOption: CustomLayoutOption(
startIndex: -1, stateCount: 3)
.addRotate([-45.0 / 100, 0.0, 45.0 / 100]).addTranslate([
Offset(-370.0, -40.0),
Offset(0.0, 0.0),
Offset(370.0, -40.0)
]),
),
)
Widget _swiperBuilderC(BuildContext context, int index) {
return (Image.network(
'http://via.placeholder.com/350x150',
fit: BoxFit.fill,
));
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
基本使用
The text was updated successfully, but these errors were encountered: