Orientação gerada a partir de informações públicas. Apenas para referência.
Um pacote Flutter que permite visualizações de tabelas interativas com linhas expansíveis, permitindo aos usuários visualizar e editar dados de forma eficiente. Ele suporta expansão dinâmica de linhas para informações detalhadas, sendo ideal para exibir conjuntos de dados hierárquicos ou complexos. O pacote é compatível com todas as principais plataformas, incluindo mobile, web e desktop. Oferece uma interface limpa e personalizável para gerenciar grandes tabelas com conteúdo aninhado.
Casos de uso
Exibindo dados hierárquicos
Editar entradas de tabela inline
Mostrando informações detalhadas da linha
Gerenciando grandes conjuntos de dados em uma visualização compacta
Criando grids de dados responsivos
Principais recursos
Linhas expansíveis com conteúdo personalizado
Suporte de edição embutido
Compatibilidade multiplataforma
Estilo personalizável
Layout responsivo para diferentes tamanhos de tela
Indicado para
Aplicações intensivas em dados
Painéis de administração
Ferramentas de relatórios
sistemas de gestão de estoque
Tabelas de dados voltadas para o usuário
Considerações
Pode afetar o desempenho com conjuntos de dados muito grandes
Requer gerenciamento cuidadoso do estado para edições
Classificação/filtragem interna limitada
Mais adequado para contagens moderadas de linhas
Requer manipulação manual de interações complexas
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Expandable DataTable
A Flutter package for displaying and editing tabular data with expandable rows. Overflow columns collapse into a tappable expansion panel, keeping the table clean on any screen size.
What it does
expandable_datatable renders a data table where you control how many columns are visible. Columns that exceed visibleColumnCount are hidden from the row and instead displayed inside a collapsible expansion panel. This lets you show a clean, narrow table on phones while surfacing all data on demand - without writing custom layout code.
When should I use it?
Use ExpandableDataTable whenever you need a data table that:
has more columns than fit on the current screen, and
you want the extra columns to be accessible without horizontal scrolling.
Features
Expandable rows - hidden columns fold into a tappable expansion panel per row
Responsive column count - drive visibleColumnCount from LayoutBuilder to adapt automatically to screen width
Column sorting - tap any header to toggle ascending / descending sort
Pagination - built-in page controls, fully replaceable with a custom widget
Editable rows - built-in edit dialog pre-filled from cell values; or supply your own via renderEditDialog
Extensible cell types - plug in CellType<T> adapters (ImageCellType, custom DateTime, etc.) to encapsulate rendering, sorting, and editing
Custom cell rendering - override the default cell widget for any column via cellBuilder on ExpandableColumn
Per-column edit guard - mark individual ExpandableColumns as isEditable: false to make them read-only inside the dialog
Custom expansion content - replace the default expansion panel body via renderExpansionContent
Multiple or single row expansion - control via multipleExpansion
Comprehensive theming - colors, text styles, borders, shapes, icons, animation and more via ExpandableTheme / ExpandableThemeData
Screenshots
Sorting
Expansion
Editing
Styling
Getting started
Add expandable_datatable as a dependency in your pubspec.yaml file. See the pub.dev install tab for details.
Quick example
Below is a minimal working snippet. See example/lib/main.dart for a complete runnable app.
Tip:ExpandableColumn is generic — pass the Dart type of the data (int, String, etc.) so the library can handle sorting and editing correctly.
Core API
TL;DR - use ExpandableDataTable(...) as your main table widget; see the quick example above for setup and theming.
What is ExpandableDataTable?
ExpandableDataTable is the main widget of this library. It renders the full table UI including the header row, data rows, expansion panels, sort indicators, pagination, and (optionally) the edit dialog. Everything else in the library - ExpandableColumn, ExpandableRow, ExpandableCell, ExpandableTheme - exists to configure and feed data into this widget.
Key properties of ExpandableDataTable
Property
Description
headers(required)
Column definitions (title, flex, editability). Must align with the row cell list.
rows(required)
The data. Each ExpandableRow holds one ExpandableCell per header.
visibleColumnCount(required)
Number of columns shown in the row; the rest go into the expansion panel.
pageSize
Number of rows per page. Defaults to 10.
expansionIconAffinity
Where the expansion icon appears (leading or trailing). Defaults to trailing.
multipleExpansion
Whether multiple rows can be expanded at the same time.
isEditable
Flag indicating whether rows are editable. Requires onRowChanged.
onRowChanged
Called when a row is edited; originalIndex is the row's index in your rows list.
onPageChanged
Called when the current page changes.
editDialogTitle
Title text of the built-in edit dialog. Defaults to 'Edit Details'.
editSaveLabel
Label of the save button in the built-in edit dialog. Defaults to 'SAVE'.
editCancelLabel
Label of the cancel button in the built-in edit dialog. Defaults to 'CANCEL'.
nullValuePlaceholder
Text shown when a cell's value is null. Defaults to an empty string.
renderEditDialog
Replaces the built-in edit dialog. Use onSuccess(newRow) to commit.
renderCustomPagination
Replaces the built-in pagination widget.
renderExpansionContent
Replaces the default expansion panel content for each row.
Theming with ExpandableTheme
Wrap ExpandableDataTable with ExpandableTheme anywhere in the tree above the table. The table reads it automatically via ExpandableTheme.of(context). If no ExpandableTheme is present, sensible defaults from ExpandableThemeData() are used.
By default each cell renders its value as Text(value.toString()) — except ImageProvider columns, which render an Image widget. To take full control of how a column's cells look, set cellBuilder on the ExpandableColumn:
cellBuilder receives (BuildContext context, dynamic value) and must return a Widget. It applies everywhere the column appears — both in the visible row and in the expansion panel.
Tip: When a column has a cellBuilder, the default rendering (plain text or image) is completely bypassed. You are responsible for handling null values if your data can contain them.
Extensible cell types (CellType<T>)
Instead of writing one-off callbacks or handling branching across multiple files, you can provide a CellType<T> adapter to ExpandableColumn to encapsulate rendering, sorting, editing, and string formatting in one reusable object.
Built-in ImageCellType
Declaratively configure image height, fit, alignment, and border radius without writing a custom builder:
When rendering cells in both the visible row and expansion panel, the table evaluates:
ExpandableColumn.cellBuilder(highest priority)
ExpandableColumn.cellType
Built-in type inference (fallback)
Editing
Set isEditable: true to show an edit icon on every row. The built-in dialog pre-fills each field from the current cell values. You must provide onRowChanged when editing is enabled:
Contributions are welcome! Please open a pull request on GitHub. A CONTRIBUTING.md with branch naming and testing guidelines does not yet exist — feel free to propose one.