From 42ce7a0d392e4ce63a867e62ade800453415af38 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Tue, 17 Sep 2024 18:12:43 +0530 Subject: [PATCH] [mob][photos] Fix grey screen flash from late initialisation error right after granting photo and video permission on logging in --- mobile/lib/ui/home/loading_photos_widget.dart | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mobile/lib/ui/home/loading_photos_widget.dart b/mobile/lib/ui/home/loading_photos_widget.dart index 29fe1c7b50..7ae293131f 100644 --- a/mobile/lib/ui/home/loading_photos_widget.dart +++ b/mobile/lib/ui/home/loading_photos_widget.dart @@ -27,7 +27,7 @@ class _LoadingPhotosWidgetState extends State { late StreamSubscription _firstImportEvent; StreamSubscription? _importProgressEvent; int _currentPage = 0; - late String _loadingMessage; + String? _loadingMessage; final PageController _pageController = PageController( initialPage: 0, ); @@ -105,9 +105,7 @@ class _LoadingPhotosWidgetState extends State { @override Widget build(BuildContext context) { - if (_importProgressEvent == null) { - _loadingMessage = S.of(context).loadingYourPhotos; - } + _loadingMessage ??= S.of(context).loadingYourPhotos; _setupLoadingMessages(context); final isLightMode = Theme.of(context).brightness == Brightness.light; return Scaffold( @@ -144,7 +142,7 @@ class _LoadingPhotosWidgetState extends State { ], ), Text( - _loadingMessage, + _loadingMessage!, style: TextStyle( color: Theme.of(context).colorScheme.subTextColor, ),