flutter_kbar 0.1.0
flutter_kbar: ^0.1.0 copied to clipboard
A composable, keyboard-first command palette for Flutter desktop and web, with nested actions, fuzzy search and multi-key shortcuts. A port of kbar.
Changelog #
0.1.0 #
Initial release — a port of the React kbar package for Flutter desktop and web.
Added #
KBarProvider,KBarPortal,KBarPositioner,KBarAnimator,KBarSearchFieldandKBarResults— headless primitives mirroring kbar's component set.KBarPalette— a ready-to-use palette assembled from those primitives, themed throughKBarThemeData(aThemeExtension) and overridable row by row.- Nested actions via
KBarAction.parent, with descend-on-select, Backspace-to-parent, and ancestor breadcrumbs on flattened search results. - Fuzzy matching with section grouping and priority ordering.
KBarFuseMatcher(default) reproduces kbar's fuse.js ranking and is validated against a fixture captured from real fuse.js;KBarCommandScoreMatcherports cmdk'scommand-scorefor short command names. Both report matched character ranges, whichKBarHighlightedTextrenders. - Global keyboard handling: a configurable toggle binding, arrow/
Ctrl+N/Ctrl+Pnavigation that skips section headings, Enter, Escape, and per-action shortcuts including multi-key sequences. - Opt-in undo/redo via
KBarOptions.enableHistoryandKBarActionContext.undoWith. - Focus is returned to whatever held it before opening, unless something else claimed focus while the palette was closing — so an action that opens a dialog keeps it.
KBarSelectorfor slice-based rebuilds,KBarMatchesBuilderfor results, andKBarRegisterActions/KBarActionsMixinfor scoped action registration.
Notes #
- Zero runtime dependencies beyond
collection, which Flutter already pins. Wasm-ready. - Differs from kbar deliberately in a few places — undo registration, live options, a genuinely two-way search field, and a list of toggle bindings. See the README.