build: Use file selector to save files

pull/1503/head
krille-chan 3 months ago
parent ef85d48a47
commit 8f483c64c0
No known key found for this signature in database

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:file_picker/file_picker.dart';
import 'package:file_selector/file_selector.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:matrix/matrix.dart';
import 'package:share_plus/share_plus.dart';
@ -19,21 +20,18 @@ extension MatrixFileExtension on MatrixFile {
return;
}
final downloadPath = await FilePicker.platform.saveFile(
dialogTitle: L10n.of(context).saveFile,
fileName: name,
type: filePickerFileType,
bytes: bytes,
final location = await getSaveLocation(
suggestedName: name,
confirmButtonText: L10n.of(context).saveFile,
);
final downloadPath = location?.path;
if (downloadPath == null) return;
if (PlatformInfos.isDesktop) {
final result = await showFutureLoadingDialog(
context: context,
future: () => File(downloadPath).writeAsBytes(bytes),
);
if (result.error != null) return;
}
final result = await showFutureLoadingDialog(
context: context,
future: () => File(downloadPath).writeAsBytes(bytes),
);
if (result.error != null) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(

@ -61,11 +61,6 @@ parts:
build-packages:
- g++
zenity-integration:
plugin: nil
stage-snaps:
- zenity-integration
fluffychat:
plugin: flutter
source: .

Loading…
Cancel
Save