feat(mix_generator): add @MixableModifier annotation and generator#897
Open
tilucasoli wants to merge 14 commits intomainfrom
Open
feat(mix_generator): add @MixableModifier annotation and generator#897tilucasoli wants to merge 14 commits intomainfrom
tilucasoli wants to merge 14 commits intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…x classes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replaces the hand-written OpacityModifierMix with a generated one. Constructor changed from positional to named params. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
To view this pull requests documentation preview, visit the following URL: Documentation is deployed and generated using docs.page. |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…difiers WidgetModifier constructors use positional params, so the generated resolve() now calls them with positional args instead of named args. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace hand-written ModifierMix classes with code generation for 19 modifiers across 14 files. Update generator to support named constructor params and fix single-cascade lint warning. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ugFillProperties, props Add ModifierMixinBuilder that generates _$XModifierMethods mixin for @MixableModifier annotated classes, replacing hand-written copyWith, lerp, debugFillProperties, and props methods across all 19 modifier classes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
N/A - new feature
Description
Adds a
@MixableModifier()annotation and code generator that automatically generatesModifierMixclasses fromWidgetModifiersubclasses. This eliminates ~30-40 lines of boilerplate per modifier (resolve, merge, debugFillProperties, props, constructors). The generator uses the existingMixTypeRegistryto determineProp.maybevsProp.maybeMixwrapping.Changes
mix_annotations: AddedMixableModifierannotation classmix_generator: AddedModifierGenerator(triggers on@MixableModifier) andModifierMixBuilder(generates full standaloneModifierMixclass)mix_generator/build.yaml: Registeredmodifier_generatorbuilder forlib/src/modifiers/**/*.dartmix: Applied@MixableModifier()toOpacityModifieras proof-of-concept, replacing the hand-writtenOpacityModifierMixwith a generated oneModifierMixBuilder, all 3736 existing mix tests passReview Checklist
Additional Information (optional)
Breaking change:
OpacityModifierconstructor changed from positional([double? opacity])to named({double? opacity})to support the generatedresolve()pattern. Complex modifiers with non-1:1 field mappings (Scale, Rotate, Skew, Transform) are out of scope and remain hand-written.