🐛 Optimize posting progress

This commit is contained in:
2024-12-22 00:48:06 +08:00
parent 7fc18b40db
commit f5dcf71e10
2 changed files with 16 additions and 35 deletions

View File

@ -1,4 +1,5 @@
import 'dart:io';
import 'dart:math' as math;
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
@ -307,12 +308,14 @@ class PostWriteController extends ChangeNotifier {
place.$2,
onProgress: (progress) {
// Calculate overall progress for attachments
progress = ((i + progress) / attachments.length) * kAttachmentProgressWeight;
progress = math.max(((i + progress) / attachments.length) * kAttachmentProgressWeight, progress);
notifyListeners();
},
);
progress = (i + 1) / attachments.length * kAttachmentProgressWeight;
attachments[i] = PostWriteMedia(item);
notifyListeners();
}
} catch (err) {
isBusy = false;