corrected the checkbox selection issue

This commit is contained in:
Vaibhav Surve 2025-08-16 16:52:10 +05:30
parent 9feb9d1b4b
commit a6da579f07

View File

@ -234,38 +234,41 @@ class _DirectoryFilterBottomSheetState
itemCount: filteredList.length,
itemBuilder: (context, index) {
final item = filteredList[index];
final isSelected = selectedItems.contains(item.id);
return GestureDetector(
onTap: () => onToggle(item.id),
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 4, vertical: 6),
child: Row(
children: [
Container(
width: 18,
height: 18,
decoration: BoxDecoration(
color:
isSelected ? Colors.blueAccent : Colors.white,
border: Border.all(
color: Colors.black,
width: 1.2,
return Obx(() {
final isSelected = selectedItems.contains(item.id);
return GestureDetector(
onTap: () => onToggle(item.id),
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 4, vertical: 6),
child: Row(
children: [
Container(
width: 18,
height: 18,
decoration: BoxDecoration(
color:
isSelected ? Colors.blueAccent : Colors.white,
border: Border.all(
color: Colors.black,
width: 1.2,
),
borderRadius: BorderRadius.circular(4),
),
borderRadius: BorderRadius.circular(4),
child: isSelected
? const Icon(Icons.check,
size: 14, color: Colors.white)
: null,
),
child: isSelected
? const Icon(Icons.check,
size: 14, color: Colors.white)
: null,
),
const SizedBox(width: 8),
MyText(item.name, fontSize: 14),
],
const SizedBox(width: 8),
MyText(item.name, fontSize: 14),
],
),
),
),
);
);
});
},
),
)