I'm creating expandable data. I tried with the Expand icon widget. But the expand icon is not working properly. The button state is not changing.
Code:
bool _isExpanded = true;
Container(
color: const Color(0xffeaeaea),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text('Description'),
),
ExpandIcon(
expandedColor: Colors.black,
color: Colors.black,
isExpanded: _isExpanded,
onPressed: (bool _isExpanded) {
setState(() {
_isExpanded = !_isExpanded;
});
}),
]),
),
if (_isExpanded) const Text('Data'),