flutter_table_layout 0.1.1
flutter_table_layout: ^0.1.1 copied to clipboard
Responsive data table for Flutter with frozen columns, sorting, filtering, grouping, editing, and Excel/PDF export for mobile, web, and desktop.
Changelog #
0.1.1 #
- Fixes and improvements.
0.1.0 #
A full audit and overhaul. The public API is backward compatible: existing code keeps compiling, and the original tests pass unchanged.
Bug fixes #
- Date filter: clearing a date (✕) did nothing because
copyWithcouldn't reset nullable fields.TableStateModel.copyWithnow hasclearStartDate/clearEndDate/clearSort. - Columns menu: toggling a column threw
ProviderNotFoundException(the popup lives outside theBlocProvider), and its checkboxes didn't update. - Web export: nothing was downloaded (the download code was commented out). Rewritten with
package:web. showPagination: false: only the first 10 rows were ever shown.pageSizeswithout 10: the rows-per-page dropdown crashed.- Data updates: changing the
itemslist in place (add / remove followed bysetState) did not refresh the table. TableCubitmutated the caller's column list, and crashed when given aconstlist.- Exports: columns hidden by the user were still exported.
- Word export: values were not HTML-escaped, so
<,&or quotes broke the document. - Excel export: invalid sheet names (
/,:, more than 31 characters) produced corrupted files. Also fixed the fragile default-sheet deletion. - RTL: pagination arrows were flipped twice, and column alignment ignored RTL.
- Sorting: crashed on mixed value types, was case-sensitive, not stable, and placed
nulls inconsistently. - Pagination: the current page was not clamped after filtering or deleting (it showed "No data" while data existed), and an empty table showed "Page 1 of 0".
- Filters: the date pickers were shown even without a
dateProvider. The picker crashed wheninitialDatewas outside 2000–2100. - Row details:
expandedRowBuilderonly opened for selected rows (impossible whenshowSelection: false), andonRowTapwas ignored on mobile. - Footer: the page numbers could overflow on phones when there were many pages.
- Toolbar: it overflowed on narrow screens, and snackbars used a
BuildContextacross async gaps. - Theme: the default theme was always light, even in dark apps. Many colors were hard-coded blue.
- Dynamic form:
- any name containing "is" (
discount,wishlist…) was detected as a boolean; - a required dropdown displayed its first item but submitted
null; - an invalid dropdown initial value crashed;
- the date field ignored
isRequired; - custom validators only ran for text fields;
- the internal mutable map was leaked to callers.
- any name containing "is" (
- Removed dead placeholder code in
FilterItemsUseCase.execute, which now works and sorts. - Fixed every analyzer deprecation (
withOpacity,dart:html,Share.shareXFiles,DropdownButtonFormField.value,Switch.activeColor).
Advanced grid (new) #
- Frozen columns:
pin: ColumnPin.start / end, pin/unpin from the columns menu, LTR and RTL. Implemented with a customRenderPinnedRow. - Sticky header + virtualized rows:
bodyHeight/fillHeight. Only visible rows are built (tested with 100,000 rows). - Column resize (drag the header edge, double-click to reset), drag & drop reorder (long-press), and "Reset columns".
- Per-column filter row (
showColumnFilters) withColumnFilterMatcherexpressions (>10,10..20,=x,!=x,!x, dates,a, b). - Multi-column sort (Shift + click,
setSorts,addSort) with level badges. - Row grouping (
groupByColumnId, collapsible groups,groupHeaderBuilderwithTableGroupInfo), on desktop and mobile. - Inline cell editing (
isEditable,CellEditor.text / number / dropdown / date / boolean,cellValidator,onCellEdited,canEditCell), with Enter / Tab / Escape. - Keyboard navigation: arrows, Enter / F2, Space, Tab, Home / End, Page Up / Down, Ctrl + A, Escape.
- Server-side data:
AdaptiveTableDataSource/TableDataPage, stale-response protection, automatic last-page clamping, and a Retry button on errors. TableStateModelgainedadditionalSorts,columnFilters,groupByColumnId,sorts.TableLoadedgainedcolumnWidths,columnOrder,columnPins,collapsedGroups,isFetching,arrange()andpinOf().- Mobile cards are virtualized too when the table has a bounded height.
- Exports follow the user's column order.
New #
layoutMode(TableLayoutMode.auto/table/cards) to force the grid on phones or cards on desktop.onExportRequested/onPrintRequestedto plug in your own export and print implementations.AdaptiveTableControllerto search, filter, sort, paginate and select from outside.onSelectionChanged,onTableStateChanged,onRowLongPress,rowColorBuilder,toolbarActions,isLoading,showClearFilters,showDateFilter,initialPageSize,initialSortColumnId/initialSortAscending,mobileBreakpoint,mobileTitleColumnId/mobileSubtitleColumnId,searchDebounce,firstDate/lastDate.- Column options:
valueFormatter,isSearchable,isExportable,isHideable.fieldNameis now optional. TableExportOptions: file name, formats, PDF fonts and page format, "export selected rows only", and a customonExporthandler.AdaptiveTableLabelswith English and Arabic built in, chosen from the app locale.AdaptiveTableThemeis now aThemeExtension(copyWith,lerp,AdaptiveTableTheme.of), with anadaptivepreset and newaccentColor,onAccentColor,selectedRowColor,titleTextStyle,toolbarIconColor,summaryBackgroundColorandblurSigma.- Tri-state "select all", numbered pagination, "Showing 11–20 of 48", a search clear button, a "Clear filters" button, and separate "no data" vs "no results" states.
- PDF: cached Cairo font with a timeout, custom fonts, automatic landscape, column widths and alignments.
- Excel: typed date cells, RTL sheets, automatic column widths.
- Desktop exports are saved to the Downloads folder, and the saved path is shown.
TableCubit:sortBy,clearSort,setCustomFilter,resetFilters,resetAll,setSelection,setColumnVisibility,toggleRowExpansion,updateConfiguration,nextPage/previousPage. It emitsTableErrorinstead of crashing.FilterItemsUseCase.applyreturnsTableQueryResult(withtotalPagesandeffectivePage). Supports hidden columns and search-only keys.DynamicFormField:hint,helperText,enabled,maxLines,firstDate/lastDate,copyWith, andinferType/tokenize.detectFromColumnsgainedfieldTypes,excludeIdsandoptionalIds.DynamicFormDialog.showreturns the submitted values.
Behaviour changes #
- An empty, optional number field now submits
nullinstead of0. - Exports use the selected rows when there is a selection (turn this off with
TableExportOptions(exportSelectedWhenAny: false)). saveAndShareFilereturnsFuture<String?>(the saved path or file name).
Project #
- 111 package tests + 6 example smoke tests (previously 7), a CI workflow, stricter lints, a rewritten README with screenshots, and a rebuilt example app with all platforms.
0.0.2 #
- Dynamic Form Generator:
- Implemented
DynamicFormFieldschemas with automatic field type detection (inferred from column properties like name patterns for dates, numbers, booleans, and dropdown lists). - Created
DynamicFormandDynamicFormDialogwith fully-validated inputs, customized actions, and submit callback events.
- Implemented
- Premium Adaptive Themes:
- Added
AdaptiveTableTheme.glassmorphicfeaturing iOS-like real-time backdrop blur filter overlay (BackdropFilter) and translucency. - Added
AdaptiveTableTheme.gradientimplementing styling sweeps across headers and footers. - Added
AdaptiveTableTheme.cozysupporting soft shadows and expanded spacing.
- Added
- CRUD Action Handlers & Settings:
- Integrated interactive styling picker inside the AppBar settings.
- Replaced static action buttons with CRUD dialog triggers utilizing the dynamic forms generator.
- Validation & Testing:
- Added comprehensive unit and widget tests covering type detection, validation logic, and form state submissions.
0.0.1 #
- Initial release of the adaptive data table layout.
- Responsive layouts automatically adapting between desktop data grids and collapsable mobile cards.
- Localized global searching, date-range filtering, and pagination support.
- Multi-currency aggregate bottom banner summary builder.
- Integrated Excel, Word, PDF, and system printing exporters with shaped Arabic font support.