feat(dropdown): add optional border to the dropdown panel - #228
Open
welingtonfidelis wants to merge 1 commit into
Open
welingtonfidelis wants to merge 1 commit into
welingtonfidelis wants to merge 1 commit into
Conversation
The panel is separated from the content behind it by elevation alone. That is enough while the two differ in colour, and not enough when they do not: a white panel over white cards reads as one surface, and raising the elevation does not fix it because the shadow is what is being missed, not what is being seen. `DropdownDecoration.border` takes a `BorderSide` and defaults to null, so every existing panel renders exactly as before. Material asserts that `shape` and `borderRadius` are never both set, so the radius travels inside the `RoundedRectangleBorder` whenever a border is given, and the plain `borderRadius` path is kept otherwise. A test covers that the radius survives the move — dropping it there would square off every rounded panel that adopts a border.
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.
What
Adds
DropdownDecoration.border, an optionalBorderSidedrawn around thedropdown panel.
Why
The panel is separated from whatever is behind it by
elevationalone. Thatworks while the two differ in colour, and stops working when they do not — a
white panel over white cards reads as a single surface. Raising the elevation
does not help, because what is missing is an edge, not a stronger shadow.
There is no way to get one today: the panel is a
Material(elevation, borderRadius, color)built inside the package, andDropdownDecorationexposes neither
shapenor a border.How
borderdefaults tonull, so every existing panel renders exactly as before.Materialasserts thatshapeandborderRadiusare never both set, so theradius travels inside a
RoundedRectangleBorderwhenever a border is given,and the plain
borderRadiuspath is kept otherwise.Tests
test/panel_border_test.dartcovers the three states: an outline is drawn whena border is given, the radius survives the move into the shape, and the
borderRadiuspath is untouched when no border is given.The middle one guards the actual risk of this change: dropping the radius while
moving it into the shape would square off every rounded panel that adopts a
border, and nothing else would catch it.
test/decoration_test.dartgets the two matching unit assertions.Full suite: 156 tests passing,
flutter analyzeclean.