How do I change a button widget to run on button down vs button up?

I’ve been struggling with this quite a bit. Initially, I assumed I could simply call something on the button itself to change the behavior to fire not on button release, but on button press, but I didn’t find a way to do that.

button("Tap").on_press(Message::Tap).into(),

I’m assuming I need to create some sort of custom widget with a custom configuration, but I can’t seem to figure it out.

I needed to do the same thing for a button press, have it fire on key press and not key release, and that seemed pretty straight forward with:

keyboard::on_key_press()

Not sure how to achieve the same for a button.

Link to button code in repo.

The button itself does not provide that functionality. I think the easiest way to archive this is using the MouseArea widget.

Hmm, would there be a way to create a custom widget that overlays a button with a mouse area? I’m not quite sure the best way to implement this behavior in a way that is has good UX when interacting with the widget.

Also, JL initials, for the win. :tada:

You can just put any kind of widget in a mouse area. Although I would not put a button inside of it but a container with a label and style is accordingly to the status.