feat: Update AttachmentsSection to use RxList for reactive attachment management

This commit is contained in:
Vaibhav Surve 2025-08-02 10:16:01 +05:30
parent d0cbfa987d
commit 5f66c4c647

View File

@ -446,7 +446,7 @@ class _TileContainer extends StatelessWidget {
}
class _AttachmentsSection extends StatelessWidget {
final List<File> attachments;
final RxList<File> attachments;
final ValueChanged<File> onRemove;
final VoidCallback onAdd;
@ -458,12 +458,14 @@ class _AttachmentsSection extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Wrap(
return Obx(() => Wrap(
spacing: 8,
runSpacing: 8,
children: [
...attachments.map((file) =>
_AttachmentTile(file: file, onRemove: () => onRemove(file))),
...attachments.map((file) => _AttachmentTile(
file: file,
onRemove: () => onRemove(file),
)),
GestureDetector(
onTap: onAdd,
child: Container(
@ -478,7 +480,7 @@ class _AttachmentsSection extends StatelessWidget {
),
),
],
);
));
}
}