dialog qr si chiude quando upload finito

This commit is contained in:
2026-05-09 11:43:54 +02:00
parent 73c5751677
commit a81515e4d8
3 changed files with 18 additions and 19 deletions

View File

@@ -82,7 +82,7 @@ class AttachmentsBloc extends Bloc<AttachmentsEvent, AttachmentsState> {
}
}
emit(state.copyWith(localFiles: [], status: AttachmentsStatus.success));
emit(state.copyWith(localFiles: [], status: AttachmentsStatus.ready));
add(LoadAttachmentsEvent(parentId: event.newParentId));
}
@@ -100,10 +100,8 @@ class AttachmentsBloc extends Bloc<AttachmentsEvent, AttachmentsState> {
currentId,
state.parentType,
), // Passiamo il tipo!
onData: (List<AttachmentModel> data) => state.copyWith(
status: AttachmentsStatus.success,
remoteFiles: data,
),
onData: (List<AttachmentModel> data) =>
state.copyWith(status: AttachmentsStatus.ready, remoteFiles: data),
onError: (error, stackTrace) => state.copyWith(
status: AttachmentsStatus.failure,
error: error.toString(),
@@ -143,7 +141,7 @@ class AttachmentsBloc extends Bloc<AttachmentsEvent, AttachmentsState> {
emit(
state.copyWith(
localFiles: [...state.localFiles, ...newLocalFiles],
status: AttachmentsStatus.success,
status: AttachmentsStatus.ready,
),
);
return;
@@ -162,7 +160,7 @@ class AttachmentsBloc extends Bloc<AttachmentsEvent, AttachmentsState> {
}).toList();
await Future.wait(uploadTasks);
emit(state.copyWith(status: AttachmentsStatus.success));
emit(state.copyWith(status: AttachmentsStatus.ready));
} catch (e) {
emit(
state.copyWith(status: AttachmentsStatus.failure, error: e.toString()),
@@ -245,9 +243,7 @@ class AttachmentsBloc extends Bloc<AttachmentsEvent, AttachmentsState> {
files: state.selectedFiles,
currentContextType: state.parentType,
);
emit(
state.copyWith(status: AttachmentsStatus.success, selectedFiles: []),
);
emit(state.copyWith(status: AttachmentsStatus.ready, selectedFiles: []));
} catch (e) {
emit(
state.copyWith(status: AttachmentsStatus.failure, error: e.toString()),
@@ -311,7 +307,7 @@ class AttachmentsBloc extends Bloc<AttachmentsEvent, AttachmentsState> {
state.copyWith(
localFiles: updatedLocalFiles,
selectedFiles: [], // Svuotiamo la selezione
status: AttachmentsStatus.success,
status: AttachmentsStatus.ready,
),
);
return;
@@ -337,9 +333,7 @@ class AttachmentsBloc extends Bloc<AttachmentsEvent, AttachmentsState> {
await Future.wait(linkTasks);
// Lo stream aggiornerà automaticamente la UI
emit(
state.copyWith(status: AttachmentsStatus.success, selectedFiles: []),
);
emit(state.copyWith(status: AttachmentsStatus.ready, selectedFiles: []));
} catch (e) {
emit(
state.copyWith(
@@ -370,7 +364,7 @@ class AttachmentsBloc extends Bloc<AttachmentsEvent, AttachmentsState> {
emit(state.copyWith(status: AttachmentsStatus.loading));
try {
await _repository.renameAttachment(event.file.id!, event.newName);
emit(state.copyWith(status: AttachmentsStatus.success));
emit(state.copyWith(status: AttachmentsStatus.ready));
} catch (e) {
emit(
state.copyWith(