Skip to content

Add Support for onTapDown #533

@tilucasoli

Description

@tilucasoli

Description:

Mix supports $on.press for styling Widgets, but the style is applied only after the press action is completed (onTapUp). Developers have expressed the need for styling during the onTapDown event.

User Stories:

  1. As a developer using Mix,
    I want to style widgets specifically during the onTapDown event,
    so that I can provide immediate visual feedback, such as color changes or scaling, when a button is pressed.

Acceptance Criteria:

  • Add support for the onTapDown event in widget and expose it in the styling API.
  • The widget should only rebuild if it is listening to the state.
  • Ensure that onTapDown styles are applied immediately when the user presses the widget and reset when the press is released or canceled.
  • Include unit and integration tests to validate the functionality of onTapDown event styling.
  • Write documentation explaining how to use the onTapDown styling feature.
    • Add examples demonstrating use cases such as changing widget color or scaling on press.

Resources:

Example of API

$on.press.event((e) {
  switch (e) {
    case MixPressEvent.onTapDown:
      return Style(
        $box.color.red(),
      );
    case MixPressEvent.onTapUp:
      return Style();
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions