select files feature and operations on them
This commit is contained in:
parent
7f3146d712
commit
99da431190
4 changed files with 85 additions and 30 deletions
|
@ -9,6 +9,8 @@ class SftpProvider extends ChangeNotifier {
|
|||
bool _isLoading = false;
|
||||
late List<SftpName> _dirContents;
|
||||
|
||||
final List<SftpName> _selectedFiles = [];
|
||||
|
||||
SftpProvider(this._sftpWorker) {
|
||||
listDir();
|
||||
}
|
||||
|
@ -18,6 +20,8 @@ class SftpProvider extends ChangeNotifier {
|
|||
String get path => _path;
|
||||
bool get isLoading => _isLoading;
|
||||
List<SftpName> get dirContents => _dirContents;
|
||||
List<SftpName> get selectedFiles => _selectedFiles;
|
||||
bool get isSelectionMode => _selectedFiles.isNotEmpty;
|
||||
|
||||
Future<void> listDir() async {
|
||||
_isLoading = true;
|
||||
|
@ -38,4 +42,22 @@ class SftpProvider extends ChangeNotifier {
|
|||
listDir();
|
||||
}
|
||||
|
||||
void selectFile(SftpName file) {
|
||||
_selectedFiles.add(file);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void toggleSelection(SftpName file) {
|
||||
if (!_selectedFiles.remove(file)) {
|
||||
_selectedFiles.add(file);
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void clearSelectedFiles() {
|
||||
_selectedFiles.clear();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue