đł Novident Tree View
This package provides a flexible solution for displaying hierarchical data structures while giving developers full control over node management. Unlike traditional tree implementations that enforce controller-based architectures, this package operates on simple data types that you extend to create your node hierarchy. Nodes become self-aware of their state changes through Listenable patterns, enabling reactive updates without complex state management.
⨠Highlights
- No controller required â nodes extend
Node/NodeContainerdirectly; the tree reacts to node changes viaListenablenotifications. - Policyâasâcode builders â each node type gets its own
NodeComponentBuilder; the tree picks the first builder whosevalidate()returnstrue. - Full dragâandâdrop by default â three drop zones per row (above / inside / below), realâtime border feedback, noâop detection, autoâexpand on hover, Live error badge on the drag card.
- Scrivener-like example â complete desktop workspace shipped in
example/with a binder sidebar, sheetâofâpaper editor, breadcrumb navigation, and structured content.
đŚ Installation
Add to your pubspec.yaml:
dependencies:
novident_tree_view: <latest>
novident_nodes: <latest>
đ Basic usage
import 'package:novident_tree_view/novident_tree_view.dart';
final Widget tree = TreeView(
root: myRootContainer,
configuration: TreeConfiguration(
builders: [FolderBuilder(), FileBuilder()],
dragConfig: DraggableConfigurations.simple(
feedback: (node, ctx) => MyDragCard(node: node),
),
indent: 14,
sharedData: {'theme': myTheme},
activateDragAndDropFeature: true,
),
);
đ Resources
Since there's a lot to explain and implement, we prefer to provide a separate document for each section.
| Document | Covers |
|---|---|
| đ˛ Components | How NodeComponentBuilder renders nodes, the ComponentContext API, the isDragging flag, the validate() discovery system |
| đ˛ Tree Configuration | All TreeConfiguration properties: builders, dragConfig, indent, shrinkWrap, sharedData, listView, zone heights, etc. |
| đ¤ Draggable Configurations | DraggableConfigurations â feedback widget, hover expansion, longâpress mode, drag axis, childâwhenâdragging |
| đ Indentation Configuration | IndentConfiguration â static perâlevel indentation, dynamic perânode builders, systemâfile presets |
| đ Drag and Drop details | NovDragAndDropDetails â dropâposition calculation, threeâzone mapping (mapDropPosition), global vs local offset |
| âď¸ Nodes Gestures | NodeDragGestures â lifecycle callbacks (onWillAcceptWithDetails, onAcceptWithDetails, onDragStart, onDragCanceled, âŚ) |
đ Recipes
- đď¸ Tree File â recreate a file tree quickly: node types (
File,Directory,Root), builders, configuration, and dragâandâdrop wiring.
More recipes will be added later
đł Contributing
We greatly appreciate your time and effort.
To keep the project consistent and maintainable, we have a few guidelines that we ask all contributors to follow.
See Contributing for more details.