bcell 1.1.0
bcell: ^1.1.0 copied to clipboard
A Flutter data-grid widget with a pluto_grid-shaped API and spreadsheet features: a formula engine, multi-sheet workbooks, charts, pivot tables, and CSV/XLSX/PDF import-export.
1.1.0 #
Feature release: charts, pivot tables, workbook security, and styling options on top of 1.0.0 — all additive, no breaking API changes.
- Charts —
BCellChartcompanion widget (line / bar / pie viafl_chart) that plots the grid's filtered rows through evaluated formula values and redraws live on edits, sorts, and filters. - Pivot tables —
bcell_pivot.dartaggregation plugin with atoGrid()helper that renders the pivot result as a regularBCellGrid. - Shared workbook —
bcell_workbook_share.dartcollaboration plumbing. - Workbook file encryption —
toEncryptedBytes/decryptWorkbook/loadEncryptedBytes(AES-256-GCM, PBKDF2-HMAC-SHA256 with hardened iteration bounds). Wrong passwords and tampered files fail withBCellDecryptException, never garbage data. - Version history —
saveVersion/versions/restoreVersion/removeVersionsnapshots on the workbook (in-memory, JSON-based). - Sheet-protection password — SHA-256 hashed, persisted in workbook JSON.
- Number-format codes now persist through the workbook JSON round-trip.
- Styling —
BCellGridStyleConfiggains cell padding, header sort-icon, and fill-handle (fillHandleSize/fillHandleColor/fillHandleBorderColor) options, all theme-resolved like the existing style fields. - Docs — live Widgetbook demo linked from the README; pluto_grid LICENSE attribution added.
- Performance — profile-mode scroll baselines re-verified on the expanded feature set (all three render paths stay well under the 8 ms frame-build budget); layout regression guard added for auto-size, frozen, colspan, rowspan, and hidden-column sizing.
- Dependency:
pointycastle^4.0.0.
1.0.0 #
First stable release. BCell grows from the minimal 0.0.1 data grid into a
spreadsheet-capable widget: a formula engine, a multi-sheet workbook, a full
import/export surface, and a large set of Excel-style cell, column, and
selection features — all still built on the flat BCellGridStateManager and
virtualized rendering, guarded by a 10k-row performance regression test.
Column types & formatting #
- Date columns —
BCellColumnType.date({format})hold aDateTime, displayyyyy-MM-dd(or a custom formatter), edit via a native date picker, and coerce ISO strings / Excel date serials on import and paste. - Number format codes —
BCellColumnType.number(format: '#,##0.00' | '0%' | '$#,##0.00' | '000')apply display grouping/decimals/percent/prefix while cells stay raw numbers, so sort and export are unaffected. - Custom cell renderer —
BCellColumn(renderer:)draws any widget in place of the default cell text. - Conditional formatting —
BCellColumn(cellStyle:)colors a cell by its value, plusBCellConditionalFormat.colorScale/dataBar/iconSet(...)renderers for color scales, data bars, and threshold icon sets. - Rich text — a cell can hold a
BCellRichText([BCellTextRun(...)])with bold/italic/underline/color runs (viaBCellRichText.column().toRenderer()); exports flatten to plain text automatically. - Hyperlink cells —
BCellHyperlink.column(onTap:).toRenderer()renders styled, tappable, accessible link text (no launcher dependency). - Cell notes —
setNote/noteFor/hasNote/clearNotes. - Merge cells —
BCellValue(colspan:, rowspan:)(display-only; colspan stays on the virtualized path, rowspan switches to a non-virtualized body). - Banded rows —
BCellGridStyleConfig(oddRowColor:)zebra striping. - More style knobs —
BCellGridStyleConfiggainsdefaultColumnTitlePadding,defaultCellPadding,iconSize,iconColor(pluto_grid names), andfillHandleSize/fillHandleColor/fillHandleBorderColorfor the drag-fill handle; defaults are unchanged (the handle outline now theme-resolves tocolorScheme.surfaceinstead of hardcoded white). - Per-row height —
BCellRow(height:)with virtualization preserved.
Columns & selection #
- Freeze columns —
BCellColumn(frozen: BCellColumnFrozen.start | .end)pins a column left/right with synced vertical scroll across sections. - Column reorder —
moveColumn(from, to)plus header drag-to-reorder and accessible "Move left/right" actions. - Range/multi selection — anchor+focus range with Shift+click/arrow,
extendSelectionTo/isInRange/selectedCells/rangeAsTsv, range copy / clear / fill, and a drag-fill handle. - Fill —
fillDown(Ctrl+D),fillRight(Ctrl+R),fillSeriesDown()(series/ auto fill),flashFillDown()(flash fill by inferred transform). - Checkbox row selection —
setRowChecked/toggleRowChecked/setAllRowsChecked/checkedRows/isAllChecked/isAnyChecked. - Clipboard —
copySelectionToClipboard/cutSelectionToClipboard/pasteFromClipboard(TSV block paste, anchored and clipped). - Data validation —
BCellColumn(validator:)enforced centrally inchangeCellValue(also guards paste/fill), with anonInvalidcallback. - Undo/redo (
undo/redo/canUndo/canRedo), find (find('q')), and go-to (goToCell/goToRow). - Read-only mode —
BCellGrid(mode: BCellGridMode.readOnly)/setGridMode(...)blocks every edit and structural row change.
Formula engine #
=formulas evaluate on display, sort, and export, with error results (#DIV/0!/#NAME?/#CIRC!/#NUM!/#REF!/#VALUE!/#N/A) and a cycle guard; results memoized per notification. Formula cells never leak a live=...into CSV.- A1 refs and
A1:B2ranges; arithmetic, comparison,&concat, string literals. - Function library: Math/Trig, Statistical, Financial (PMT/FV/PV/NPV/IRR), Lookup (VLOOKUP/HLOOKUP/INDEX/MATCH), Date & Time, Information, Logical, and Text categories.
- Named ranges —
defineName/removeName/clearNames/namedRange/definedNames. - Structured references —
enableStructuredRefs()for[Column]and decorativeTable[Column]whole-column refs, live over displayed rows.
Import / export #
- Exports — CSV, TSV, HTML, XML, Markdown, JSON, PDF (
toPdf, dep:pdf;selectionOnlyprint area), and XLSX (toXlsx, dep:excel). Markup exports escape every cell value and title. - Imports —
importTsv/importCsv(RFC 4180)/importHtml/importMarkdown/importJson/importXlsx, mapping onto visible columns and coercing to each column type.
Workbook & infrastructure #
- Multi-sheet workbook —
BCellWorkbook(orderedBCellSheets + active sheet) withadd/remove/rename/select/move, per-sheet tab color, protect, and hidden flags;BCellSheetTabBar(tab strip with drag-to-reorder and accessible move actions) andBCellWorkbookView. - Sheet-protection password — optional
password:onBCellWorkbook.setProtected; unprotecting a password-protected sheet requires the matching password. Only a SHA-256 hash is stored and persisted in the workbook JSON, never the plaintext. - Workbook persistence —
BCellWorkbook.toJson()/BCellWorkbook.fromJson()round-trip sheets, flags, column definitions (incl. number-format codes), and row data;loadJson()loads a map into an existing workbook in place. - Version history —
saveVersion()/versions/restoreVersion()/removeVersion()/clearVersions(): in-memory named, timestamped workbook snapshots built on the JSON persistence, restorable in place. - Encrypted workbook file —
toEncryptedBytes(password)seals the workbook JSON into an authenticated AES-256-GCM blob (PBKDF2-HMAC-SHA256 key derivation, random per-file salt and nonce);decryptWorkbook()/loadEncryptedBytes()open it, throwingBCellDecryptExceptionon a wrong password or tampered bytes. Backed bypointycastle. - Shared-workbook merge —
mergeChanges(base:, theirs:)folds another copy's edits into the workbook via a three-way, cell-level merge overtoJson()snapshots; cells both copies changed differently keep the local value and are reported asBCellMergeConflicts.BCellWorkbookViewnow rebuilds its grid after any in-place load (loadJson/restoreVersion/loadEncryptedBytes/mergeChanges), fixing stale rows when the active index was unchanged. - Event bus —
BCellGridEventManager(addEvent/listener/stream) on a broadcast stream, allocated lazily. - Font scope —
BCellFontController+BCellFontScope(InheritedNotifier) re-font every BCell widget under one controller live. - Charts —
BCellChart(stateManager, type: BCellChartType.line/.bar/.pie, categoryField:, valueFields:), a companion widget that plots the grid's filtered rows (formula-evaluated) and re-draws live. Backed byfl_chart. - Pivot tables —
stateManager.pivot(rowField:, columnField:, valueField:, aggregate: BCellPivotAgg.sum/count/average/min/max)aggregates the filtered rows into a rows × columns matrix (value/rowTotal/columnTotal/grandTotal); totals re-aggregate the raw numbers.toGrid()renders the result intoBCellGridcolumns+rows. Single row/column field.
0.0.1 #
Initial release — a minimal data grid with a pluto_grid-shaped API.
BCellGridwidget:columns,rows,onLoaded,onChanged,onSelected,onSorted,configuration.- Models:
BCellColumn(width,minWidth,readOnly,suppressedAutoSize),BCellColumnType.text()/.number(),BCellRow,BCellValue. BCellGridStateManager(ChangeNotifier): cell editing (changeCellValue), selection (setCurrentCell/setEditingon a dedicatedselectionValueNotifier,currentRow/currentRowIdx), sort cycle (toggleSortColumn, type-aware, restores insertion order), column resize (normal/pushAndPull/none), row ops (insertRows/prependRows/appendRows/removeRows/removeCurrentRow), column hiding (hideColumn/visibleColumns), row filtering (setFilter,sourceRows), paging (setPageSize/setPage/totalPage), keyboard navigation core (moveCurrentCellwithBCellMoveDirection).- Keyboard support in
BCellGrid: arrows/Tab move the selection, Enter/F2 edits, Escape cancels an edit without committing. BCellPaginationplugin widget: ready-made pager driven by the state manager (same shape as pluto_grid'sPlutoPagination).- Inline tap-to-edit cells; number columns validate input.
- Responsive column auto-sizing:
BCellAutoSizeMode.equal/.scale, per-column opt-out. - CSV export (
toCsv) with RFC 4180 quoting and opt-in formula-injection sanitizing. - Material 3 theme-aware styling; all colors/text styles overridable via
BCellGridStyleConfig. - Performance: virtualized rows, cached list views, cell position lookup via back-references, selection changes rebuild only cells; guarded by a 10k-row regression test.