A simple Carousel Widget with multiple configuration option.
...
dependencies:
...
flutter_carousel: ^0.1.0
...And install it using flutter packages get on your project folder. After that, just import the module and use it:
import 'package:carousel/carousel.dart';
//...
// make a list of assets you want show in carousel
List<String> assetList = ['assets/1.jpeg','assets/2.jpeg','assets/3.jpeg','assets/4.jpeg',
'assets/5.jpeg','assets/6.jpeg','assets/7.jpeg'];
//...
Carousel(
height: 350.0,
width: 350,
type: "simple",
indicatorType: "bubble",
arrowColor: Colors.white,
axis: axis,
showArrow: true,
children: List.generate(
7,
(i) => Center(
child: Container(
color:Colors.red
),)))),
| Properties | Type | Default Value | Description |
|---|---|---|---|
| height | Double | null | Defines height of carousel.This field is required |
| width | Double | null | Defines width of carousel. This field is required |
| axis | Axis | Axis.horizontal | Defines axis of carousel. |
| type | String | "simple" | Defines type of carousel. This field is required Available carousel types are: "simple", "slideswiper", "bubble", "xrotating", "yrotating", "zrotating", "multirotating" |
| showArrow | Bool | true | choice to show arrow in carousel |
| arrowColor | Color | Colors.white | Define the color of arrow |
| showIndicator | Bool | true | Choice to show indicator in carousel |
| indicatorType | String | bar | Defines the type of indicator. Available indicator types are: "bar", "dot", "bubble" |
| activeIndicatorColor | Color | Colors.white | Defines the color of active indicator |
| unActiveIndicatorColor | Color | Colors.black | Defines the color of unactive indicator |
| indicatorBackgroundColor | Color | Color(0xff121212) | Defines the background color of indicator |
| indicatorBackgroundOpacity | Double | 0.5 | Defines the opacity of indicator background |
![]() |
![]() |
![]() |
|---|---|---|
![]() |
![]() |
![]() |
For help getting started with Flutter, view our online documentation.
