'Building a Camera ViewFinder in Flutter
I want to build a viewfinder on top of a CameraPreview similar to the image below. So far I am Stacking a CameraPreview() with a Container() that has .5 opacity to darken the area outside of the viewfinder Container() that is on top.
My issue is twofold.
How do I cutout the top viewfinder Container() from the opacity Container() so that only the viewfinder Container() shows up bright?
How do I adjust the viewfinder Container() boarder so that it resembles the image below?
Code below image.
Stack(
children: [
Center(
child: CameraPreview(
controller,
),
),
Container(
color: Colors.black.withOpacity(0.5),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Align(
alignment: Alignment.topCenter,
child: Column(
children: [
Container(
key: containerKey,
height: containerSize,
width: containerSize,
decoration: BoxDecoration(
border: Border.all(
width: 5,
color: Colors.orange,
),
borderRadius: BorderRadius.circular(10.0),
),
),
],
),
],
),
),
),
),
'''
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

