Answers for "how to make event take camera in flutter"

0

how to make event take camera in flutter

void onNewCameraSelected(CameraDescription cameraDescription) async {
if (controller != null) {
  await controller.dispose();
}
controller = CameraController(
  cameraDescription,
  ResolutionPreset.high,
  enableAudio: enableAudio,
);

// If the controller is updated then update the UI.
controller.addListener(() {
  if (mounted) setState(() {});
  if (controller.value.hasError) {
    showInSnackBar('Camera error ${controller.value.errorDescription}');
  }
});

try {
  await controller.initialize();
} on CameraException catch (e) {
  _showCameraException(e);
}

if (mounted) {
  setState(() {});
}
}
Posted by: Guest on January-08-2021
0

how to make event take camera in flutter

Widget _cameraTogglesRowWidget() {
final List<Widget> toggles = <Widget>[];

if (cameras.isEmpty) {
  return const Text('No camera found');
} else {
  for (CameraDescription cameraDescription in cameras) {
    toggles.add(
      SizedBox(
        width: 90.0,
        child: RadioListTile<CameraDescription>(
          title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
          groupValue: controller?.description,
          value: cameraDescription,
          onChanged: controller != null && controller.value.isRecordingVideo
              ? null
              : onNewCameraSelected,
        ),
      ),
    );
  }
}
Posted by: Guest on January-08-2021

Code answers related to "how to make event take camera in flutter"

Browse Popular Code Answers by Language