🐛 Fix file upload

This commit is contained in:
2025-09-21 23:20:22 +08:00
parent 4f55a8209c
commit c79b1d7aab
2 changed files with 5 additions and 3 deletions

View File

@@ -78,6 +78,7 @@ class EditPublisherScreen extends HookConsumerWidget {
result = await cropImage(
context,
image: result,
replacePath: true,
allowedAspectRatios: [
if (position == 'background')
CropAspectRatio(height: 7, width: 16)

View File

@@ -17,7 +17,7 @@ Future<XFile?> cropImage(
BuildContext context, {
required XFile image,
List<CropAspectRatio?>? allowedAspectRatios,
bool replacePath = false,
bool replacePath = true,
}) async {
final result = await showMaterialImageCropper(
context,
@@ -211,8 +211,9 @@ Completer<SnCloudFile?> _processUpload(
getTemporaryDirectory()
.then((tempDir) {
final tempFile = File('${tempDir.path}/temp_upload_$actualFilename');
tempFile
.writeAsBytes(byteData!)
file
.readAsBytes()
.then((bytes) => tempFile.writeAsBytes(bytes))
.then((_) {
fileObj = tempFile;
// Call progress start