mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-03-22 23:19:21 +01:00
Fix refresh indicator in the new home photos
This commit is contained in:
parent
0b3aa72015
commit
5f7d898078
2 changed files with 11 additions and 4 deletions
|
@ -104,6 +104,7 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
||||||
|
|
||||||
void _onReload(_Reload ev, Emitter<_State> emit) {
|
void _onReload(_Reload ev, Emitter<_State> emit) {
|
||||||
_log.info(ev);
|
_log.info(ev);
|
||||||
|
emit(state.copyWith(syncProgress: const Progress(0)));
|
||||||
_syncRemote();
|
_syncRemote();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +290,8 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
||||||
if (!isClosed) {
|
if (!isClosed) {
|
||||||
add(const _SetSyncProgress(null));
|
add(const _SetSyncProgress(null));
|
||||||
}
|
}
|
||||||
_log.info("[_syncRemote] Elapsed time: ${stopwatch.elapsedMilliseconds}ms");
|
_log.info(
|
||||||
|
"[_syncRemote] Elapsed time: ${stopwatch.elapsedMilliseconds}ms");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,8 +142,7 @@ class _WrappedHomePhotosState extends State<_WrappedHomePhotos> {
|
||||||
],
|
],
|
||||||
child: _BlocSelector<bool>(
|
child: _BlocSelector<bool>(
|
||||||
selector: (state) =>
|
selector: (state) =>
|
||||||
state.files.isEmpty &&
|
state.files.isEmpty && state.syncProgress != null,
|
||||||
state.syncProgress != null,
|
|
||||||
builder: (context, isInitialSyncing) {
|
builder: (context, isInitialSyncing) {
|
||||||
if (isInitialSyncing) {
|
if (isInitialSyncing) {
|
||||||
return const _InitialSyncBody();
|
return const _InitialSyncBody();
|
||||||
|
@ -276,7 +275,13 @@ class _BodyState extends State<_Body> {
|
||||||
child: RefreshIndicator(
|
child: RefreshIndicator(
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
_bloc.add(const _Reload());
|
_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(
|
child: CustomScrollView(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
|
|
Loading…
Reference in a new issue