widget_build_preview method

Widget widget_build_preview({
  1. required void onCameraNotInit(),
  2. required void onCameraNotSelect(),
  3. required void onCameraNotActive(),
})

Implementation

Widget widget_build_preview({
  required void Function() onCameraNotInit,
  required void Function() onCameraNotSelect,
  required void Function() onCameraNotActive,
}) {
  if (!is_camera_init) {
    onCameraNotInit();
    return const SizedBox.shrink();
  }
  if (!is_select_camera) {
    onCameraNotSelect();
    return const SizedBox.shrink();
  }
  if (!is_camera_active) {
    onCameraNotActive();
    return const SizedBox.shrink();
  }
  if (isMobile) {
    return camera_mobile_controller.buildPreview();
  } else if (isDesktop) {
    if (Platform.isWindows) {
      return camera_windows.buildPreview(camera_id);
    }
  }
  return const SizedBox.shrink();
}