mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 02:18:50 +01:00
Fix slideshow used before init
This commit is contained in:
parent
0fd40bd2d3
commit
9d388edd0c
1 changed files with 11 additions and 5 deletions
|
@ -74,20 +74,26 @@ class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
hasInit: true,
|
hasInit: true,
|
||||||
page: initialPage,
|
page: initialPage,
|
||||||
currentFile: getFileByPageIndex(initialPage),
|
|
||||||
hasPrev: initialPage > 0,
|
hasPrev: initialPage > 0,
|
||||||
hasNext: pageCount == null || initialPage < (pageCount! - 1),
|
hasNext: pageCount == null || initialPage < (pageCount! - 1),
|
||||||
));
|
));
|
||||||
|
if (state.files.isNotEmpty) {
|
||||||
|
emit(state.copyWith(
|
||||||
|
currentFile: getFileByPageIndex(initialPage),
|
||||||
|
));
|
||||||
|
}
|
||||||
unawaited(_prepareNextPage());
|
unawaited(_prepareNextPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSetFiles(_SetFiles ev, Emitter<_State> emit) {
|
void _onSetFiles(_SetFiles ev, Emitter<_State> emit) {
|
||||||
_log.info(ev);
|
_log.info(ev);
|
||||||
final files = fileIds.map((e) => ev.dataMap[e]).toList();
|
final files = fileIds.map((e) => ev.dataMap[e]).toList();
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(files: files));
|
||||||
files: files,
|
if (state.hasInit) {
|
||||||
currentFile: files[convertPageToFileIndex(state.page)],
|
emit(state.copyWith(
|
||||||
));
|
currentFile: files[convertPageToFileIndex(state.page)],
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onToggleShowUi(_ToggleShowUi ev, Emitter<_State> emit) {
|
void _onToggleShowUi(_ToggleShowUi ev, Emitter<_State> emit) {
|
||||||
|
|
Loading…
Reference in a new issue