У меня есть 3 массива. Например, если я выберу букву «G», я хочу просто выбрать контейнер «G». Вместо этого он выбирает весь массив [index]. Как я могу просто выбрать один Контейнер?
var array1 = ["A", "B", "C", "D"];
var array2 = ["E", "F", "G", "H"];
var array3 = ["I", "J", "K", "L"];
var paramselected = 0;
gridView(List<String> arrayParam) {
return GridView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
itemCount: arrayParam.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () {[enter image description here][1]
setState(() {
paramselected = index;
});
},
child: Container(
decoration: BoxDecoration(
color: (paramselected == index) ? Colors.blue[50] : Colors.white,
border: Border.all(),
),
child: Center(
child: Text(
arrayParam[index],
),
),
),
);
},
);
}
}
это то, что я получил