conceptadev / mix

A styling system for Flutter
https://fluttermix.com
BSD 3-Clause "New" or "Revised" License
610 stars 38 forks source link

WIP: Add support for onTapDown and onTapUp #534

Open tilucasoli opened 3 days ago

tilucasoli commented 3 days ago

Related issue

533

Description

This pull request introduces support for styling widgets during the Tap Down and Tap Up events by incorporating these concepts as events in the press context variant.

Style(
  $box.height(100),
  $box.width(100),
  $box.color.red(),
  $box.wrap.scale(1),
  $on.press.event(
    (e) {
      switch (e) {
        case PressEvent.onTapUp:
        case PressEvent.onTapDown:
          return Style(
            $box.color.purple(),
            $box.wrap.scale(1),
          );
        case PressEvent.idle:
          break;
      }
      return Style(
        $box.color.blue(),
      );
    },
)

Changes

The main components of these changes are the PressEvent (enum) and the PressEventMixWidgetState (inherited widget). The enum value is held by PressEventMixWidgetState and is updated each time an onTap event occurs.

Review Checklist

Additional Information (optional)

Is there any additional context or documentation that might be helpful for reviewers?

vercel[bot] commented 3 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **mix-docs** | ⬜️ Ignored ([Inspect](https://vercel.com/fluttertools/mix-docs/FABM1rWTE6U56JVxXpPygoyokPRe)) | [Visit Preview](https://mix-docs-git-feat-press-events-fluttertools.vercel.app) | | Nov 29, 2024 1:11am |