Liquid Glass Easy

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),
      ),
    ),
  ),
)
ParameterDefaultWhat it does
childAnything. A lens is the usual one.
enabledtrueFalse freezes it in place without unwrapping anything.
initialOffsetOffset.zeroWhere it starts.
onChangednullCalled with the offset as it moves.

Comments

Comments are GitHub Discussions — reply from either place.