调整尺寸
This commit is contained in:
@@ -10,7 +10,6 @@ class AttachmentViewerController extends GetxController {
|
||||
late final String fileType;
|
||||
|
||||
final RxBool isLoading = true.obs;
|
||||
// This is the correct state variable: it stores the local file path.
|
||||
final RxString localFilePath = ''.obs;
|
||||
final RxString loadingText = '加载中...'.obs;
|
||||
|
||||
@@ -26,7 +25,6 @@ class AttachmentViewerController extends GetxController {
|
||||
|
||||
if (url.toLowerCase().endsWith('.pdf')) {
|
||||
fileType = 'pdf';
|
||||
// This is the correct logic: download the file first.
|
||||
_downloadPdf();
|
||||
} else {
|
||||
fileType = 'image';
|
||||
@@ -34,12 +32,10 @@ class AttachmentViewerController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
/// Downloads the PDF file to a temporary directory and stores its path.
|
||||
Future<void> _downloadPdf() async {
|
||||
try {
|
||||
final dio = Dio();
|
||||
final tempDir = await getTemporaryDirectory();
|
||||
// Use a unique name to avoid caching issues
|
||||
final fileName = '${DateTime.now().millisecondsSinceEpoch}_${url.split('/').last}';
|
||||
final savePath = '${tempDir.path}/$fileName';
|
||||
|
||||
@@ -53,7 +49,6 @@ class AttachmentViewerController extends GetxController {
|
||||
},
|
||||
);
|
||||
|
||||
// On success, update the local file path
|
||||
localFilePath.value = savePath;
|
||||
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user