refactor(mix): deprecate the per-edge border helpers - #1052
Open
leoafarias wants to merge 1 commit into
Open
leoafarias wants to merge 1 commit into
leoafarias wants to merge 1 commit into
Conversation
BorderStyleMixin exposed nine helpers - borderAll, borderTop, borderBottom,
borderLeft, borderRight, borderStart, borderEnd, borderVertical and
borderHorizontal - each taking {color, width, style, strokeAlign}. Every one
composes exactly what border() already expresses through BoxBorderMix, so they
duplicated the property surface without adding capability:
BoxStyler().borderAll(color: Colors.blue, width: 1.5);
BoxStyler().border(.color(Colors.blue).width(1.5));
BoxStyler().borderTop(color: Colors.blue, width: 2);
BoxStyler().border(.top(.color(Colors.blue).width(2)));
The dot-shorthand form also reads better, because BoxBorderMix exposes the
edges as statics and BorderSideMix chains color/width/style/strokeAlign, so
nothing names a type.
All nine replacements were verified compiling before the deprecation messages
were written - the first draft suggested .borderDirectional(...) for start and
end, which does not exist; .border(.start(...)) is correct.
There are zero call sites anywhere in the repository, including tests, so
nothing internal changes. 2918 tests pass and the package analyzes clean.
BoxBorderMix.all() is deliberately not deprecated. It is the only way to apply
a prebuilt BorderSideMix to every edge, it backs BoxBorderMix.none, and it
stays symmetric with .top/.bottom/.left/.right, which all take a BorderSideMix.
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.
BorderStyleMixinexposed nine helpers —borderAll,borderTop,borderBottom,borderLeft,borderRight,borderStart,borderEnd,borderVertical,borderHorizontal— each taking{color, width, style, strokeAlign}. Every one composes exactly whatborder()already expresses throughBoxBorderMix, so they duplicated the property surface without adding capability.The dot-shorthand form also reads better:
BoxBorderMixexposes the edges as statics andBorderSideMixchainscolor/width/style/strokeAlign, so nothing names a type.BoxBorderMix.all()is deliberately not deprecatedIt isn't redundant, and it's worth separating from the above:
BorderSideMixto every edge —.color().width()can't express that.BoxBorderMix.none..top()/.bottom()/.left()/.right(), which all take aBorderSideMix.Verification
.borderDirectional(...)forstart/end— that doesn't exist.startandendare statics onBoxBorderMix, so.border(.start(...))is correct. A deprecation pointing at a non-existent API would be worse than none.flutter test— 2918 passing.flutter analyze— clean.dart format— clean.Not included
SpacingStyleMixin.paddingAll(double)is literallypadding(EdgeInsetsGeometryMix.all(value))— the identical shape. But it has 29 usages across the repo, so it's the same argument with a much larger blast radius and belongs in its own decision.