fix: fixed sizes of file attachment
This commit is contained in:
committed by
Salvatore Giordano
parent
c4c0f97f34
commit
dffad3d6bc
@@ -20,6 +20,7 @@ class FileAttachment extends StatelessWidget {
|
||||
return Material(
|
||||
child: Container(
|
||||
width: size?.width ?? 100,
|
||||
height: 56.0,
|
||||
margin: trailing != null ? EdgeInsets.only(top: 4.0) : null,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
@@ -28,36 +29,90 @@ class FileAttachment extends StatelessWidget {
|
||||
? Border.fromBorderSide(BorderSide(color: Color(0xFFE6E6E6)))
|
||||
: null,
|
||||
),
|
||||
child: ListTile(
|
||||
dense: true,
|
||||
leading: Container(
|
||||
child: _getFileTypeImage(attachment.extraData['mime_type']),
|
||||
height: 40.0,
|
||||
width: 33.33,
|
||||
),
|
||||
title: Text(
|
||||
attachment?.title ?? 'File',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
child: _getFileTypeImage(attachment.extraData['mime_type']),
|
||||
height: 40.0,
|
||||
width: 33.33,
|
||||
margin: EdgeInsets.all(8.0),
|
||||
),
|
||||
maxLines: 3,
|
||||
),
|
||||
subtitle: Text(
|
||||
'${attachment.extraData['file_size'] ?? 'N/A'} bytes',
|
||||
style: TextStyle(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
),
|
||||
trailing: trailing ??
|
||||
IconButton(
|
||||
icon: StreamSvgIcon.cloud_download(
|
||||
color: Colors.black,
|
||||
),
|
||||
onPressed: () {
|
||||
launchURL(context, attachment.assetUrl);
|
||||
},
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
attachment?.title ?? 'File',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14.0,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
SizedBox(
|
||||
height: 3.0,
|
||||
),
|
||||
Text(
|
||||
'${attachment.extraData['file_size'] ?? 'N/A'} bytes',
|
||||
style: TextStyle(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
fontSize: 14.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
trailing ??
|
||||
IconButton(
|
||||
icon: StreamSvgIcon.cloud_download(
|
||||
color: Colors.black,
|
||||
),
|
||||
onPressed: () {
|
||||
launchURL(context, attachment.assetUrl);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
// ListTile(
|
||||
// dense: true,
|
||||
// leading: Container(
|
||||
// child: _getFileTypeImage(attachment.extraData['mime_type']),
|
||||
// height: 40.0,
|
||||
// width: 33.33,
|
||||
// ),
|
||||
// title: Text(
|
||||
// attachment?.title ?? 'File',
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// maxLines: 3,
|
||||
// ),
|
||||
// subtitle: Text(
|
||||
// '${attachment.extraData['file_size'] ?? 'N/A'} bytes',
|
||||
// style: TextStyle(
|
||||
// color: Colors.black.withOpacity(0.5),
|
||||
// ),
|
||||
// ),
|
||||
// trailing: trailing ??
|
||||
// IconButton(
|
||||
// icon: StreamSvgIcon.cloud_download(
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// launchURL(context, attachment.assetUrl);
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1254,13 +1254,23 @@ class MessageInputState extends State<MessageInput> {
|
||||
MediaQuery.of(context).size.width * 0.55,
|
||||
MediaQuery.of(context).size.height * 0.3,
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: StreamSvgIcon.close_small(),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_attachments.remove(e);
|
||||
});
|
||||
},
|
||||
trailing: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: InkWell(
|
||||
child: CircleAvatar(
|
||||
backgroundColor:
|
||||
Colors.black.withOpacity(0.2),
|
||||
maxRadius: 12.0,
|
||||
child: StreamSvgIcon.close(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_attachments.remove(e);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user