flutter_carosel
a simple carousel widget with multiple configuration option.
...
dependencies:
...
flutter_multi_carousel: ^1.0.0
...
and install it using flutter packages get
on your project folder. after that, just import the module and use it:
import 'package:flutter/material.dart';
import 'package:flutter_multi_carousel/carousel.dart';
void main() => runapp(myapp());
class myapp extends statelesswidget {
// this widget is the root of your application.
@override
widget build(buildcontext context) {
return materialapp(
title: 'flutter demo',
home: carouselexample(),
);
}
}
class carouselexample extends statelesswidget {
@override
widget build(buildcontext context) {
return scaffold(
body: center(
child: carousel(
height: 350.0,
width: 350,
type: "slideswiper",
indicatortype: "bubble",
arrowcolor: colors.white,
axis: axis.horizontal,
showarrow: true,
children: list.generate(
7,
(i) => center(
child: container(color: colors.red),
))),
),
);
}
}
for detailed demonstration refer this link
https://github.com/jaiswalshubham84/flutter-carousel
getting startedslide
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. available carousel types are: “simple”, “slideswiper”, “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 |
Comments are closed.