draggable_floating_fab 0.1.1 copy "draggable_floating_fab: ^0.1.1" to clipboard
draggable_floating_fab: ^0.1.1 copied to clipboard

A draggable, sticky FAB overlay with a drag-to-dismiss zone for Flutter apps.

Draggable Floating FAB #

A draggable, sticky support FAB overlay with a drag-to-dismiss zone for Flutter apps.

[FAB snapped to the right edge] [FAB drag-to-dismiss zone] [FAB snapped to the left edge]

Wrap your app (or any subtree) to get an edge-snapping floating action button that:

  • Drags freely and snaps to the nearest left/right edge
  • Persists its position per locale via SharedPreferences
  • Shows a dismiss zone while dragging (drop to hide for the session)
  • Optionally auto-hides on configured route paths

Installation #

dependencies:
  draggable_floating_fab: ^0.1.1

Then run:

flutter pub get

Usage #

import 'package:draggable_floating_fab/draggable_floating_fab.dart';

DraggableSupportFabOverlay(
  child: child,
  onFabTap: () {
    // e.g. open your support / live-chat screen
  },
  currentPath: () => GoRouter.of(context).state.uri.path,
  hiddenRoutePaths: const {'/', '/onboarding', '/live-chat'},
  fabColor: Theme.of(context).colorScheme.primary,
  fabSize: 48,
  bottomSafeInset: 16,
  storageNamespace: 'draggable_floating_fab',
  // Optional: supply your own FAB widget (SVG, branded icon, etc.)
  // fab: MySupportFab(),
)

If currentPath is omitted, the FAB stays visible on every route (until dismissed for the session). If fab is omitted, a Material support_agent icon button is used. When providing a custom fab, keep fabSize in sync with the widget’s rendered size so edge-snapping and dismiss hit-testing stay accurate.

Example #

See the example/ directory for a runnable demo:

cd example
flutter run

License #

MIT

3
likes
0
points
224
downloads

Publisher

unverified uploader

Weekly Downloads

A draggable, sticky FAB overlay with a drag-to-dismiss zone for Flutter apps.

Repository (GitHub)
View/report issues

Topics

#flutter #fab #floating-action-button #overlay #ui

License

unknown (license)

Dependencies

flutter, shared_preferences

More

Packages that depend on draggable_floating_fab