-
Notifications
You must be signed in to change notification settings - Fork 47
fix(mix): accept shadow token .mix() on raw-list styler methods (sentinel-style, non-breaking) #941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0b96624
6f458a4
bcd6f01
ace4b28
73fec47
ddc7fa5
2d5a068
8b7977f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -212,7 +212,16 @@ class TextStyleMix extends Mix<TextStyle> | |
| debugLabel: Prop.maybe(debugLabel), | ||
| wordSpacing: Prop.maybe(wordSpacing), | ||
| textBaseline: Prop.maybe(textBaseline), | ||
| shadows: shadows != null ? Prop.mix(ShadowListMix(shadows)) : null, | ||
| // A `shadowToken.mix()` ref already is a [ShadowListMix] (and a | ||
| // token-carrying [Prop]); pass it straight to [Prop.mix] so its token | ||
| // source is preserved instead of being wrapped into a fresh list. | ||
| shadows: shadows != null | ||
| ? Prop.mix( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This preserves pure token |
||
| shadows is ShadowListMix | ||
| ? shadows as ShadowListMix | ||
| : ShadowListMix(shadows), | ||
| ) | ||
| : null, | ||
| fontFeatures: Prop.maybe(fontFeatures), | ||
| decoration: Prop.maybe(decoration), | ||
| decorationColor: Prop.maybe(decorationColor), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,10 +165,15 @@ final class BoxShadowMixRef extends Prop<BoxShadow> | |
| } | ||
| } | ||
|
|
||
| /// Token reference for [ShadowListMix] that implements Mix interface instead of Flutter interface | ||
| /// Token reference for [ShadowListMix] that implements Mix interface instead of Flutter interface. | ||
| /// | ||
| /// Also implements `List<ShadowMix>` so that `shadowToken.mix()` can be passed | ||
| /// directly to styler methods that accept a raw `List<ShadowMix>` (e.g. | ||
| /// `TextStyler.shadows`) without changing their signatures. The list members | ||
| /// are never invoked — the ref is detected as a token and routed as a Mix. | ||
| final class ShadowListMixRef extends Prop<List<Shadow>> | ||
| with ValueRef<List<Shadow>> | ||
| implements ShadowListMix { | ||
| implements ShadowListMix, List<ShadowMix> { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this ref now implements the raw |
||
| ShadowListMixRef(super.prop) : super.fromProp(); | ||
|
|
||
| @override | ||
|
|
@@ -177,10 +182,16 @@ final class ShadowListMixRef extends Prop<List<Shadow>> | |
| } | ||
| } | ||
|
|
||
| /// Token reference for [BoxShadowListMix] that implements Mix interface instead of Flutter interface | ||
| /// Token reference for [BoxShadowListMix] that implements Mix interface instead of Flutter interface. | ||
| /// | ||
| /// Also implements `List<BoxShadowMix>` so that `boxShadowToken.mix()` can be | ||
| /// passed directly to styler methods that accept a raw `List<BoxShadowMix>` | ||
| /// (e.g. `BoxStyler.boxShadows`, `BoxStyler.shadows`) without changing their | ||
| /// signatures. The list members are never invoked — the ref is detected as a | ||
| /// token and routed as a Mix. | ||
| final class BoxShadowListMixRef extends Prop<List<BoxShadow>> | ||
| with ValueRef<List<BoxShadow>> | ||
| implements BoxShadowListMix { | ||
| implements BoxShadowListMix, List<BoxShadowMix> { | ||
| BoxShadowListMixRef(super.prop) : super.fromProp(); | ||
|
|
||
| @override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch currently blocks CI: with
dcm analyze --fatal-warnings,boxShadowis staticallyList<BoxShadowMix>?, so DCM reportsboxShadow is BoxShadowListMixand the following cast as unrelated. The same pattern inTextStyleMixfails too. Please route this through a DCM-safe helper or another preservation path so the token case survives without tripping analysis.