flutter_directory_tree 2.0.1
flutter_directory_tree: ^2.0.1 copied to clipboard
Virtualized, keyboard-first directory tree view for Flutter: incremental expand and collapse, multi-select, tri-state checkboxes, search, lazy loading.
Changelog #
All notable changes to this project will be documented in this file.
2.0.1 #
Fixed #
- The example's Explorer divider now follows the app's color scheme when
switching between light and dark themes. The example shows how to host
the tree and picker in a standalone
material_uiapp. - Updated the example's Android runner to Gradle 9 and AGP 9 so the showcase can build on supported Flutter SDKs.
2.0.0 #
Breaking: a ground-up rewrite on directory_tree 2.0.0. Code written for 1.x
needs changes. MIGRATION.md maps every 1.x declaration to
its replacement, lists the changes that compile but behave differently,
and has recipes for 1.x features that moved. dart fix --apply renames
the theme parameters indent and rowHeight and the re-exported
ListDiff.removeIndicesDesc, ListDiff.insertIndicesAsc, and
TreeEntry.fullPath; every other change is manual.
Added #
DirectoryTreeController<T>keeps all view state as immutable values: expansion, selection, tri-state checks, keyboard focus, search, and the lazy-loading status of each folder. Each command notifies once. Expanding and collapsing a folder updates the rows incrementally, andlastRowsChangesays which block of rows changed.- Search through
query(parsed withTreeQuery) andfilter, with matches revealed and highlighted. The requestedexpansionleaves out the folders a search opened, so clearing the search restores the view, except that the folders leading to the focused row stay open. - Lazy loading with
loadChildren,loadStatusOf,loadChildren(id), andreloadChildren(id), andFileSystemTreeLoaderin the newpackage:flutter_directory_tree/io.dartlibrary, which also re-exportsDirectoryScanner. A reload keeps the folder's contents until the new listing replaces them, so the folders below it keep their state, and the open ones are listed again in turn. SliverDirectoryTree, a virtualized sliver with fixed-height rows that rebuilds only the rows whose state changed, keeps the first visible row in place when the rows change, and animates the rows a folder reveals.- Mouse and touch handling: click, Shift-click, Ctrl-click (Cmd-click on macOS), double-click activation, secondary click, touch long press, and hover.
DirectoryTreeKeyboard,DirectoryTreeShortcuts.defaults, and the tree intents: platform-specific bindings, right-to-left layouts, and type-ahead find (also with Option and AltGr). Tabbing into a tree focuses its first selected row, or its first row.selectionFollowsFocus: falsemoves the focus without selecting.- Context menus with
DirectoryTreeContextMenuandDirectoryTreeMenuDetails, opened by secondary click, long press, Shift+F10, and the context menu key.selectOnOpendecides whether opening the menu selects the row. - Drag and drop with
DirectoryTreeDragAndDrop,DirectoryTreeDragAndDropScope, andDirectoryTreeDropDetails. DirectoryTreeSearchField,DirectoryTreePicker, andDirectoryTreePickerMode.DirectoryTreeRow,DirectoryTreeRowDetails,DirectoryTreeExpander,DirectoryTreeCheckbox,DirectoryTreeLabel,DirectoryTreeIndentGuides, andDirectoryTreeIconSetfor custom rows and icons.compactFoldersandshowRootson the controller.- Row semantics: label, level hint (
levelSemanticsHint), selected, expanded, and checked states, the keyboard focus, loading and failed states, and expand, collapse, retry, and Open (onActivate) actions, with localizable labels;semanticLabelfor the whole tree. - Support for the web, compiled to JavaScript and to WebAssembly.
lib/fix_data.yamlwith thedart fixrenames.
Changed #
DirectoryTreeControlleris generic over the entry data type, takes aDirectoryTree<T>astree, and identifies nodes byNodeId(the canonical path) instead of generated string ids. It starts with every folder closed and an empty selection in multiple mode.DirectoryTreeViewhandles clicks, keys, checkboxes, context menus, and drag and drop itself.rowBuilderreplacesnodeBuilderand is optional.DirectoryTreePaneltakes every parameter ofDirectoryTreeView, plustitle,actions,toolbar,showToolbar,showSearch, andsearchHintText. It no longer takes the keyboard focus by default.DirectoryTreeToolbarshows a title, actions, and expand all, collapse all, and compact folders buttons. The search field is nowDirectoryTreeSearchField.showDirectoryTreePickertakes atree, amode, andmultiple, returns the picked nodes ornullon cancel, and no longer changes the caller's controller.DirectoryTreeThemeDatais aThemeExtensionwith nullable fields and Material 3 defaults.indentis nowindentWidth,rowHeightisrowExtent(default 36, adjusted by the visual density, at least 48 on touch platforms, and taller with large text),selectionColorisselectedColorplusinactiveSelectedColor,indentGuidesisguideStyle,roundedCornersisrowBorderRadius, andfocusColorisfocusedBorderColor.- The package requires Dart 3.13.5 and Flutter 3.47.7, and depends only on
directory_tree2.0.0 and Flutter. Thepathdependency is gone.
Removed #
ExpansionControllerandSelectionController: use the controller'sexpansionandselectionvalues and commands.SelectionShortcuts, the 1.x intents (ExpandNodeIntent,CollapseNodeIntent,ToggleNodeIntent,RevealNodeIntent,SelectOnlyIntent,ClearSelectionIntent), andDirectoryTreeAction.TreeNodeTile,NodeVisualState,NodeBuilder, andExpanderBuilder.ContextMenuDelegate,MaterialContextMenuDelegate, andNodeAction.IconProviderandMaterialIconProvider.DirectoryTreeDefaults,revealAndSelect,folderSelection, andschedulePreserveScrollOffset.DirectoryTreeViewparametersexpanderBuilder,expanderSize,expanderGap,contextMenuDelegate,addAutomaticKeepAlives, andpreserveScrollOnChanges.
Fixed #
These 1.0.0 defects are gone in 2.0.0:
- Repeated Shift+Up oscillated between a two-row and a three-row selection, and Shift+Page Up extended only once.
- The picker's confirm button kept the enabled state it had when the dialog opened, so it stayed disabled after selecting something in a dialog that opened with nothing selected. The picker also changed the selection, expansion, and search of the controller passed to it.
- In
DirectoryTreePaneland the picker, selected rows drew as if the tree had no focus:NodeVisualState.isFocusedstayed false until the focus moved into the view's own focus node. - With the
TreeBuilderdefaults, a new controller opened every folder and selected every file, even in single selection mode. - Keyboard moves did not scroll the focused row into view.
- Documentation that did not match the code: the README's theming example
passed a
folderIconColorthat did not exist, the README advertised Shift-click and Ctrl-click selection that no widget implemented, andselectRangewas documented as adding to the selection while it replaced it.
1.0.0 - 2026-01-02 #
Added #
- Virtualized tree view widget with desktop-friendly keyboard navigation.
TreeControllerfor managing selection, expansion, focus, and active entry state.TreeBuilderutilities to compose trees from arbitrary source roots.- Tri-state folder selection with bulk select/deselect helpers.
- Example application showcasing customization and status reporting.
- Unit tests covering tree building, selection logic, and focus traversal.