Orientação gerada a partir de informações públicas. Apenas para referência.
Um pacote de tabela de dados altamente personalizável para Flutter que permite edição em tempo real, exclusão, adição e atualização de valores da tabela. Projetado para integração perfeita em projetos Flutter em múltiplas plataformas, oferece uma interface intuitiva para gerenciar dados estruturados. O pacote suporta manipulação dinâmica de colunas e linhas, tornando-o ideal para formulários, painéis e interfaces de entrada de dados. Com foco em flexibilidade e facilidade de uso, empodera desenvolvedores a criar tabelas interativas sem código boilerplate extenso.
Casos de uso
Formulários interativos de entrada de dados
Gerenciamento de dados do painel em tempo real
Planilhas editáveis pelo usuário em aplicativos
Gerenciamento de lista dinâmica
Visualização de dados com entrada do usuário
tabelas de dados do painel de administração
Principais recursos
Células editáveis
Adicionar/remover linhas dinamicamente
Colunas personalizáveis
Atualizações em tempo real
Suporte multiplataforma
Integração simples da API
Indicado para
Desenvolvedores construindo aplicativos com dados intensivos
Designers de interface precisando de tabelas interativas
Aplicativos que exigem modificação de dados conduzida pelo usuário
Prototipagem de interfaces de dados rápidas
Projetos direcionados para Android, iOS, Web, macOS, Windows e Linux
Considerações
Requer gerenciamento cuidadoso de estado
Pode ser necessário estilização personalizada para layouts complexos
Desempenho com conjuntos de dados muito grandes
Validação interna limitada
Não otimizado para cenários somente leitura
Depende de dependências externas para recursos avançados
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
Dynamic_Table
A fully customizable data table for your flutter project in which you can edit, delete, add and update values in the table.
Invoked when the user selects or unselects every row, using the
checkbox in the heading row.
void Function(int)? onPageChanged
Invoked when the user switches to another page.
The value is the index of the first row on the currently displayed page.
void Function(int?)? onRowsPerPageChanged
Invoked when the user selects a different number of rows per page.
If this is null, then the value given by [rowsPerPage] will be used
and no affordance will be provided to change the value.
bool Function(int, List<dynamic>)? onRowEdit
Called when the user clicks on the edit icon of a row.
Return true to allow the edit action, false to prevent it.
If the action is allowed, the row will be editable.
boolonRowEdit(int index, List<dynamic> row){
//Do some validation on row and return false if validation failsif (index%2==1) {
ScaffoldMessenger.of(context).showSnackBar(
constSnackBar(
content: Text("Cannot edit odd rows"),
),
);
returnfalse; // The row will not open in editable mode
}
returntrue; // The row will open in editable mode
}
bool Function(int, List<dynamic>)? onRowDelete
Called when the user clicks on the delete icon of a row.
Return true to allow the delete action, false to prevent it.
If the delete action is allowed, the row will be deleted from the table.
boolonRowDelete(int index, List<dynamic> row){
//Do some validation on row and return false if validation failsif (row[0] == null) {
ScaffoldMessenger.of(context).showSnackBar(
constSnackBar(
content: Text("Name cannot be null"),
),
);
returnfalse;
}
returntrue;
}
Called when the user clicks on the save icon of a row.
Return List<dynamic> newValue to allow the save action, null to prevent it.
The newValue must be a list of the same length as the column.
If the save action is allowed, the row will be saved to the table.
The oldValue is the value of the row before the edit.
The newValue is the value of the row after the edit.
List<dynamic>? onRowSave(int index, List<dynamic> oldValue, List<dynamic> newValue) {
//Do some validation on new value and return null if validation failsif (newValue[0] == null) {
ScaffoldMessenger.of(context).showSnackBar(
constSnackBar(
content: Text("Name cannot be null"),
),
);
returnnull;
}
// Do some modification to `newValue` and return `newValue`
newValue[0] = newValue[0].toString().toUpperCase(); // Convert name to uppercase// Save new data to you list
myData[index] = newValue;
return newValue;
}
Available Methods
First create a GlobalKey of DynamicTableState.
Pass the key to DynmaicTable constructor.
final tableKey = GlobalKey<DynamicTableState>();
DynamicTable(key:tableKey);
addRow()
tableKey.currentState?.addRow();
Add new empty row at the 0th position in the table. The showActions parameter must be true because the row will be added in editing mode and to save the row we need actions.