NoteBrowser: Add a button to rename notes

Fixes #23
This commit is contained in:
Vishesh Handa
2020-01-27 23:09:11 +01:00
parent 35f8559c74
commit f8e7773f16
4 changed files with 70 additions and 0 deletions

View File

@ -155,6 +155,15 @@ class Note with ChangeNotifier implements Comparable<Note> {
await file.delete();
}
void rename(String newName) {
var parentDirName = p.dirname(filePath);
var newFilePath = p.join(parentDirName, newName);
File(filePath).renameSync(newFilePath);
_filePath = newFilePath;
notifyListeners();
}
@override
int get hashCode => _filePath.hashCode;