openCamera method
Open camera from GalleryView
Implementation
@internal
Future<DrishyaEntity?> openCamera(BuildContext context) async {
final uiHandler = UIHandler.of(context);
final route = SlideTransitionPageRoute<List<DrishyaEntity>>(
builder: CameraView(
setting: _cameraSetting.copyWith(enableGallery: false),
editorSetting: _cameraTextEditorSetting,
photoEditorSetting: _cameraPhotoEditorSetting,
),
setting: const CustomRouteSetting(
start: TransitionFrom.leftToRight,
reverse: TransitionFrom.rightToLeft,
),
);
if (fullScreenMode) {
final list = await uiHandler.push(route);
await UIHandler.showStatusBar();
if (list?.isNotEmpty ?? false) {
final ety = list!.first;
_onChanged?.call(ety, false);
if (!uiHandler.mounted) return null;
completeTask(context, items: [...value.selectedEntities, ety]);
return ety;
}
} else {
_panelController.minimizePanel();
final list = await Navigator.of(context).push(route);
await UIHandler.showStatusBar();
if (list?.isNotEmpty ?? false) {
final ety = list!.first;
// Camera was open on selection mode? then complete task
// else select item
if (singleSelection) {
if (!uiHandler.mounted) return null;
completeTask(context, items: [ety]);
} else {
if (!uiHandler.mounted) return null;
select(context, ety);
}
return ety;
}
}
return null;
}