Skip to content

Instantly share code, notes, and snippets.

@slightfoot
Last active April 20, 2022 04:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save slightfoot/1294a63d0aed5abc767e405b38de6687 to your computer and use it in GitHub Desktop.
Save slightfoot/1294a63d0aed5abc767e405b38de6687 to your computer and use it in GitHub Desktop.
Scrolling Carousel with centered variable width items and snapping - By Simon Lightfoot - 20/07/2020
@vishna
Copy link

vishna commented Jul 22, 2020

Changed this line:

https://gist.github.com/slightfoot/1294a63d0aed5abc767e405b38de6687#file-carousel-dart-L361

to this:

_offset.applyContentDimensions(0.0, max(contentWidth - width, 0.0));

otherwise had sometime initial state when it was negative (and that was causing some assertion error)

@jonnyplow
Copy link

Any chance there's an updated version of this for the latest flutter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment