From 85623cb11f36fa5ff6213bd616feb1afa55a3ab4 Mon Sep 17 00:00:00 2001 From: timonrieger Date: Sun, 25 Jan 2026 14:17:57 +0100 Subject: [PATCH] fix --- .../pages/profile/profile_picture_crop.page.dart | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mobile/lib/presentation/pages/profile/profile_picture_crop.page.dart b/mobile/lib/presentation/pages/profile/profile_picture_crop.page.dart index 9658859aef..b0a7bdc97b 100644 --- a/mobile/lib/presentation/pages/profile/profile_picture_crop.page.dart +++ b/mobile/lib/presentation/pages/profile/profile_picture_crop.page.dart @@ -28,13 +28,22 @@ class ProfilePictureCropPage extends HookConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final cropController = useCropController(); final isLoading = useState(false); + final didInitCropController = useRef(false); // Lock aspect ratio to 1:1 for circular/square crop useEffect(() { - cropController.aspectRatio = 1.0; - cropController.crop = const Rect.fromLTRB(0.1, 0.1, 0.9, 0.9); + // CropController depends on CropImage initializing its bitmap size. + WidgetsBinding.instance.addPostFrameCallback((_) { + if (didInitCropController.value) { + return; + } + didInitCropController.value = true; + + cropController.crop = const Rect.fromLTRB(0.1, 0.1, 0.9, 0.9); + cropController.aspectRatio = 1.0; + }); return null; - }, []); + }, [cropController]); // Create Image widget from asset final image = Image(image: getFullImageProvider(asset));