Skip to content

feat(accordion): add whole-item state builder - #87

Merged
leoafarias merged 10 commits into
mainfrom
feat/accordion-item-builder
Aug 12, 2026
Merged

feat(accordion): add whole-item state builder#87
leoafarias merged 10 commits into
mainfrom
feat/accordion-item-builder

Conversation

@leoafarias

Copy link
Copy Markdown
Member

Description

Adds an optional NakedAccordion.itemBuilder for decorating the fully
assembled 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,
NakedAccordion created separate item-state scopes below the trigger and panel
while 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.

itemBuilder moves the complete item under one NakedStateScope. Its context,
the trigger builder, and the expanded panel now resolve the same stable
WidgetStatesController through
NakedAccordionItemState.controllerOf<T>(context), removing the need for a
second mutable state source.

Pointer press state is also tracked whenever the accordion is enabled, even
when onPressChange is 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 itemBuilder preserves the
existing trigger builder, Column layout, transition behavior, expansion
controller 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.
  • Flutter 3.41.0 minimum-version analysis and full package suite — no issues; 683 passed.
  • Flutter 3.44.6 current-stable analysis and focused accordion/semantics suite — no issues; 27 passed.
  • fvm flutter pub publish --dry-run — 0 warnings.
  • git diff --check origin/main...HEAD — clean.
  • Final simplification and code review — no remaining findings.

Related Issues

No linked issue was supplied. The downstream Remix failure case is documented
above.


Checklist

  • My PR includes unit or integration tests for all changed/updated/fixed behaviors.
  • I have updated or added relevant documentation (doc comments with ///).
  • I am prepared to follow up on review comments in a timely manner.

Breaking Change

Does this PR require users of the package to manually update their code?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@github-actions

Copy link
Copy Markdown
Contributor

LCOV of commit 611d4e6 during Flutter CI #279

	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
Reading tracefile /tmp/__zgosalvez_github-actions-report-lcov/lcov.info.
Summary coverage rate:
  source files: 22
  lines.......: 90.4% (3017 of 3339 lines)
  functions...: no data found
  branches....: no data found
Message summary:
  1 warning message:
    deprecated: 1

Files changed coverage rate:
  	(use "lcov --ignore-errors deprecated,deprecated ..." to suppress this warning)
                                                                   |Lines       |Functions  |Branches    
  Filename                                                         |Rate     Num|Rate    Num|Rate     Num
  packages/naked_ui/lib/src/naked_accordion.dart                   |93.6%    202|    -     0|    -      0

@leoafarias
leoafarias merged commit 7295c16 into main Aug 12, 2026
7 checks passed
@leoafarias
leoafarias deleted the feat/accordion-item-builder branch August 12, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant