🐛 Fix file upload
This commit is contained in:
@@ -78,6 +78,7 @@ class EditPublisherScreen extends HookConsumerWidget {
|
|||||||
result = await cropImage(
|
result = await cropImage(
|
||||||
context,
|
context,
|
||||||
image: result,
|
image: result,
|
||||||
|
replacePath: true,
|
||||||
allowedAspectRatios: [
|
allowedAspectRatios: [
|
||||||
if (position == 'background')
|
if (position == 'background')
|
||||||
CropAspectRatio(height: 7, width: 16)
|
CropAspectRatio(height: 7, width: 16)
|
||||||
|
@@ -17,7 +17,7 @@ Future<XFile?> cropImage(
|
|||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
required XFile image,
|
required XFile image,
|
||||||
List<CropAspectRatio?>? allowedAspectRatios,
|
List<CropAspectRatio?>? allowedAspectRatios,
|
||||||
bool replacePath = false,
|
bool replacePath = true,
|
||||||
}) async {
|
}) async {
|
||||||
final result = await showMaterialImageCropper(
|
final result = await showMaterialImageCropper(
|
||||||
context,
|
context,
|
||||||
@@ -211,8 +211,9 @@ Completer<SnCloudFile?> _processUpload(
|
|||||||
getTemporaryDirectory()
|
getTemporaryDirectory()
|
||||||
.then((tempDir) {
|
.then((tempDir) {
|
||||||
final tempFile = File('${tempDir.path}/temp_upload_$actualFilename');
|
final tempFile = File('${tempDir.path}/temp_upload_$actualFilename');
|
||||||
tempFile
|
file
|
||||||
.writeAsBytes(byteData!)
|
.readAsBytes()
|
||||||
|
.then((bytes) => tempFile.writeAsBytes(bytes))
|
||||||
.then((_) {
|
.then((_) {
|
||||||
fileObj = tempFile;
|
fileObj = tempFile;
|
||||||
// Call progress start
|
// Call progress start
|
||||||
|
Reference in New Issue
Block a user