-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TreeView component #96
base: update_theme_behavior
Are you sure you want to change the base?
Add TreeView component #96
Conversation
Introduce a reusable TreeView component for hierarchical data display with expandable and collapsible nodes. Implemented the corresponding TreeViewScreen in the gallery for demonstration purposes. Includes a tree builder DSL for easy tree structure creation and ensures visual consistency with Fluent design.
Introduced an optional `onClick` callback to `TreeElement` (both nodes and leaves) to handle custom click actions. Updated the tree builder DSL and composables to utilize this functionality, enabling more interactive tree components.
Modified the Tree component and TreeBuilder to include the expanded state as a parameter in the onClick callbacks. This allows nodes to differentiate actions based on their expanded or collapsed state, improving interactivity in the TreeView. Updated sample usage in TreeViewScreen to reflect these changes.
@@ -0,0 +1,299 @@ | |||
package com.konyaco.fluent.component | |||
|
|||
import androidx.compose.animation.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import wildcard
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.hoverable | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.foundation.layout.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import wildcard
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.runtime.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import wildcard
object TreeNodeDefaults { | ||
@Stable | ||
@Composable | ||
fun defaultNodeColors( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default color token should reference figma file, see https://www.figma.com/community/file/1440832812269040007/windows-ui-kit
} | ||
|
||
@Composable | ||
fun <T> TreeNodeColorScheme.schemeFor(state: VisualState): TreeNodeColor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function was exist in the VisualScheme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this components should be move to .collection package.
val tree = remember { | ||
buildTree { | ||
node(data = "Root", onClick = { isExpanded -> | ||
println("Root clicked, expanded: $isExpanded") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Section(output = { Text(outputContent)} ) to show sample click event.
Thank you for your contribution, but unfortunately, your PR cannot be merged at this time. Here are some reasons why:
I hope these suggestions help. Thank you for your understanding and cooperation! 😊 If you have any questions or need further assistance, please feel free to let me know. |
Thank you very much for taking the time to detail all my mistakes! :) I admit that I was not aware that there was a figma 😅, I was just inspired by https://bdlukaa.github.io/fluent_ui/#/navigation/tree_view |
Introduce a reusable TreeView component for hierarchical data display with expandable and collapsible nodes. Implemented the corresponding TreeViewScreen in the gallery for demonstration purposes. Includes a tree builder DSL for easy tree structure creation and ensures visual consistency with Fluent design.