swipe_reveal_card

CI pub package

A lightweight Flutter card with horizontal swipe-to-reveal actions.

Swipe left on a card to uncover Edit / Archive / Delete-style actions — with a small, typed API and no heavy gesture controllers.

Demo

Features

  • Swipe left to reveal one or more actions
  • Optional icons and custom action colors
  • Material ink ripples on card and action taps
  • Soft elevation with zero-margin “flush” mode
  • Scroll position restored via PageStorageKey
  • Zero third-party dependencies beyond Flutter

Install

dependencies:
  swipe_reveal_card: ^0.1.2
import 'package:swipe_reveal_card/swipe_reveal_card.dart';

Usage

SwipeRevealCard(
  storageKey: 'task-1',
  onTap: () => debugPrint('opened'),
  actions: [
    SwipeAction(
      label: 'Edit',
      icon: Icons.edit_outlined,
      onPressed: () {},
    ),
    SwipeAction(
      label: 'Delete',
      icon: Icons.delete_outline,
      color: Colors.red,
      onPressed: () {},
    ),
  ],
  child: const ListTile(
    title: Text('Ship checklist'),
    subtitle: Text('Docs, tests, and pub.dev dry-run'),
  ),
)

Plain card (no swipe)

Omit actions (or pass null) for a simple elevated card:

SwipeRevealCard(
  onTap: () {},
  child: const ListTile(title: Text('Hello')),
)

Customization

Parameter Description
actions List of SwipeActions revealed on swipe
backgroundColor Card body color (default white)
actionsBackgroundColor Color behind action buttons
borderRadius Corner radius (default 10)
margin Outer margin; EdgeInsets.zero disables shadow
elevation Shadow depth when margin is non-zero
storageKey Restores horizontal scroll offset
onTap Card body tap callback

Screenshots

Resting Actions revealed
Resting Revealed

Testing

Unit tests live under test/. Behavior is also specified with Gherkin (.feature) files under test/bdd/ using bdd_widget_test.

# Regenerate Dart tests from feature files
dart run build_runner build

# Run all tests (unit + BDD)
flutter test

Example

cd example
flutter run

Compared to flutter_slidable

swipe_reveal_card is intentionally smaller: horizontal scroll-to-reveal actions on a card surface. If you need dismissible panes, start/end action regions, or custom motion types, prefer flutter_slidable.

License

MIT

Libraries

swipe_reveal_card
A lightweight Flutter card with horizontal swipe-to-reveal actions.