default to success and hide indicators if not needed

This commit is contained in:
Salvatore Giordano
2021-02-26 13:23:24 +01:00
parent 2449fab448
commit f812fbbdc5
3 changed files with 23 additions and 4 deletions
@@ -27,7 +27,9 @@ class AttachmentUploadStateBuilder extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (attachment.uploadState == null) return Offstage();
if (message.status == null || message.status == MessageSendingStatus.sent) {
return Offstage();
}
final messageId = message.id;
final attachmentId = attachment.id;
@@ -227,6 +227,18 @@ class FileAttachment extends AttachmentWidget {
},
);
if (message.status == null || message.status == MessageSendingStatus.sent) {
trailingWidget = IconButton(
icon: StreamSvgIcon.cloudDownload(color: theme.colorTheme.black),
padding: const EdgeInsets.all(8),
visualDensity: VisualDensity.compact,
splashRadius: 16,
onPressed: () {
launchURL(context, attachment.assetUrl);
},
);
}
return Material(
type: MaterialType.transparency,
child: trailingWidget,