I have an integer and boolean setup like list within a list.
List<List<int>> numberBoxes = [
[1, 2, 3, 4, 5, 6, 7],
[8, 9, 10, 11, 12, 13, 14],
[1, 1, 2, 1, 1, 2, 2],
];
List<List<bool>> pressButton = [];
I am creating a button for each numberBoxes:
Column(
children: numberBoxes.map((List<int> data) {
return Row(
children: data.map((int datax) {
return Expanded(
child: Padding(
padding:
const EdgeInsets.fromLTRB(5.0, 1.0, 5.0, 2.0),
child: RaisedButton(
padding: EdgeInsets.all(1.0),
child: Text(datax.toString()),
),
),
);
}).toList(),
);
}).toList(),
),
I wanted to change the color of the button if it was clicked by adding this under the RaisedButton
but what will I put in the pressButton[][]
to determine which current position am I in the list.
color: pressButton[][]
? Colors.grey
: Colors.blue,
onPressed: () {
setState(() {
pressButton[][] =
!pressButton[?][?];
});
},