I only want to take nameSingleItem from one nameCategory? so for example there are 10 nameCategories and each of them has a nameSingleItem with the item of the nameSingleItem is the same. so focus on items from one nameCategory.
static const List<SingleCategoryModel> campOptions = [
SingleCategoryModel(
nameCategory: 'Camp Nomor 15',
singleItemCategoryList: [
SingleItemCategoryModel(nameSingleItem: "VVIP"),
SingleItemCategoryModel(nameSingleItem: 'VIP'),
SingleItemCategoryModel(nameSingleItem: 'Barrack'),
],
),
SingleCategoryModel(
nameCategory: 'Camp Nomor 16',
singleItemCategoryList: [
SingleItemCategoryModel(nameSingleItem: 'VIP'),
SingleItemCategoryModel(nameSingleItem: 'Barrack'),
],
),
];
SizedBox(
width: 300,
child: Select2dot1(
selectDataController: SelectDataController(
data: campOptions,
isMultiSelect: false, //false for pick 1 item, while true for pick multiple
),
pillboxTitleSettings: const PillboxTitleSettings(
title: 'Pilih Tipe Camp',
titleStyleDefault: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
pillboxSettings: PillboxSettings(
defaultDecoration: BoxDecoration(
border: Border.all(color: Colors.black, width: 1.5),
borderRadius: BorderRadius.circular(8),
color: Colors.white,
),
),
onChanged: (selectedItems) {
if (selectedItems.isNotEmpty) {
final selectedItem = selectedItems.first;
print("Tipe Camp Terpilih: ${selectedItem.nameSingleItem}");
}
},
),
),
You can add a value
after nameSingleItem
with an example
SingleItemCategoryModel(nameSingleItem: "VVIP", value '15-1')
//example value:15-1. 15 is the camp id, 1 is the room type id