DraggablePanel class final
A floating panel window that can be dragged, parked and grown in place.
Collapsed, it is a small window that can be dragged anywhere and springs to the nearest corner when released, chosen by where its momentum was heading. Flung past a side edge it parks off-screen with a grab tab showing. Tapped, it grows in place into the expanded panel, anchored at the corner it already occupies; dragged down while expanded, it shrinks back.
The panel resolves its placement against the window, so it must be given the
whole window. Install it above the app's own content, typically through
MaterialApp.builder:
MaterialApp(
builder: (context, child) => DraggablePanel(
collapsedBuilder: (context, status) => const Icon(Icons.play_arrow),
expandedBuilder: (context, status) => const MiniPlayer(),
child: child,
),
)
The panel paints above child but within the same subtree, so a route pushed on top of the app covers it.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DraggablePanel
- Annotations
Constructors
-
DraggablePanel({required PanelChildBuilder collapsedBuilder, required PanelChildBuilder expandedBuilder, Key? key, Widget? child, DraggablePanelController? controller, DraggablePanelThemeData? theme, PanelHandleBuilder? handleBuilder, PanelBehavior behavior = const PanelBehavior(), PanelSemantics semantics = const PanelSemantics(), ValueChanged<
PanelStatus> ? onStatusChanged, ValueChanged<PanelPlacement> ? onPlacementChanged}) -
const
Properties
- behavior → PanelBehavior
-
Which interactions the panel accepts.
final
- child → Widget?
-
The application content the panel floats above.
final
- collapsedBuilder → PanelChildBuilder
-
Builds the small, collapsed face of the panel.
final
- controller → DraggablePanelController?
-
Drives the panel from outside. One is created internally when omitted.
final
- expandedBuilder → PanelChildBuilder
-
Builds the large, expanded face of the panel.
final
- handleBuilder → PanelHandleBuilder?
-
Builds the grab affordance on the sliver a parked panel leaves showing.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onPlacementChanged
→ ValueChanged<
PanelPlacement> ? -
Called when the panel comes to rest somewhere new.
final
-
onStatusChanged
→ ValueChanged<
PanelStatus> ? -
Called when the panel's phase changes — a handful of times per gesture,
never per frame.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semantics → PanelSemantics
-
What the panel announces to assistive technology. Localize these.
final
- theme → DraggablePanelThemeData?
-
Call-site tokens, laid over any DraggablePanelThemeData in
ThemeData.extensions and the built-in defaults.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DraggablePanel> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited