reverse static method

void reverse(
  1. BuildContext context, {
  2. required Offset fromCenter,
  3. required Offset toCenter,
  4. required double orbSize,
  5. Uint8List? lottieBytes,
  6. String? lottieUrl,
  7. String? imageUrl,
  8. required List<Color> brandColors,
  9. VoidCallback? onComplete,
})

Quick reverse flight (~700ms) — orb leaves the landing position and floats back to the original FAB anchor with a soft fade.

Implementation

static void reverse(
  BuildContext context, {
  required Offset fromCenter,
  required Offset toCenter,
  required double orbSize,
  Uint8List? lottieBytes,
  String? lottieUrl,
  String? imageUrl,
  required List<Color> brandColors,
  VoidCallback? onComplete,
}) {
  if (_entry != null) return;
  brandColors = ActionGates.instance.awakeningGradient ?? brandColors;
  orbSize = ActionGates.instance.effects.awakeningOrbSize ?? orbSize;
  final overlay = _resolveOverlay(context);
  if (overlay == null) {
    onComplete?.call();
    return;
  }
  late OverlayEntry entry;
  entry = OverlayEntry(
    builder: (_) => _AwakeningLayer(
      fromCenter: fromCenter,
      toCenter: toCenter,
      orbSize: orbSize,
      lottieBytes: lottieBytes,
      lottieUrl: lottieUrl,
      imageUrl: imageUrl,
      brandColors: brandColors,
      reverse: true,
      onLanded: () {},
      onStateInit: (_) {},
      onDone: () {
        if (_entry == entry) {
          entry.remove();
          _entry = null;
        }
        onComplete?.call();
      },
    ),
  );
  _entry = entry;
  overlay.insert(entry);
}