file extension param support for downloader

This commit is contained in:
Ankit Mahato
2023-07-20 02:57:04 +05:30
parent 494584d4fb
commit bab08769e7

View File

@ -104,12 +104,14 @@ class SaveInDownloadsButton extends StatefulWidget {
super.key, super.key,
this.content, this.content,
this.mimeType, this.mimeType,
this.ext,
this.name, this.name,
this.showLabel = true, this.showLabel = true,
}); });
final Uint8List? content; final Uint8List? content;
final String? mimeType; final String? mimeType;
final String? ext;
final String? name; final String? name;
final bool showLabel; final bool showLabel;
@ -129,10 +131,9 @@ class _SaveInDownloadsButtonState extends State<SaveInDownloadsButton> {
onPressed: (widget.content != null) onPressed: (widget.content != null)
? () async { ? () async {
var message = ""; var message = "";
var ext = getFileExtension(widget.mimeType);
var path = await getFileDownloadpath( var path = await getFileDownloadpath(
widget.name, widget.name,
ext, widget.ext ?? getFileExtension(widget.mimeType),
); );
if (path != null) { if (path != null) {
try { try {