stackslider 0.0.5
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.

Getting Started
Simple Carousel Example
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:

Rotational Carousel Example
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:

Scaled Item Carousel Example
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:

Opacity Carousel Example
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:

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:

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:

Finite StackSlider Attribute List
Here are the details of all attributes:
| Attribute Name | Description | Applicable Type |
|---|---|---|
| pagerType | Set the StackSlider type, i.e., PagerType.Carousel & PagerType.Stack | - |
| reverse | Reverse the order if set to true | Both |
| scrollDirection | Scroll direction of your pager, i.e., Axis.Horizontal & Axis.Vertical | Both |
| viewPortFraction | Set the view port fraction | Carousel |
| pageSnapping | Snap to the selected or current page | Both |
| physics | Define ScrollPhysics, affecting scrolling velocity, etc. | Both |
| onPageChanged | Callback that returns the current index whenever an item is selected | Both |
| scaleX | Minimum x-scale of unselected page | Both |
| scaleY | Minimum y-scale of unselected page | Both |
| opacity | Set opacity of unselected page | Both |
| rotationX | Maximum x-rotation of unselected page | Carousel |
| rotationY | Maximum y-rotation of unselected page | Carousel |
| overscroll | Apply overscroll effect to the last item | Stack |
| key | Set a key for the pager | Both |
| children | List of child widgets to add to the pager | - |
| dotsVisible | set true if you want to see dots | - |
MIT License
Copyright (c) 2023 Selman Poyraz