사용자가 콘텐츠를 탐색하기 위해 위아래로 스와이프할 수 있는 소거 가능한 카드의 수직 스택을 제공하는 플러터 패키지입니다. 각 카드는 고유한 레이아웃, 애니메이션 및 동작으로 사용자 정의할 수 있습니다. 퀴즈, 제품 전시 또는 작업 목록과 같은 인터랙티브 인터페이스에 적합합니다. 이 위젯은 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스 등 여러 플랫폼을 지원하여 장치 간 일관된 성능을 보장합니다.
사용 사례
카드 기반의 인터랙티브 탐색
제품 또는 아이템 탐색 인터페이스
퀴즈 또는 설문 응용 프로그램
스와이프 액션을 통한 작업 관리
부드러운 전환을 통한 콘텐츠 탐색
주요 기능
수직 카드 스택
스와이프하여 닫기 제스처
사용자 정의 가능한 카드 표시
크로스 플랫폼 호환성
내장 애니메이션 지원
확장 가능한 이벤트 처리
적합한 대상
카드 기반 UI를 구축하는 개발자
스와이프 상호작용을 필요로 하는 앱
다중 플랫폼 Flutter 프로젝트
인터랙티브 온보딩 흐름
동적 콘텐츠 표시
고려 사항
제스처 충돌을 신중하게 처리해야 합니다
대량의 카드 수가 있는 경우 성능에 영향을 줄 수 있음
사용자 정의는 Flutter 레이아웃에 익숙해야 합니다
제한된 내장 테마
수평 스택에 최적화되지 않음
고급 기능을 위해 외부 종속성에 의존합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
📦 card_stack_widget
A vertical dismissible and customizable stack of cards for a Flutter application.
Usage
CardStackWidget requires a list of CardModel, in order to create a stack of cards. You can
customize their swipe or dismiss orientation, change the scale or the position factor. You can also
apply an opacity, that change on drag movement.
Below, you can find an example of the usage of CardStackWidget and CardModel:
CardStackWidget_buildCardStackWidget(BuildContext context) {
final mockList = _buildMockList(context, size: 4);
returnCardStackWidget(
opacityChangeOnDrag: true,
swipeOrientation: CardOrientation.both,
cardDismissOrientation: CardOrientation.both,
positionFactor: 3,
scaleFactor: 1.5,
alignment: Alignment.center,
reverseOrder: true,
animateCardScale: true,
dismissedCardDuration: constDuration(milliseconds: 150),
cardList: mockList,
);
}
/// Create a mock list of `CardModel` to use inside `CardStackWidget`_buildMockList(BuildContext context, {int size = 0}) {
finaldouble containerWidth = MediaQuery
.of(context)
.size
.width - 16;
var list = <CardModel>[];
for (int i = 0; i < size; i++) {
var color = Color((Random().nextDouble() * 0xFFFFFF).toInt() << 0)
.withOpacity(1.0);
list.add(
CardModel(
backgroundColor: color,
radius: 8,
shadowColor: Colors.black.withOpacity(0.2),
child: SizedBox(
height: 310,
width: containerWidth,
child: Container(), // Whatever you want
),
),
);
}
return list;
}