From 4b986510b15bfca209e6c5c8a1e8b05e6ae42684 Mon Sep 17 00:00:00 2001 From: kenny lopez Date: Sun, 2 Aug 2026 09:30:53 +0100 Subject: [PATCH] Preserve tablet camera aspect ratio Signed-off-by: kenny lopez --- .../channels/compose_bar/camera_preview.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mobile/lib/features/channels/compose_bar/camera_preview.dart b/mobile/lib/features/channels/compose_bar/camera_preview.dart index e51c2d16a..9d81cd0d0 100644 --- a/mobile/lib/features/channels/compose_bar/camera_preview.dart +++ b/mobile/lib/features/channels/compose_bar/camera_preview.dart @@ -177,6 +177,21 @@ class _CameraFeed extends StatelessWidget { final previewSize = controller.value.previewSize; if (previewSize == null) return const ColoredBox(color: Colors.black); + final isTablet = MediaQuery.sizeOf(context).shortestSide >= 600; + + // The tablet workspace gives the composer a tall, bounded panel instead + // of the phone's wide attachment surface. Let CameraPreview retain the + // camera's reported ratio in that panel; forcing its rotated preview size + // through FittedBox here makes Android stretch the feed in a narrow pane. + if (isTablet) { + return Center( + child: AspectRatio( + aspectRatio: controller.value.aspectRatio, + child: camera.CameraPreview(controller), + ), + ); + } + return ClipRect( child: FittedBox( fit: BoxFit.cover,