[MessageInput] Fix attachments padding

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-01-13 11:22:03 +05:30
parent 8245d13cc4
commit 18c31a666b
+29 -32
View File
@@ -1542,17 +1542,17 @@ class MessageInputState extends State<MessageInput> {
return Column( return Column(
children: [ children: [
if (_attachments.any((e) => e.attachment?.type == 'file')) if (_attachments.any((e) => e.attachment?.type == 'file'))
LimitedBox( Padding(
maxHeight: 136.0, padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
child: ListView( child: LimitedBox(
reverse: true, maxHeight: 136.0,
shrinkWrap: true, child: ListView(
children: _attachments.reversed reverse: true,
.where((e) => e.attachment?.type == 'file') shrinkWrap: true,
.map( children: _attachments.reversed
(e) => Padding( .where((e) => e.attachment?.type == 'file')
padding: const EdgeInsets.symmetric(horizontal: 8.0), .map<Widget>(
child: ClipRRect( (e) => ClipRRect(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: FileAttachment( child: FileAttachment(
@@ -1578,31 +1578,28 @@ class MessageInputState extends State<MessageInput> {
.white, .white,
), ),
), ),
onTap: () { onTap: () =>
setState(() { setState(() => _attachments.remove(e)),
_attachments.remove(e);
});
},
), ),
), ),
), ),
), ),
), )
) .insertBetween(const SizedBox(width: 8)),
.toList(), ),
), ),
), ),
if (_attachments.any((e) => e.attachment?.type != 'file')) if (_attachments.any((e) => e.attachment?.type != 'file'))
LimitedBox( Padding(
maxHeight: 104.0, padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
child: ListView( child: LimitedBox(
scrollDirection: Axis.horizontal, maxHeight: 104.0,
children: _attachments child: ListView(
.where((e) => e.attachment?.type != 'file') scrollDirection: Axis.horizontal,
.map( children: _attachments
(attachment) => Padding( .where((e) => e.attachment?.type != 'file')
padding: const EdgeInsets.all(8.0), .map<Widget>(
child: ClipRRect( (attachment) => ClipRRect(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: Stack( child: Stack(
@@ -1629,9 +1626,9 @@ class MessageInputState extends State<MessageInput> {
], ],
), ),
), ),
), )
) .insertBetween(const SizedBox(width: 8)),
.toList(), ),
), ),
), ),
], ],