You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.4 KiB
66 lines
2.4 KiB
part of '../neon_files.dart'; |
|
|
|
class FilesChooseFolderDialog extends StatelessWidget { |
|
const FilesChooseFolderDialog({ |
|
required this.bloc, |
|
required this.filesBloc, |
|
required this.originalPath, |
|
super.key, |
|
}); |
|
|
|
final FilesBrowserBloc bloc; |
|
final FilesBloc filesBloc; |
|
|
|
final PathUri originalPath; |
|
|
|
@override |
|
Widget build(final BuildContext context) => AlertDialog( |
|
title: Text(FilesLocalizations.of(context).folderChoose), |
|
contentPadding: EdgeInsets.zero, |
|
content: SizedBox( |
|
width: double.maxFinite, |
|
child: Column( |
|
children: [ |
|
Expanded( |
|
child: FilesBrowserView( |
|
bloc: bloc, |
|
filesBloc: filesBloc, |
|
mode: FilesBrowserMode.selectDirectory, |
|
), |
|
), |
|
StreamBuilder<PathUri>( |
|
stream: bloc.uri, |
|
builder: (final context, final uriSnapshot) => uriSnapshot.hasData |
|
? Container( |
|
margin: const EdgeInsets.all(10), |
|
child: Row( |
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
children: [ |
|
ElevatedButton( |
|
onPressed: () async { |
|
final result = await showDialog<String>( |
|
context: context, |
|
builder: (final context) => const FilesCreateFolderDialog(), |
|
); |
|
if (result != null) { |
|
bloc.createFolder(uriSnapshot.requireData.join(PathUri.parse(result))); |
|
} |
|
}, |
|
child: Text(FilesLocalizations.of(context).folderCreate), |
|
), |
|
ElevatedButton( |
|
onPressed: originalPath != uriSnapshot.requireData |
|
? () => Navigator.of(context).pop(uriSnapshot.requireData) |
|
: null, |
|
child: Text(FilesLocalizations.of(context).folderChoose), |
|
), |
|
], |
|
), |
|
) |
|
: const SizedBox(), |
|
), |
|
], |
|
), |
|
), |
|
); |
|
}
|
|
|