openPlayground method

Future<void> openPlayground(
  1. BuildContext context,
  2. MediaEntity entity
)

Implementation

Future<void> openPlayground(
  BuildContext context,
  MediaEntity entity,
) async {
  select(entity, context);
  _accessCamera = true;
  MediaEntity? pickedEntity;

  final route = SlideTransitionPageRoute<MediaEntity>(
    builder: Playground(
      background: PhotoBackground(bytes: entity.bytes),
      enableOverlay: true,
    ),
    beguinHorizontal: true,
    endHorizontal: false,
    transitionDuration: const Duration(milliseconds: 300),
  );

  if (fullScreenMode) {
    pickedEntity = await Navigator.of(context).pushReplacement(route);
  } else {
    pickedEntity = await Navigator.of(context).push(route);
    _closeOnCameraSelect();
  }

  var entities = [...value.selectedEntities];
  if (pickedEntity != null) {
    entities.add(entity);
    _onChanged?.call(entity, false);
    _onSubmitted?.call(entities);
  }
  _accessCamera = false;
  _completer.complete(entities);
}