feat: Added file attachment to pick attachment section

This commit is contained in:
Deven Joshi
2020-12-03 11:39:38 +01:00
committed by Salvatore Giordano
parent 895497290c
commit 922208224d
3 changed files with 109 additions and 65 deletions
+16 -8
View File
@@ -6,11 +6,13 @@ import 'package:stream_chat_flutter/src/utils.dart';
class FileAttachment extends StatelessWidget {
final Attachment attachment;
final Size size;
final Widget trailing;
const FileAttachment({
Key key,
@required this.attachment,
this.size,
this.trailing,
}) : super(key: key);
@override
@@ -22,8 +24,13 @@ class FileAttachment extends StatelessWidget {
},
child: Container(
width: size?.width ?? 100,
margin: trailing != null ? EdgeInsets.only(top: 4.0) : null,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: trailing != null ? BorderRadius.circular(16.0) : null,
border: trailing != null
? Border.fromBorderSide(BorderSide(color: Color(0xFFE6E6E6)))
: null,
),
child: ListTile(
dense: true,
@@ -45,14 +52,15 @@ class FileAttachment extends StatelessWidget {
color: Colors.black.withOpacity(0.5),
),
),
trailing: IconButton(
icon: StreamSvgIcon.cloud_download(
color: Colors.black,
),
onPressed: () {
launchURL(context, attachment.assetUrl);
},
),
trailing: trailing ??
IconButton(
icon: StreamSvgIcon.cloud_download(
color: Colors.black,
),
onPressed: () {
launchURL(context, attachment.assetUrl);
},
),
),
),
),