Skip to content

refactor(mix): deprecate the per-edge border helpers - #1052

Open
leoafarias wants to merge 1 commit into
mainfrom
refactor/deprecate-border-edge-helpers
Open

leoafarias wants to merge 1 commit into
mainfrom
refactor/deprecate-border-edge-helpers

Conversation

@leoafarias

Copy link
Copy Markdown
Member

BorderStyleMixin exposed nine helpers — borderAll, borderTop, borderBottom, borderLeft, borderRight, borderStart, borderEnd, borderVertical, 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.

// Before
BoxStyler().borderAll(color: Colors.blue, width: 1.5);
BoxStyler().borderTop(color: Colors.blue, width: 2);

// After
BoxStyler().border(.color(Colors.blue).width(1.5));
BoxStyler().border(.top(.color(Colors.blue).width(2)));

The dot-shorthand form also reads better: BoxBorderMix exposes the edges as statics and BorderSideMix chains color/width/style/strokeAlign, so nothing names a type.

BoxBorderMix.all() is deliberately not deprecated

It isn't redundant, and it's worth separating from the above:

  • It's the only way to apply a prebuilt BorderSideMix to every edge — .color().width() can't express that.
  • It backs BoxBorderMix.none.
  • It stays symmetric with .top() / .bottom() / .left() / .right(), which all take a BorderSideMix.

Verification

  • All nine replacements were compiled before the deprecation messages were written. The first draft suggested .borderDirectional(...) for start/end — that doesn't exist. start and end are statics on BoxBorderMix, so .border(.start(...)) is correct. A deprecation pointing at a non-existent API would be worse than none.
  • Zero call sites anywhere in the repository, including tests, so nothing internal changes.
  • flutter test2918 passing. flutter analyze — clean. dart format — clean.

Not included

SpacingStyleMixin.paddingAll(double) is literally padding(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.

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.
@github-actions github-actions Bot added the mix label Sep 15, 2026
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.

1 participant