io utils; single favorite folder exporting and importing

This commit is contained in:
nyne
2024-10-28 15:59:17 +08:00
parent 174b7d4135
commit 69befb9a84
20 changed files with 276 additions and 46 deletions

View File

@@ -27,10 +27,26 @@ Future<void> newFolder() async {
});
}
},
)
),
],
).paddingHorizontal(16),
actions: [
TextButton(
child: Text("Import from file".tl),
onPressed: () async {
var file = await selectFile(ext: ['json']);
if(file == null) return;
var data = await file.readAsBytes();
try {
LocalFavoritesManager().fromJson(utf8.decode(data));
}
catch(e) {
context.showMessage(message: "Failed to import".tl);
return;
}
context.pop();
},
).paddingRight(4),
FilledButton(
onPressed: () {
var e = validateFolderName(controller.text);