I am building a custom camera UI from scratches. I would like to implement 2 buttons to swap between normal lens and ultra-wide lens with a smooth effect, like the one is done in the built-in camera of the OS. Right now my 2 buttons call the method _swapCamera
, which is implemented like this
void _swapCamera(CameraDescription camera) {
currentCamera = camera;
_controller.setDescription(camera);
if (context.mounted) setState(() {});
}
And the effect is this (ugly black screen)