From 88a3ff7558d1ea3063771e22780f7cf042e5e8ce Mon Sep 17 00:00:00 2001 From: Vitaliy Zarubin Date: Fri, 24 Nov 2023 13:57:52 +0300 Subject: [PATCH] Fix 0 size --- packages/camera/camera_aurora/lib/camera_aurora.dart | 3 +++ packages/camera/camera_aurora/lib/camera_viewfinder.dart | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera_aurora/lib/camera_aurora.dart b/packages/camera/camera_aurora/lib/camera_aurora.dart index 46cb664..43ec286 100644 --- a/packages/camera/camera_aurora/lib/camera_aurora.dart +++ b/packages/camera/camera_aurora/lib/camera_aurora.dart @@ -87,6 +87,9 @@ class CameraAurora extends CameraPlatform { BuildContext context, BoxConstraints constraints, ) { + if (constraints.maxWidth.isNaN || constraints.maxHeight.isNaN) { + return const SizedBox.shrink(); + } CameraAuroraPlatform.instance .resizeFrame(constraints.maxWidth, constraints.maxHeight); return CameraViewfinder( diff --git a/packages/camera/camera_aurora/lib/camera_viewfinder.dart b/packages/camera/camera_aurora/lib/camera_viewfinder.dart index d78d72a..64692c0 100644 --- a/packages/camera/camera_aurora/lib/camera_viewfinder.dart +++ b/packages/camera/camera_aurora/lib/camera_viewfinder.dart @@ -52,8 +52,11 @@ class _CameraViewfinderState extends State { ), ); } else if (_cameraState.isNotEmpty()) { - int turn = 0; + if (_cameraState.width == 0 || _cameraState.height == 0) { + return const SizedBox.shrink(); + } + int turn = 0; bool isFront = _cameraState.id.contains('front'); switch (_cameraState.mountAngle) {