I'm trying to update SpeedDialChild icon value based on a boolean value.
final showCriticalPoint = useState(false);
SpeedDial(
isOpenOnStart: true,
closeManually: true,
renderOverlay: false,
closeDialOnPop: false,
direction: SpeedDialDirection.down,
backgroundColor: Colors.white,
activeIcon: Icons.close,
iconTheme: IconThemeData(color: themeData.colorScheme.secondary),
icon: Icons.menu_outlined,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
buttonSize: const Size(48, 48),
childrenButtonSize: const Size(48, 48),
spacing: 4,
children: [
SpeedDialChild(
child: Icon(
showCriticalPoint.value ? Icons.report_off_outlined : Icons.report_outlined,
color: Colors.white,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
backgroundColor: Colors.red,
onTap: () {
showCriticalPoint.value = !showCriticalPoint.value;
},
),
],
),
in children I wanted to change icon when its tapped
SpeedDialChild(
child: Icon(
showCriticalPoint.value ? Icons.report_off_outlined : Icons.report_outlined,
color: Colors.white,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
backgroundColor: Colors.red,
onTap: () {
showCriticalPoint.value = !showCriticalPoint.value;
},
),