fix: Don't show toasts when export cancelled (#2230)

This commit is contained in:
aAbed 2024-10-17 21:33:04 +05:45 committed by GitHub
parent 820cd720b5
commit bd79496433
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -228,13 +228,15 @@ class SettingsViewModel extends BaseViewModel {
if (outFile.existsSync()) {
final String dateTime =
DateTime.now().toString().replaceAll(' ', '_').split('.').first;
await FlutterFileDialog.saveFile(
final status = await FlutterFileDialog.saveFile(
params: SaveFileDialogParams(
sourceFilePath: outFile.path,
fileName: 'selected_patches_$dateTime.json',
),
);
_toast.showBottom(t.settingsView.exportedPatches);
if (status != null) {
_toast.showBottom(t.settingsView.exportedPatches);
}
} else {
_toast.showBottom(t.settingsView.noExportFileFound);
}
@ -279,13 +281,15 @@ class SettingsViewModel extends BaseViewModel {
if (outFile.existsSync()) {
final String dateTime =
DateTime.now().toString().replaceAll(' ', '_').split('.').first;
await FlutterFileDialog.saveFile(
final status = await FlutterFileDialog.saveFile(
params: SaveFileDialogParams(
sourceFilePath: outFile.path,
fileName: 'keystore_$dateTime.keystore',
),
);
_toast.showBottom(t.settingsView.exportedKeystore);
if (status != null) {
_toast.showBottom(t.settingsView.exportedKeystore);
}
} else {
_toast.showBottom(t.settingsView.noKeystoreExportFileFound);
}