Skip to content

Commit

Permalink
Merge pull request #8 from al4nnw/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
manuindersekhon authored Mar 31, 2022
2 parents 42cf721 + e68a494 commit b904fad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions example/lib/screens/complex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class _ComplexState extends State<Complex> {
double _anchor = 0.0;
bool _center = true;
double _velocityFactor = 0.2;
final double _itemExtent = 120;
late InfiniteScrollController _controller;

@override
Expand All @@ -39,7 +40,7 @@ class _ComplexState extends State<Complex> {
height: 200,
child: InfiniteCarousel.builder(
itemCount: kDemoImages.length,
itemExtent: 120,
itemExtent: _itemExtent,
center: _center,
anchor: _anchor,
velocityFactor: _velocityFactor,
Expand All @@ -54,13 +55,13 @@ class _ComplexState extends State<Complex> {
: null,
controller: _controller,
itemBuilder: (context, itemIndex, realIndex) {
final currentOffset = 120 * realIndex;
final currentOffset = _itemExtent * realIndex;
return AnimatedBuilder(
animation: _controller,
builder: (context, child) {
final diff = (_controller.offset - currentOffset);
final maxPadding = 10.0;
final _carouselRatio = 120 / maxPadding;
final _carouselRatio = _itemExtent / maxPadding;

return Padding(
padding: EdgeInsets.only(
Expand Down

0 comments on commit b904fad

Please sign in to comment.