Flutter용으로 매우 사용자 정의가 가능한 데이터 테이블 패키지로, 테이블 값의 실시간 편집, 삭제, 추가 및 업데이트를 가능하게 합니다. 다양한 플랫폼에서 Flutter 프로젝트에 원활하게 통합될 수 있도록 설계되었으며, 구조화된 데이터를 관리하기 위한 직관적인 인터페이스를 제공합니다. 동적 열과 행 조작을 지원하여 양식, 대시보드 및 데이터 입력 인터페이스에 적합합니다. 유연성과 사용 편의성에 중점을 두어 개발자가 많은 보일러플레이트 코드 없이도 상호작용 가능한 테이블을 만들 수 있도록 합니다.
사용 사례
인터랙티브 데이터 입력 양식
실시간 대시보드 데이터 관리
앱 내 사용자 편집 가능한 스프레드시트
다이나믹 목록 관리
사용자 입력을 통한 데이터 시각화
관리 패널 데이터 테이블
주요 기능
편집 가능한 셀
동적으로 행 추가/삭제
사용자 정의 가능한 열
실시간 업데이트
크로스 플랫폼 지원
간단한 API 통합
적합한 대상
데이터 집약형 앱을 개발하는 개발자
인터랙티브 테이블이 필요한 UI 디자이너
사용자 주도의 데이터 수정을 요구하는 앱
빠른 데이터 인터페이스 프로토타이핑
Android, iOS, Web, macOS, Windows 및 Linux를 대상으로 하는 프로젝트
고려 사항
신중한 상태 관리가 필요합니다
복잡한 레이아웃의 경우 맞춤 스타일링이 필요할 수 있습니다
매우 큰 데이터 세트에서의 성능
제한된 내장 검증
읽기 전용 시나리오에 최적화되지 않음
고급 기능을 위해 외부 종속성에 의존합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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.