HyM attachments resolve: #2 #3
@ -1,3 +1,5 @@
|
|||||||
|
import "dart:typed_data";
|
||||||
|
|
||||||
import "package:crab_ui/structs.dart";
|
import "package:crab_ui/structs.dart";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import 'package:pdfrx/pdfrx.dart';
|
import 'package:pdfrx/pdfrx.dart';
|
||||||
@ -14,7 +16,16 @@ class AttachmentWidget extends StatelessWidget {
|
|||||||
if (extension == "jpg") {
|
if (extension == "jpg") {
|
||||||
return Image.memory(att.data);
|
return Image.memory(att.data);
|
||||||
} else if (extension == "pdf") {
|
} 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(
|
return Text(
|
||||||
"Attachment not supported for preview, you'll need to download",
|
"Attachment not supported for preview, you'll need to download",
|
||||||
@ -39,19 +50,17 @@ class AttachmentWidget extends StatelessWidget {
|
|||||||
CloseButton(onPressed: () => {Navigator.pop(context)}),
|
CloseButton(onPressed: () => {Navigator.pop(context)}),
|
||||||
Text(
|
Text(
|
||||||
attachment.name
|
attachment.name
|
||||||
.toString(), //its alr a string but incase ¯\(ツ)/¯
|
.toString(), //its alr a string but incase ¯\(ツ)/¯ //update: i did that everywhere lol
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
decoration:
|
decoration: TextDecoration
|
||||||
TextDecoration.none), //TODO: personalize your fonts
|
.none), //TODO: personalize your fonts
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
Expanded(
|
Expanded(
|
||||||
|
child: attachmentViewer(attachment),
|
||||||
child: attachmentViewer(attachment),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user