takePhoto method

Future<LikkEntity?> takePhoto(
  1. BuildContext context, {
  2. bool saveImage = true,
})

Take photo with camera

Implementation

Future<LikkEntity?> takePhoto(BuildContext context,
    {bool saveImage = true}) async {
  _accessCamera = true;
  LikkEntity? entity;

  final route = SlideTransitionPageRoute<LikkEntity>(
    builder: CameraView(saveImage: saveImage),
    begainHorizontal: true,
    transitionDuration: const Duration(milliseconds: 300),
  );

  entity = await Navigator.of(context).push(route);

  if (entity == null) {
    _accessCamera = false;
    return null;
  }

  // if (setting.enableCropper && entity.entity.type == AssetType.image) {
  //   // ignore: use_build_context_synchronously
  //   final editedEntity = await openCropper(context, entity);
  //   if (editedEntity != null) {
  //     entity = editedEntity;
  //   } else {
  //     return;
  //   }
  // }

  _accessCamera = false;
  return entity;
}