diff --git a/app/lib/widget/home_photos/bloc.dart b/app/lib/widget/home_photos/bloc.dart index bc55ea59..a7116ac3 100644 --- a/app/lib/widget/home_photos/bloc.dart +++ b/app/lib/widget/home_photos/bloc.dart @@ -104,6 +104,7 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger { void _onReload(_Reload ev, Emitter<_State> emit) { _log.info(ev); + emit(state.copyWith(syncProgress: const Progress(0))); _syncRemote(); } @@ -289,7 +290,8 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger { if (!isClosed) { add(const _SetSyncProgress(null)); } - _log.info("[_syncRemote] Elapsed time: ${stopwatch.elapsedMilliseconds}ms"); + _log.info( + "[_syncRemote] Elapsed time: ${stopwatch.elapsedMilliseconds}ms"); }); } diff --git a/app/lib/widget/home_photos2.dart b/app/lib/widget/home_photos2.dart index d5a59c6d..8fcd5d02 100644 --- a/app/lib/widget/home_photos2.dart +++ b/app/lib/widget/home_photos2.dart @@ -142,8 +142,7 @@ class _WrappedHomePhotosState extends State<_WrappedHomePhotos> { ], child: _BlocSelector( selector: (state) => - state.files.isEmpty && - state.syncProgress != null, + state.files.isEmpty && state.syncProgress != null, builder: (context, isInitialSyncing) { if (isInitialSyncing) { return const _InitialSyncBody(); @@ -276,7 +275,13 @@ class _BodyState extends State<_Body> { child: RefreshIndicator( onRefresh: () async { _bloc.add(const _Reload()); - await _bloc.stream.first; + var hasNotNull = false; + await _bloc.stream.firstWhere((s) { + if (s.syncProgress != null) { + hasNotNull = true; + } + return hasNotNull && s.syncProgress == null; + }); }, child: CustomScrollView( controller: _scrollController,