mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-06-19 01:14:40 +08:00
Add snackbar notification when download zip completed/failed
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
@@ -103,8 +104,21 @@ class _DownloadZipPage extends State<DownloadZipPage> {
|
||||
jpnTitle: useTitleJpn,
|
||||
exportAd: exportAd,
|
||||
maxLength: int.tryParse(maxLength))
|
||||
.catchError((err) {
|
||||
.then((_) {
|
||||
if (!kIsWeb) {
|
||||
final snack = SnackBar(
|
||||
content: Text(i18n.downloadComplete));
|
||||
rootScaffoldMessengerKey.currentState
|
||||
?.showSnackBar(snack);
|
||||
}
|
||||
}).catchError((err) {
|
||||
_log.warning("Failed to download zip:", err);
|
||||
if (!kIsWeb) {
|
||||
final snack = SnackBar(
|
||||
content: Text(i18n.downloadZipFailed));
|
||||
rootScaffoldMessengerKey.currentState
|
||||
?.showSnackBar(snack);
|
||||
}
|
||||
});
|
||||
context.canPop()
|
||||
? context.pop()
|
||||
|
||||
@@ -82,5 +82,7 @@
|
||||
},
|
||||
"downloadAsZip": "Download as ZIP file",
|
||||
"exportAd": "Export pages which marked as ads",
|
||||
"maxZipFilenameLength": "Maximum length of filenames in Zip files"
|
||||
"maxZipFilenameLength": "Maximum length of filenames in Zip files",
|
||||
"downloadComplete": "Download completed.",
|
||||
"downloadZipFailed": "Failed to download ZIP file."
|
||||
}
|
||||
|
||||
@@ -82,5 +82,7 @@
|
||||
},
|
||||
"downloadAsZip": "下载为ZIP文件",
|
||||
"exportAd": "导出标记为广告的页面",
|
||||
"maxZipFilenameLength": "Zip文件中文件名的最大长度"
|
||||
"maxZipFilenameLength": "Zip文件中文件名的最大长度",
|
||||
"downloadComplete": "下载完毕。",
|
||||
"downloadZipFailed": "Zip文件下载失败。"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user