feat(accordion): add whole-item state builder - #87
Merged
Conversation
Contributor
LCOV of commit
|
This was referenced Aug 12, 2026
Closed
Closed
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.
Description
Adds an optional
NakedAccordion.itemBuilderfor decorating the fullyassembled trigger and panel from the accordion item's authoritative state.
The supplied child retains Naked UI's gestures, focus handling, keyboard
actions, semantics, default layout, panel visibility, and transition.
Downstream failure case
Remix needs to resolve one style for the complete accordion-item surface from
hovered, focused, pressed, disabled, and expanded state. Previously,
NakedAccordioncreated separate item-state scopes below the trigger and panelwhile assembling their parent outside either scope. A downstream adapter could
not access the authoritative state at the whole-item boundary and had to mirror
it through interaction callbacks.
That mirror can diverge. If an item is disabled while the mouse remains over
its trigger, Remix clears its mirrored hover state while Naked UI retains the
real hover state until pointer exit. Re-enabling without moving the pointer
then leaves the adapter and primitive disagreeing about whether the item is
hovered.
itemBuildermoves the complete item under oneNakedStateScope. Its context,the trigger builder, and the expanded panel now resolve the same stable
WidgetStatesControllerthroughNakedAccordionItemState.controllerOf<T>(context), removing the need for asecond mutable state source.
Pointer press state is also tracked whenever the accordion is enabled, even
when
onPressChangeis omitted, and is cleared if the item becomes disabled.The callback remains optional and continues to report actual transitions when
provided.
The API is additive and source-compatible. Omitting
itemBuilderpreserves theexisting trigger builder,
Columnlayout, transition behavior, expansioncontroller contract, semantics, and keyboard activation. Remix adoption and
removal of its mirrored controller remain a separate downstream change.
This is a headless composition/API change with no rendered design change, so
screenshots are not applicable.
Validation
fvm dart format --set-exit-if-changed .— 148 files checked, 0 changed.fvm flutter analyze --fatal-infos— no issues on pinned Flutter 3.41.2.fvm flutter test packages/naked_ui/test— 683 passed, 3 intentionally skipped external integration launchers.fvm flutter test packages/example/test— 23 passed, 3 intentionally skipped platform/golden cases.fvm flutter pub publish --dry-run— 0 warnings.git diff --check origin/main...HEAD— clean.Related Issues
No linked issue was supplied. The downstream Remix failure case is documented
above.
Checklist
///).Breaking Change
Does this PR require users of the package to manually update their code?