In the code below, I want to blur the camera output as the GestureDetector
is tapped and the camera output is paused. In the present scenario, the camera output pauses but doesn't blur.
There is a similar question here; which primarily deals in changes in AppLifecycleState
while inactive, not while active which is the case here.
var pauseCamera = 0;
CameraController? controller; //From the camera package.
...
GestureDetector(
onTap: () {
pauseCamera++;
pauseCamera.isOdd
? controller!.pausePreview()
: controller!.resumePreview();
},
child: pauseCamera.isOdd
? ClipRect(
child: ImageFiltered(
imageFilter: ImageFilter.blur(
sigmaX: 5.0,
sigmaY: 5.0,
),
child: const CameraView(), //Displays the camera.
),
)
: const CameraView(),
),