i want to show camera preview on screen and i have set height and width in sizedBox
widget, the problem in video is streched to fit, instead it should be fit like boxfit.cover
, i tried wrapping my CameraPreview
widget inside FittedBox
widget but i am getting error, what should i do to make it not strech but fit to that dimensions. (i can allow little zoom).
return Stack(
children: [
SizedBox(
width: double.infinity,
height: mQHeight / 1.3,
child: FittedBox(child: CameraPreview(cameraController)),
),
error i am getting is
RenderBox was not laid out: RenderFittedBox#5d99b
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2165 pos 12: 'hasSize'
The relevant error-causing widget was:
Help is appriciated. TiA.