The button is intended to delete/dispose a voice message when you are recording a message and you lock the record but does not answer to onPressed function.
This is the code
Widget timerLocked() {
return Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
¡ timer?.cancel();
timer = null;
startTime = DateTime.now();
recordDuration = "00:00";
_stop();
setState(() {
isLocked = false;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: [
ElevatedButton(
onPressed: (){
print('this is not working');
dispose();
testColor = Colors.white;
},
child: Icon(
Icons.delete,
size: 24,
color: testColor,
)),
Text(recordDuration),
),
],
),
),
);
}