패키지, 저장소 및 앱 카테고리 검색

flutter_slidable 표지
패키지 상세v5.2.0

flutter_slidable

방향성 슬라이드 액션을 갖춘, 닫을 수 있는 슬라이더블 리스트 항목의 플러터 구현입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
80.7만
좋아요
6.2천
Pub 점수
150

패키지 설치

flutter pub add flutter_slidable

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

flutter_slidable는 사용자가 왼쪽 또는 오른쪽으로 스와이프하여 액션 버튼을 표시할 수 있는 상호작용 가능한 리스트 항목을 가능하게 하는 Flutter 패키지입니다. 방향성 슬라이드 및 삭제 제스처를 지원하여 리스트에서 삭제, 아카이브, 읽음 표시 등의 기능을 구현하는 데 이상적입니다. ListView 및 기타 스크롤 가능한 위젯과 원활하게 통합되며, 사용자 정의 가능한 애니메이션과 레이아웃을 제공합니다. Android, iOS, Web, macOS, Windows, Linux 등 주요 플랫폼 전반에서 작동합니다.

사용 사례

  • 작업 목록에서 스와이프 삭제 구현
  • 연락처 또는 메시지에 맥락 작업 추가
  • 상호작용 가능한 할 일 항목 인터페이스 만들기
  • 피드 또는 수신함에서 빠른 작업 사용
  • 사라지는 알림 지원
  • 반응형 목록 항목 상호작용 구축

주요 기능

  • 작업을 표시하려면 왼쪽/오른쪽으로 스와이프하세요
  • 내장된 취소 제스처 지원
  • 사용자 정의 가능한 작업 버튼
  • 슬라이드 시 부드러운 애니메이션
  • 크로스 플랫폼 호환성
  • 유연한 레이아웃 구성

적합한 대상

  • 인터랙티브 리스트를 구축하는 개발자
  • 스와이프 기반 사용자 작업을 필요로 하는 앱
  • 동적 리스트 항목 동작을 가진 프로젝트
  • 다양한 플랫폼 간 일관된 UX를 우선시하는 팀
  • 경량이고 잘 관리되는 패키지를 찾는 사용자

고려 사항

  • 중첩 스크롤 뷰에서 터치 이벤트를 신중하게 처리해야 할 수 있습니다
  • 작업 버튼의 위치는 다양한 화면 크기에서 테스트되어야 합니다
  • 최적화되지 않은 대규모 목록의 성능 영향
  • 기본 스타일링 외에 내장 테마 옵션이 제한되어 있음
  • 복잡한 드래그 앤 드롭 상호작용을 위한 것이 아님

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Pub BuyMeACoffee

Slidable is a Flutter Favorite package!

flutter_slidable

A Flutter implementation of slidable list item with directional slide actions that can be dismissed.

Sponsors

Our top sponsors are shown below! [Become a Sponsor]


Try the Flutter Chat Tutorial  💬

Your complete platform for sending notifications

Migration from 0.6.0

You can read this small guide to migrate from the 0.6 to the 1.0 version: https://github.com/letsar/flutter_slidable/wiki/Migration-from-version-0.6.0-to-version-1.0.0

Features

  • Accepts start (left/top) and end (right/bottom) action panes.
  • Can be dismissed.
  • 4 built-in action panes.
  • 2 built-in slide action widgets.
  • 1 built-in dismiss animation.
  • You can easily create custom layouts and animations.
  • You can use a builder to create your slide actions if you want special effects during animation.
  • Closes when a slide action has been tapped (overridable).
  • Closes when the nearest Scrollable starts to scroll (overridable).
  • Option to disable the slide effect easily.

Install

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  flutter_slidable: <latest_version>

In your library add the following import:

import 'package:flutter_slidable/flutter_slidable.dart';

Getting started

Example:

Slidable(
  // Specify a key if the Slidable is dismissible.
  key: const ValueKey(0),

  // The start action pane is the one at the left or the top side.
  startActionPane: ActionPane(
    // A motion is a widget used to control how the pane animates.
    motion: const ScrollMotion(),

    // A pane can dismiss the Slidable.
    dismissible: DismissiblePane(onDismissed: () {}),

    // All actions are defined in the children parameter.
    children: const [
      // A SlidableAction can have an icon and/or a label.
      SlidableAction(
        onPressed: doNothing,
        backgroundColor: Color(0xFFFE4A49),
        foregroundColor: Colors.white,
        icon: Icons.delete,
        label: 'Delete',
      ),
      SlidableAction(
        onPressed: doNothing,
        backgroundColor: Color(0xFF21B7CA),
        foregroundColor: Colors.white,
        icon: Icons.share,
        label: 'Share',
      ),
    ],
  ),

  // The end action pane is the one at the right or the bottom side.
  endActionPane: const ActionPane(
    motion: ScrollMotion(),
    children: [
      SlidableAction(
        // An action can be bigger than the others.
        flex: 2,
        onPressed: doNothing,
        backgroundColor: Color(0xFF7BC043),
        foregroundColor: Colors.white,
        icon: Icons.archive,
        label: 'Archive',
      ),
      SlidableAction(
        onPressed: doNothing,
        backgroundColor: Color(0xFF0392CF),
        foregroundColor: Colors.white,
        icon: Icons.save,
        label: 'Save',
      ),
    ],
  ),

  // The child of the Slidable is what the user sees when the
  // component is not dragged.
  child: const ListTile(title: Text('Slide me')),
),

Motions

Any ActionPane has a motion parameter which allow you to define how the pane animates when the user drag the Slidable.

Behind Motion

The actions appear as if they where behind the Slidable:

Behind Motion

Drawer Motion

Animate the actions as if they were drawers, when the Slidable is moving:

Drawer Motion

Scroll Motion

The actions follow the Slidable while it's moving:

Scroll Motion

Stretch Motion

Animate the actions as if they were streched while the Slidable is moving:

Stretch Motion

Controller

You can use SlidableController to open or close the actions programmatically:

final controller = SlidableController();

// ...

Slidable(
  controller: controller,
  // ...
);

// ...

// Open the actions
void _handleOpen() {
  controller.openEndActionPane();
  // OR
  //controller.openStartActionPane();
}

void _handleOpen() {
  controller.close();
}

FAQ

You can read the FAQ here: https://github.com/letsar/flutter_slidable/wiki/FAQ

Sponsoring

I'm working on my packages on my free-time, but I don't have as much time as I would. If this package or any other package I created is helping you, please consider to sponsor me so that I can take time to read the issues, fix bugs, merge pull requests and add features to these packages.

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

순위