feat: Update AttachmentsSection to use RxList for reactive attachment management
This commit is contained in:
parent
d0cbfa987d
commit
5f66c4c647
@ -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,27 +458,29 @@ class _AttachmentsSection extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
...attachments.map((file) =>
|
||||
_AttachmentTile(file: file, onRemove: () => onRemove(file))),
|
||||
GestureDetector(
|
||||
onTap: onAdd,
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey.shade400),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.grey.shade100,
|
||||
return Obx(() => Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
...attachments.map((file) => _AttachmentTile(
|
||||
file: file,
|
||||
onRemove: () => onRemove(file),
|
||||
)),
|
||||
GestureDetector(
|
||||
onTap: onAdd,
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey.shade400),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.grey.shade100,
|
||||
),
|
||||
child: const Icon(Icons.add, size: 30, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
child: const Icon(Icons.add, size: 30, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user