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.
68 lines
2.5 KiB
68 lines
2.5 KiB
2 years ago
|
part of '../neon_files.dart';
|
||
2 years ago
|
|
||
|
class FilesChooseFolderDialog extends StatelessWidget {
|
||
|
const FilesChooseFolderDialog({
|
||
|
required this.bloc,
|
||
|
required this.filesBloc,
|
||
|
required this.originalPath,
|
||
|
super.key,
|
||
|
});
|
||
|
|
||
|
final FilesBrowserBloc bloc;
|
||
|
final FilesBloc filesBloc;
|
||
|
|
||
|
final List<String> originalPath;
|
||
|
|
||
|
@override
|
||
2 years ago
|
Widget build(final BuildContext context) => AlertDialog(
|
||
2 years ago
|
title: Text(AppLocalizations.of(context).filesChooseFolder),
|
||
|
contentPadding: EdgeInsets.zero,
|
||
|
content: SizedBox(
|
||
|
width: double.maxFinite,
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Expanded(
|
||
|
child: FilesBrowserView(
|
||
|
bloc: bloc,
|
||
|
filesBloc: filesBloc,
|
||
|
enableFileActions: false,
|
||
|
onlyShowDirectories: true,
|
||
|
),
|
||
|
),
|
||
|
StreamBuilder<List<String>>(
|
||
|
stream: bloc.path,
|
||
|
builder: (final context, final pathSnapshot) => pathSnapshot.hasData
|
||
|
? Container(
|
||
|
margin: const EdgeInsets.all(10),
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
children: [
|
||
|
ElevatedButton(
|
||
|
onPressed: () async {
|
||
|
final result = await showDialog<List<String>>(
|
||
|
context: context,
|
||
|
builder: (final context) => const FilesCreateFolderDialog(),
|
||
|
);
|
||
|
if (result != null) {
|
||
|
bloc.createFolder([...pathSnapshot.data!, ...result]);
|
||
|
}
|
||
|
},
|
||
|
child: Text(AppLocalizations.of(context).filesCreateFolder),
|
||
|
),
|
||
|
ElevatedButton(
|
||
2 years ago
|
onPressed: !(const ListEquality().equals(originalPath, pathSnapshot.data))
|
||
|
? () => Navigator.of(context).pop(pathSnapshot.data)
|
||
2 years ago
|
: null,
|
||
|
child: Text(AppLocalizations.of(context).filesChooseFolder),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
)
|
||
|
: Container(),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|