showVideoOverlay function

Future<void> showVideoOverlay({
  1. required XFile videoFile,
  2. required EditorController editorController,
  3. required Completer<bool> completer,
  4. String uniqueId = '',
})

Implementation

Future<void> showVideoOverlay({
  required XFile videoFile,
  required EditorController editorController,
  required Completer<bool> completer,
  String uniqueId = '',
}) async {
  if (_overlayAnimationController == null) {
    return;
  }
  _editorController = editorController;
  const Curve curve = Curves.easeOut;
  editorController.isShowingOverlay.value = true;
  _overlayEntry = OverlayEntry(
    builder: (BuildContext context) {
      return AnimatedBuilder(
        animation: _overlayAnimationController!,
        builder: (BuildContext context, Widget? child) {
          final double animationValue =
              curve.transform(_overlayAnimationController!.value);

          return Opacity(
            opacity: animationValue,
            child: VideoOverlay(
              editorController: editorController,
              file: videoFile,
              uniqueId: uniqueId,
              screen: MediaQuery.of(context).size,
              completer: completer,
            ),
          );
        },
      );
    },
  );
  if (_overlayEntry != null) {
    await addToOverlay(_overlayEntry!);
    await _overlayAnimationController!.forward();
  }
}