8000
Skip to content

feat(mix): add EnumVariant mixin for type-safe enum-based variants#894

Merged
tilucasoli merged 6 commits intomainfrom
tilucasoli/add-enum-variant
Apr 16, 2026
Merged

feat(mix): add EnumVariant mixin for type-safe enum-based variants#894
tilucasoli merged 6 commits intomainfrom
tilucasoli/add-enum-variant

Conversation

@tilucasoli
Copy link
Copy Markdown
Collaborator
@tilucasoli tilucasoli commented Apr 10, 2026

Related issue

N/A

Description

Adds EnumVariant mixin that allows enums to act as NamedVariants, and an enumVariant method on WidgetStateVariantMixin for applying them in a type-safe way.

Usage

// Define your variants as an enum
enum ButtonVariant with EnumVariant { primary, secondary, outlined }

// Use them with the fluent API
final style = BoxStyler()
    .variant(ButtonVariant.primary, style: BoxStyler().color(Colors.blue))
    .variant(ButtonVariant.secondary, style: BoxStyler().color(Colors.grey));

// Apply variants
final resolved = style.applyVariants([ButtonVariant.primary]);

Review Checklist

  • Testing: Have you tested your changes, including unit tests and integration tests for affected code?
  • Breaking Changes: Does this change introduce breaking changes affecting existing code or users?
  • Documentation Updates: Are all relevant documentation files (e.g. README, API docs) updated to reflect the changes in this PR?
  • Website Updates: Is the website containing the updates you make on documentation?

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@docs-page
Copy link
Copy Markdown
docs-page bot commented Apr 10, 2026

To view this pull requests documentation preview, visit the following URL:

docs.page/btwld/mix~894

Documentation is deployed and generated using docs.page.

@vercel
Copy link
Copy Markdown
Contributor
vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mix-docs Ready Ready Preview, Comment Apr 10, 2026 1:51pm

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added documentation Improvements or additions to documentation mix_generator mix_tailwinds repo labels Apr 16, 2026
@github-actions github-actions bot removed documentation Improvements or additions to documentation mix_generator repo mix_tailwinds labels Apr 16, 2026
Copy link
Copy Markdown
Collaborator
@leoafarias leoafarias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added documentation Improvements or additions to documentation repo labels Apr 16, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added mix_docs_preview and removed documentation Improvements or additions to documentation labels Apr 16, 2026
@tilucasoli tilucasoli merged commit b71f2d3 into main Apr 16, 2026
4 checks passed
@tilucasoli tilucasoli deleted the tilucasoli/add-enum-variant branch April 16, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0