draggable_panel 1.3.1 copy "draggable_panel: ^1.3.1" to clipboard
draggable_panel: ^1.3.1 copied to clipboard

A versatile floating panel widget that can be dragged around the screen and docked to edges. Perfect for displaying tools, actions, or additional content on demand.

A versatile and customizable Draggable Panel ๐Ÿš€

DraggablePanel is a versatile and interactive widget for Flutter that allows you to create floating, draggable panels that can dock to the nearest edge of the screen. The panel is ideal for displaying additional content, actions, or tools that can be accessed on demand.

Your feedback is highly valued as it will help shape future updates and ensure the package remains relevant and useful. ๐Ÿ˜Š


Show some โค๏ธ and star the repo to support the project!

Pub License: MIT Pub

Pub likes Pub points


๐Ÿ“œ Showcase #

๐Ÿ“Œ Getting Started #

Follow these steps to use this package

Add dependency #

dependencies:
  draggable_panel: ^1.3.1

Add import package #

import 'package:draggable_panel/draggable_panel.dart';

Easy to use #

Instructions for use: #

Simple add DraggablePanel to MaterialApp's builder.

builder: (context, child) {
  return DraggablePanel(
    items: [
      DraggablePanelItem(
        enableBadge: false,
        icon: Icons.color_lens,
        onTap: (context) {},
        description: 'Color picker',
      ),
      DraggablePanelItem(
        enableBadge: false,
        icon: Icons.list,
        onTap: (context) {},
      ),
      DraggablePanelItem(
        enableBadge: false,
        icon: Icons.zoom_in,
        onTap: (context) {},
      ),
      DraggablePanelItem(
        enableBadge: false,
        icon: Icons.token,
        onTap: (context) {},
      ),
    ],
    buttons: [
      DraggablePanelButtonItem(
        icon: Icons.copy,
        onTap: (context) {},
        label: 'Push token',
        description: 'Push token to the server',
      ),
    ],
    child: child!,
  );
},

Create a controller once and pass it to the widget. You can preset position/state and listen to position changes.

final controller = DraggablePanelController(
  initialPosition: (x: 20, y: 300),
  // initialPanelState: PanelState.open, // optional: start opened
);

@override
void initState() {
  super.initState();
  controller.addPositionListener((x, y) {
    // persist position, analytics, etc.
  });
}

// In MaterialApp.builder
builder: (context, child) => DraggablePanel(
  controller: controller,
  onPositionChanged: (x, y) {
    // Called when position settles (not during active dragging)
  },
  items: const [],
  buttons: const [],
  child: child!,
),

Tips:

  • When the panel starts in the closed state (default), it will be docked to the nearest screen edge on first layout, so the button never โ€œfloatsโ€ mid-screen.
  • The widget doesnโ€™t auto-toggle on mount. Use controller.toggle(context) when you need to programmatically open/close it.
  • Position callbacks: use controller.addPositionListener for all position updates; onPositionChanged is fired when not dragging (settled updates).

Please, check the example for more details.


Thanks to all contributors of this package


12
likes
160
points
866
downloads

Publisher

verified publishershodev.live

Weekly Downloads

A versatile floating panel widget that can be dragged around the screen and docked to edges. Perfect for displaying tools, actions, or additional content on demand.

Repository (GitHub)
View/report issues

Topics

#draggable-panel #draggable #panel #floating-panel #floating-button

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on draggable_panel