무한 라이트는 무한 루프 기능을 갖춘 부드럽고 사용자 정의 가능한 카루셀 위젯을 제공하는 플러터 패키지입니다. 마찰 효과, 다양한 스크롤 물리 설정, 항목 고정 및 스크롤 속도에 대한 정밀 제어를 지원합니다. 앱에서 매력적인 이미지 또는 콘텐츠 슬라이더를 만들기에 적합하며, 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스 등 모든 주요 플랫폼에서 작동합니다. 유연한 애니메이션과 반응형 상호작용을 통해 사용자 경험을 향상시킵니다.
사용 사례
무한 이미지 슬라이더 만들기
제품 전시
인터랙티브 콘텐츠 카루셀 구현
모바일 앱 온보딩 화면 설계
미디어 갤러리 개발
부드러운 스크롤 효과로 UI 개선
주요 기능
무한 루프
마찰 기반 스크롤
여러 스크롤 물리 옵션
사용자 정의 항목 앵커 포인트
속도 제어
크로스 플랫폼 호환성
적합한 대상
모바일 앱 개발자
UI/UX 디자이너
전자상거래 앱 제작자
콘텐츠가 풍부한 애플리케이션 빌더
인터랙티브 프로토타입 개발자
고려 사항
대규모 데이터 세트를 신중하게 처리해야 합니다
중량 있는 위젯과 함께 성능에 영향을 미칠 수 있습니다
복잡한 애니메이션을 위한 최적화 필요
중간 수준의 항목 수에 가장 적합
핵심 기능을 넘어서는 내장 사용자 정의 기능은 제한적
스크롤 물리의 올바른 구현에 따라 달라짐
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Infinite Carousel
Infinite Carousel helps you to create interactive carousel experience within your Flutter applications.
Features
Infinite Carousel does not use PageView underneath, therefore it has some unique features not present in PageView based Carousels like:
Granular control over selected item placement
It allows you to control placement (or anchor) of selected item on viewport (unlike PageView which always has its selected page in the center of viewport).
Fine tuning Scroll Velocity
It gives control over of scrolling speed, therefore allowing user to increase / slow the carousel movements when scrolled free hand.
Friction effect
It simulates a realistic slowing down effect after scrolling, adding a touch of natural behavior and refinement.
Supports Multiple Scroll Physics
Default behaviour is InfiniteScrollPhysics, which makes sure we always land on an item after free hand scrolling, with added friction effect. But you can also set it to PageViewTypeScrollPhysics to get the PageView like scroll effect.
Infinite looping
It supports infinite looping on items, and exposes both actual indices and relative indices of items.
Horizontal and Vertical Axis
It supports both horizontal and vertical axis directions with respect to LTR and RTL text directions.
You can programatically control the Carousel movement by providing InfiniteScrollController, which provides number of useful methods.
pass initialItem in the constructor.
animateToItem(index)
jumpToItem(index)
nextItem()
previousItem()
Attributes
Attribute
Data Type
Description
Default Value
itemCount
int
Total number of items.
Required
itemExtent
double
Size of single item in viewport. If axis is horizontal, then this corresponds to width of item, else height of the item.
Required
itemBuilder
Widget Function(BuildContext, int itemIndex, int realIndex)
To lazily build items on the viewport. When Loop is false, ItemIndex is equal to RealIndex (i.e, index of element). When loop is true, two indexes are exposed by item builder. One is itemIndex, that is the modded item index i.e., for list of 10, position(11) = 1, and position(-1) = 9. Other is realIndex, that is the actual index, i.e. (..., -2, -1, 0, 1, 2, ...) in loop. Real Index is needed if you want to support JumpToItem by tapping on it.
Required
physics
ScrollPhysics
Defaults to InfiniteScrollPhysics, which makes sure we always land on a particular item after free-hand scrolling. You can also provide PageViewTypeScrollPhysics to get PageView scroll effect.
InfiniteScrollPhysics
controller
ScrollController
Scroll Controller for the carousel.
InfiniteScrollController
onIndexChanged
void Function(int)
Callback that includes new selected index.
anchor
double
Where to place selected item on the viewport. Ranges from 0 to 1. 0.0 means selected item is aligned to start of the viewport, and 1.0 meaning selected item is aligned to end of the viewport. This property is ignored when center is set to true.
0.0
loop
bool
Whether to create a infinite looping list
true
velocityFactor
double
Increase/Decrease velocity of carousel scrolling to this factor.
0.2
axisDirection
Axis
Axis direction of carousel.
Axis.horizontal
center
bool
Align selected item to center of the viewport. When this is true, anchor property is ignored.
true
Flutter web
Earlier, flutter allowed scrolling the widgets by dragging using the mouse. Now, by default, it allows scrolling widgets to be dragged by all PointerDeviceKinds except for PointerDeviceKind.mouse.
If you want to support scrolling by drag, please pass the explicit ScrollBehavior to InfiniteCarousel.
scrollBehavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {
// Allows to swipe in web browsersPointerDeviceKind.touch,
PointerDeviceKind.mouse
},
),