mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-22 08:46:18 +01:00
Fix legacy search page incompatible with new viewer page when opening photos not yet in filescontroller
This commit is contained in:
parent
7f328b07f9
commit
7dcaf30352
4 changed files with 9 additions and 4 deletions
|
@ -33,6 +33,7 @@ import 'package:nc_photos/set_as_handler.dart';
|
|||
import 'package:nc_photos/share_handler.dart';
|
||||
import 'package:nc_photos/snack_bar_manager.dart';
|
||||
import 'package:nc_photos/theme.dart';
|
||||
import 'package:nc_photos/widget/app_intermediate_circular_progress_indicator.dart';
|
||||
import 'package:nc_photos/widget/disposable.dart';
|
||||
import 'package:nc_photos/widget/file_content_view.dart';
|
||||
import 'package:nc_photos/widget/handler/remove_selection_handler.dart';
|
||||
|
|
|
@ -17,7 +17,7 @@ class _Bloc extends Bloc<_Event, _State>
|
|||
fileIds: fileIds,
|
||||
index: startIndex,
|
||||
currentFile:
|
||||
filesController.stream.value.dataMap[fileIds[startIndex]]!,
|
||||
filesController.stream.value.dataMap[fileIds[startIndex]],
|
||||
appBarButtons: prefController.viewerAppBarButtonsValue,
|
||||
bottomAppBarButtons: prefController.viewerBottomAppBarButtonsValue,
|
||||
)) {
|
||||
|
@ -139,15 +139,19 @@ class _Bloc extends Bloc<_Event, _State>
|
|||
_log.info(ev);
|
||||
final fileId = state.fileIdOrders[ev.index];
|
||||
final fileState = state.fileStates[fileId] ?? _PageState.create();
|
||||
final file = state.files[fileId];
|
||||
emit(state.copyWith(
|
||||
index: ev.index,
|
||||
currentFile: state.files[fileId],
|
||||
currentFile: file,
|
||||
fileStates: state.fileStates[fileId] == null
|
||||
? state.fileStates.addedAll({fileId: fileState})
|
||||
: null,
|
||||
currentFileState: fileState,
|
||||
isInitialLoad: false,
|
||||
));
|
||||
if (file == null) {
|
||||
filesController.queryByFileId([fileId]);
|
||||
}
|
||||
}
|
||||
|
||||
void _onRequestPage(_RequestPage ev, _Emitter emit) {
|
||||
|
|
|
@ -35,7 +35,7 @@ class _State {
|
|||
factory _State.init({
|
||||
required List<int> fileIds,
|
||||
required int index,
|
||||
required FileDescriptor currentFile,
|
||||
required FileDescriptor? currentFile,
|
||||
required List<ViewerAppBarButtonType> appBarButtons,
|
||||
required List<ViewerAppBarButtonType> bottomAppBarButtons,
|
||||
}) =>
|
||||
|
|
|
@ -229,7 +229,7 @@ class _PageViewState extends State<_PageView> {
|
|||
builder: (context, file) {
|
||||
if (file == null) {
|
||||
return const Center(
|
||||
child: Text("File not found"),
|
||||
child: AppIntermediateCircularProgressIndicator(),
|
||||
);
|
||||
} else {
|
||||
return FractionallySizedBox(
|
||||
|
|
Loading…
Reference in a new issue