simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -21,16 +21,15 @@ class FileClipboard extends ChangeNotifier {
|
||||
List<CacheableFile> get files => List.unmodifiable(_files);
|
||||
bool get isEmpty => _files.isEmpty;
|
||||
|
||||
void cut(List<CacheableFile> files) {
|
||||
if (files.isEmpty) return;
|
||||
_operation = FileClipboardOperation.cut;
|
||||
_files = List.of(files);
|
||||
notifyListeners();
|
||||
}
|
||||
void cut(List<CacheableFile> files) =>
|
||||
_set(FileClipboardOperation.cut, files);
|
||||
|
||||
void copy(List<CacheableFile> files) {
|
||||
void copy(List<CacheableFile> files) =>
|
||||
_set(FileClipboardOperation.copy, files);
|
||||
|
||||
void _set(FileClipboardOperation operation, List<CacheableFile> files) {
|
||||
if (files.isEmpty) return;
|
||||
_operation = FileClipboardOperation.copy;
|
||||
_operation = operation;
|
||||
_files = List.of(files);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user