-
Notifications
You must be signed in to change notification settings - Fork 74
/
card_swiper.dart
54 lines (52 loc) · 1.63 KB
/
card_swiper.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import 'package:flutter/material.dart';
import 'package:card_swiper/card_swiper.dart';
import 'model/model.dart';
class MyCardSwiper extends StatelessWidget {
const MyCardSwiper({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.deepPurple[100],
appBar: AppBar(title: const Text('Card Swiper')),
body: Column(
children: [
SizedBox(
height: 200,
child: Swiper(
itemCount: sliderItems.length,
autoplay: true,
autoplayDelay: 5000,
curve: Curves.easeIn,
layout: SwiperLayout.DEFAULT,
pagination: const SwiperPagination(
builder: DotSwiperPaginationBuilder(),
),
itemBuilder: (BuildContext context, int index) {
return Card(
semanticContainer: true,
elevation: 10,
margin: const EdgeInsets.only(
top: 10,
bottom: 30,
left: 10,
right: 10,
),
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
child: BannerImageModel(
sliderItems[index],
fit: BoxFit.cover,
width: 200,
height: 200,
),
);
},
),
),
],
),
);
}
}