mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +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/share_handler.dart';
|
||||||
import 'package:nc_photos/snack_bar_manager.dart';
|
import 'package:nc_photos/snack_bar_manager.dart';
|
||||||
import 'package:nc_photos/theme.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/disposable.dart';
|
||||||
import 'package:nc_photos/widget/file_content_view.dart';
|
import 'package:nc_photos/widget/file_content_view.dart';
|
||||||
import 'package:nc_photos/widget/handler/remove_selection_handler.dart';
|
import 'package:nc_photos/widget/handler/remove_selection_handler.dart';
|
||||||
|
|
|
@ -17,7 +17,7 @@ class _Bloc extends Bloc<_Event, _State>
|
||||||
fileIds: fileIds,
|
fileIds: fileIds,
|
||||||
index: startIndex,
|
index: startIndex,
|
||||||
currentFile:
|
currentFile:
|
||||||
filesController.stream.value.dataMap[fileIds[startIndex]]!,
|
filesController.stream.value.dataMap[fileIds[startIndex]],
|
||||||
appBarButtons: prefController.viewerAppBarButtonsValue,
|
appBarButtons: prefController.viewerAppBarButtonsValue,
|
||||||
bottomAppBarButtons: prefController.viewerBottomAppBarButtonsValue,
|
bottomAppBarButtons: prefController.viewerBottomAppBarButtonsValue,
|
||||||
)) {
|
)) {
|
||||||
|
@ -139,15 +139,19 @@ class _Bloc extends Bloc<_Event, _State>
|
||||||
_log.info(ev);
|
_log.info(ev);
|
||||||
final fileId = state.fileIdOrders[ev.index];
|
final fileId = state.fileIdOrders[ev.index];
|
||||||
final fileState = state.fileStates[fileId] ?? _PageState.create();
|
final fileState = state.fileStates[fileId] ?? _PageState.create();
|
||||||
|
final file = state.files[fileId];
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
index: ev.index,
|
index: ev.index,
|
||||||
currentFile: state.files[fileId],
|
currentFile: file,
|
||||||
fileStates: state.fileStates[fileId] == null
|
fileStates: state.fileStates[fileId] == null
|
||||||
? state.fileStates.addedAll({fileId: fileState})
|
? state.fileStates.addedAll({fileId: fileState})
|
||||||
: null,
|
: null,
|
||||||
currentFileState: fileState,
|
currentFileState: fileState,
|
||||||
isInitialLoad: false,
|
isInitialLoad: false,
|
||||||
));
|
));
|
||||||
|
if (file == null) {
|
||||||
|
filesController.queryByFileId([fileId]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onRequestPage(_RequestPage ev, _Emitter emit) {
|
void _onRequestPage(_RequestPage ev, _Emitter emit) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ class _State {
|
||||||
factory _State.init({
|
factory _State.init({
|
||||||
required List<int> fileIds,
|
required List<int> fileIds,
|
||||||
required int index,
|
required int index,
|
||||||
required FileDescriptor currentFile,
|
required FileDescriptor? currentFile,
|
||||||
required List<ViewerAppBarButtonType> appBarButtons,
|
required List<ViewerAppBarButtonType> appBarButtons,
|
||||||
required List<ViewerAppBarButtonType> bottomAppBarButtons,
|
required List<ViewerAppBarButtonType> bottomAppBarButtons,
|
||||||
}) =>
|
}) =>
|
||||||
|
|
|
@ -229,7 +229,7 @@ class _PageViewState extends State<_PageView> {
|
||||||
builder: (context, file) {
|
builder: (context, file) {
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: Text("File not found"),
|
child: AppIntermediateCircularProgressIndicator(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return FractionallySizedBox(
|
return FractionallySizedBox(
|
||||||
|
|
Loading…
Reference in a new issue