cameraPreviewWidget function
Widget
cameraPreviewWidget(
- CameraController cameraController, {
- Widget wrapper(
- Widget child
) = identity,
})
Implementation
Widget cameraPreviewWidget(
CameraController cameraController, {
Widget Function(Widget child) wrapper = identity,
}) {
final preview = cameraController.buildPreview();
return flcDsp((disposers) {
final controllerFr = cameraController.fr(disposers);
final aspectRatioFr = disposers.fr(() => controllerFr().aspectRatio);
return flcFrr(() {
return Center(
child: AspectRatio(
aspectRatio: 1 / aspectRatioFr(),
child: wrapper(preview),
),
);
});
});
// return ValueListenableBuilder(
// valueListenable: cameraController,
// builder: (context, cc, child) {
// return Center(
// child: AspectRatio(
// aspectRatio: 1 / cc.aspectRatio,
// child: cameraController.buildPreview(),
// ),
// );
// },
// );
}