I am building a custom camera UI. I would like the CameraPreview
to be expanded so it fits the device width. This is the implementation and the result:
return Column(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: GestureDetector(
onTapUp: (details) {
focusOnTap(details);
},
onScaleStart: (details) {
zoom = _scaleFactor;
},
onScaleUpdate: (details) {
if (currentCamera == widget.normalCamera) {
onZoomChange(details.scale);
}
},
child: Stack(
children: [
CameraPreview(cameraController),
// top banner
Positioned.fill(
...
),
// bottom banner
Positioned.fill(
...
),
// zoom selector
Positioned.fill(
....
),
// top actions
SafeArea(
....
),
],
),
)),
// bottom actions
GestureDetector(
onHorizontalDragEnd: (details) {
cameraController.dispose();
widget.onSwipe(details);
},
child: Container(
....
),
),
As you can see, on the right there is a black empty space. I would like it to be gone and the camera preview expanded to match the full width.