if widget is not previewable, then give the user the possibility to download it there

This commit is contained in:
Juan Marulanda De Los Rios 2025-04-24 12:51:45 -04:00
parent 6beda384e1
commit c09f4e7a11

View File

@ -1,5 +1,6 @@
import "dart:typed_data";
import "package:crab_ui/attachmentDownload.dart";
import "package:crab_ui/structs.dart";
import "package:flutter/material.dart";
import 'package:pdfrx/pdfrx.dart';
@ -27,11 +28,42 @@ class AttachmentWidget extends StatelessWidget {
));
}
return Center(
child: Text(
"Attachment not supported for preview, you'll need to download",
style: TextStyle(
color: Colors.black, fontSize: 20, decoration: TextDecoration.none),
));
child: Container(
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Color(0xff6C63FF),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 10,
),
],
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"No preview available",
style: TextStyle(
color: Colors.white, fontSize: 18, decoration: TextDecoration.none),
),
SizedBox(
height: 5,
),
GestureDetector(
child: ElevatedButton(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text("Download", style: TextStyle(color: Color(0xff2c3e50)),),
Icon(Icons.download,
color: Color(0xffb0b0b0),),
]),
onPressed: () => Attachmentdownload().saveFile(att),
)),
]),
));
}
@override