Draggable
Drag wiring you do not have to write again.
LiquidGlassDraggable wraps any widget, moves it with the finger, keeps the offset itself and reports it through onChanged. The child keeps its layout slot, so nothing around it reflows as it travels.
Dart
LiquidGlassDraggable(
enabled: true,
initialOffset: Offset.zero,
onChanged: (o) => setState(() => offset = o),
child: const SizedBox.square(
dimension: 190,
child: LiquidGlassLens(
style: LiquidGlassStyle(
shape: LiquidGlassShape.squircle(cornerRadius: 56),
),
),
),
)| Parameter | Default | What it does |
|---|---|---|
child | — | Anything. A lens is the usual one. |
enabled | true | False freezes it in place without unwrapping anything. |
initialOffset | Offset.zero | Where it starts. |
onChanged | null | Called with the offset as it moves. |
Comments
Comments are GitHub Discussions — reply from either place.