diff --git a/lib/attachmentWidget.dart b/lib/attachmentWidget.dart index 041ab67..26247bc 100644 --- a/lib/attachmentWidget.dart +++ b/lib/attachmentWidget.dart @@ -1,3 +1,5 @@ +import "dart:typed_data"; + import "package:crab_ui/structs.dart"; import "package:flutter/material.dart"; import 'package:pdfrx/pdfrx.dart'; @@ -14,7 +16,16 @@ class AttachmentWidget extends StatelessWidget { if (extension == "jpg") { return Image.memory(att.data); } else if (extension == "pdf") { - return PdfViewer.data(att.data, sourceName: att.name); + PdfViewer pdf = PdfViewer.data( + Uint8List.fromList(att.data), + sourceName: att.name, + params: const PdfViewerParams( + enableTextSelection: true, + scrollByMouseWheel: 0.5, + ) + ); + + return pdf; } return Text( "Attachment not supported for preview, you'll need to download", @@ -39,19 +50,17 @@ class AttachmentWidget extends StatelessWidget { CloseButton(onPressed: () => {Navigator.pop(context)}), Text( attachment.name - .toString(), //its alr a string but incase ¯\(ツ)/¯ + .toString(), //its alr a string but incase ¯\(ツ)/¯ //update: i did that everywhere lol style: TextStyle( color: Colors.black, fontSize: 20, - decoration: - TextDecoration.none), //TODO: personalize your fonts + decoration: TextDecoration + .none), //TODO: personalize your fonts ), ], ), - Expanded( - - child: attachmentViewer(attachment), + child: attachmentViewer(attachment), ) ], ),