diff --git a/packages/neon/neon_files/lib/blocs/browser.dart b/packages/neon/neon_files/lib/blocs/browser.dart index ca54bb98..b644e9a7 100644 --- a/packages/neon/neon_files/lib/blocs/browser.dart +++ b/packages/neon/neon_files/lib/blocs/browser.dart @@ -15,8 +15,13 @@ abstract interface class FilesBrowserBlocStates { class FilesBrowserBloc extends InteractiveBloc implements FilesBrowserBlocEvents, FilesBrowserBlocStates { FilesBrowserBloc( this.options, - this.account, - ) { + this.account, { + final List? initialPath, + }) { + if (initialPath != null) { + path.add(initialPath); + } + unawaited(refresh()); } diff --git a/packages/neon/neon_files/lib/blocs/files.dart b/packages/neon/neon_files/lib/blocs/files.dart index 56b43d1f..c61f730d 100644 --- a/packages/neon/neon_files/lib/blocs/files.dart +++ b/packages/neon/neon_files/lib/blocs/files.dart @@ -177,7 +177,14 @@ class FilesBloc extends InteractiveBloc implements FilesBlocEvents, FilesBlocSta tasks.add(tasks.value..remove(task)); } - FilesBrowserBloc getNewFilesBrowserBloc() => FilesBrowserBloc(options, account); + FilesBrowserBloc getNewFilesBrowserBloc({ + final List? initialPath, + }) => + FilesBrowserBloc( + options, + account, + initialPath: initialPath, + ); void _downloadParallelismListener() { _downloadQueue.parallel = options.downloadQueueParallelism.value; diff --git a/packages/neon/neon_files/lib/widgets/actions.dart b/packages/neon/neon_files/lib/widgets/actions.dart index d5727200..73e6646d 100644 --- a/packages/neon/neon_files/lib/widgets/actions.dart +++ b/packages/neon/neon_files/lib/widgets/actions.dart @@ -48,9 +48,8 @@ class FileActions extends StatelessWidget { if (!context.mounted) { return; } - final b = bloc.getNewFilesBrowserBloc(); final originalPath = details.path.sublist(0, details.path.length - 1); - b.setPath(originalPath); + final b = bloc.getNewFilesBrowserBloc(initialPath: originalPath); final result = await showDialog?>( context: context, builder: (final context) => FilesChooseFolderDialog( @@ -67,9 +66,8 @@ class FileActions extends StatelessWidget { if (!context.mounted) { return; } - final b = bloc.getNewFilesBrowserBloc(); final originalPath = details.path.sublist(0, details.path.length - 1); - b.setPath(originalPath); + final b = bloc.getNewFilesBrowserBloc(initialPath: originalPath); final result = await showDialog?>( context: context, builder: (final context) => FilesChooseFolderDialog(