openCamera method

Future<void> openCamera(
  1. BuildContext context
)

Implementation

Future<void> openCamera(BuildContext context) async {
  _accessCamera = true;
  MediaEntity? entity;

  final route = SlideTransitionPageRoute<MediaEntity>(
    builder: const CameraView(),
    beguinHorizontal: true,
    endHorizontal: false,
    transitionDuration: const Duration(milliseconds: 300),
  );

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

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