Skip to content

feat: add TreeViewItem component and Gallery samples - #161

Open
Sanlorng wants to merge 1 commit into
devfrom
components/tree_view
Open

feat: add TreeViewItem component and Gallery samples#161
Sanlorng wants to merge 1 commit into
devfrom
components/tree_view

Conversation

@Sanlorng

@Sanlorng Sanlorng commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add compact TreeViewItem overloads for leaf and expandable items.
  • Support 16.dp hierarchy indentation, optional icons, standard selection indicators, and caller-owned checkbox slots.
  • Animate checkbox-slot enter/exit and the horizontal content shift while preserving caller-owned checkbox state.
  • Add standard, checkbox, and options Gallery samples backed by one shared nested TreeNode dataset.
  • Register only visible tree rows through lazy intervals and animate item placement/removal without rebuilding the tree data.
PixPin_2026-08-10_11-46-09.mp4

Behavior

  • A supplied checkbox slot replaces the standard selection indicator.
  • Checkbox mode maps selected to checkbox state; indeterminate parent nodes remain unselected.
  • Sample row clicks remain enabled no-ops when a checkbox is supplied.
  • Expandable items expose a dedicated click region from the level/checkbox boundary to the icon or text boundary.
  • Expansion interactions share the row interaction source, and click bounds plus collapsed chevrons respect RTL layout.
  • The options sample exposes checkbox, icon, and enabled states.
  • Every sample row uses animateItem() for expansion and collapse changes.

Review fixes

  • Correct the expansion overlay's logical end padding from the measured physical content edge in both LTR and RTL.
  • Mirror collapsed chevrons in RTL while keeping the expanded direction downward.
  • Avoid registering hidden zero-height LazyColumn items; contiguous collapsed siblings stay in a single lazy interval, and recursion follows only visible expanded branches.

Validation

  • ./gradlew :fluent:compileCommonMainKotlinMetadata :gallery:sharedApp:compileCommonMainKotlinMetadata
  • git diff --check
  • Final read-only source review: no Critical, Important, or Minor findings.

Gradle/build-script changes in the local checkout are intentionally excluded from this PR.

@Sanlorng
Sanlorng force-pushed the components/tree_view branch from c305f86 to 8b297d5 Compare August 10, 2026 04:00
@Sanlorng
Sanlorng marked this pull request as ready for review August 10, 2026 04:04
@Sanlorng
Sanlorng requested a balanced review from Copilot August 10, 2026 04:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a reusable hierarchical TreeViewItem component and Gallery demonstrations.

Changes:

  • Adds leaf and expandable tree-item overloads.
  • Supports indentation, icons, checkboxes, selection, and transitions.
  • Adds standard, checkbox, and configurable Gallery samples.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
TreeViewItemScreen.kt Adds tree datasets and interactive Gallery samples.
TreeViewItem.kt Implements the new tree-item component and defaults.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread fluent/src/commonMain/kotlin/io/github/composefluent/component/TreeViewItem.kt Outdated
Comment thread fluent/src/commonMain/kotlin/io/github/composefluent/component/TreeViewItem.kt Outdated
@Sanlorng
Sanlorng force-pushed the components/tree_view branch from 8b297d5 to 1e0ae86 Compare August 10, 2026 05:01
@Sanlorng
Sanlorng marked this pull request as draft August 10, 2026 05:02
@Sanlorng
Sanlorng force-pushed the components/tree_view branch from 38516b4 to 619eced Compare August 11, 2026 13:18
@Sanlorng
Sanlorng marked this pull request as ready for review August 11, 2026 14:06
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.

2 participants