stackslider 0.0.5

SDKflutter
Platformandroidioswindowslinuxmacosweb

StackSlider enables you to craft impressive sliders, carousels, and walkthrough sliders.

Finite StackSlider

The StackSlider in Flutter is a powerful tool for creating stunning sliders, carousels, and walkthrough sliders.

Demo      Demo

Getting Started

You can easily incorporate a simple carousel into your app with the following code:

StackSlider
(
scrollDirection: Axis.horizontal, // Scroll direction for the pager
children: <Widget>[ // Add your child widgets here
Container(
color: Colors.deepPurple,
child: Center(
child: Card(
shape: CircleBorder(),
child: Image.asset("images/watch_1.jpg"),
),
),
),
// Add more items here...
]
,
)

Result: Demo

To create a rotational carousel, add the rotationY attribute to the StackSlider:

StackSlider
(
rotationY: 60, // Unselected item rotation value
scrollDirection: Axis.horizontal, // Scroll direction for the pager
children: <Widget>[ // Add your child widgets here
Container(
color: Colors.deepPurple,
child: Center(
child: Card(
shape: CircleBorder(),
child: Image.asset("images/watch_1.jpg"),
),
)
,
)
,
// Add more items here...
]
,
)

Result: Demo

You can create a scaled item carousel by adjusting the scaleX and scaleY attributes:

StackSlider
(
scaleX: 0.8, // Minimum scaleX value 
scaleY: 0.4, // Minimum scaleY value 
scrollDirection: Axis.horizontal, // Scroll direction for the pager
children: <Widget>[ // Add your child widgets here
Container(
color: Colors.deepPurple,
child: Center(
child: Card(
shape: CircleBorder(),
child: Image.asset("images/watch_1.jpg"),
),
),
),
// Add more items here...
],
)

Result: Demo

To create an opacity carousel, set the minimum opacity value using the opacity attribute:

StackSlider
(
opacity: 0.4, // Minimum opacity value for the items
scrollDirection: Axis.horizontal, // Scroll direction for the pager
children: <Widget>[ // Add your child widgets here
Container(
color: Colors.deepPurple,
child: Center(
child: Card(
shape: CircleBorder(),
child: Image.asset("images/watch_1.jpg"),
),
)
,
)
,
// Add more items here...
]
,
)

Result: Demo

Stack Slider Example

To create a stack slider, change the PagerType to PagerType.stack:

StackSlider
(
pagerType: PagerType.stack, // Change the StackSlider behavior to stack slider
scrollDirection: Axis.vertical, // Scroll direction for the pager
children: <Widget>[ // Add your child widgets here
Container(
color: Colors.deepPurple,
child: Center(
child: Card(
shape: CircleBorder(),
child: Image.asset("images/watch_1.jpg"),
)
,
)
,
)
,
// Add more items here...
]
,
)

Result: Demo

Overscroll Stack Slider Example

To create an overscroll stack slider, add the overscroll attribute and set the pagerType to PagerType.stack:

StackSlider
(
overscroll: -300, // Over Scroll value when the user slides in or slides off
pagerType: PagerType.stack, // Set the pager type to stack
scrollDirection: Axis.horizontal, // Scroll direction for the pager
children: <Widget>[ // Add your child widgets here
Container(
color: Colors.deepPurple,
child: Center(
child: Card(
shape: CircleBorder(),
child: Image.asset("images/watch_1.jpg"),
),
),
),
// Add more items here...
]
,
)

Result: Demo

Finite StackSlider Attribute List

Here are the details of all attributes:

Attribute NameDescriptionApplicable Type
pagerTypeSet the StackSlider type, i.e., PagerType.Carousel & PagerType.Stack-
reverseReverse the order if set to trueBoth
scrollDirectionScroll direction of your pager, i.e., Axis.Horizontal & Axis.VerticalBoth
viewPortFractionSet the view port fractionCarousel
pageSnappingSnap to the selected or current pageBoth
physicsDefine ScrollPhysics, affecting scrolling velocity, etc.Both
onPageChangedCallback that returns the current index whenever an item is selectedBoth
scaleXMinimum x-scale of unselected pageBoth
scaleYMinimum y-scale of unselected pageBoth
opacitySet opacity of unselected pageBoth
rotationXMaximum x-rotation of unselected pageCarousel
rotationYMaximum y-rotation of unselected pageCarousel
overscrollApply overscroll effect to the last itemStack
keySet a key for the pagerBoth
childrenList of child widgets to add to the pager-
dotsVisibleset true if you want to see dots-

MIT License

Copyright (c) 2023 Selman Poyraz