편집 가능한 패키지는 Flutter 애플리케이션용으로 매우 사용자 정의가 가능한 스프레드시트 유사 데이터 테이블을 제공합니다. 사용자가 셀을 상호작용 방식으로 편집할 수 있으며, 동적 행 및 열 관리 기능을 지원하고, 광범위한 스타일링 및 이벤트 처리 옵션을 제공합니다. 양식, 데이터 입력 인터페이스 및 실시간 협업 도구에 적합하며, 모바일, 웹, 데스크톱 등 모든 주요 플랫폼에서 작동합니다. 성능과 유연성을 고려하여 설계되었으며, 개발자가 특정 요구 사항에 맞게 UI와 동작을 맞춤화할 수 있도록 합니다.
사용 사례
데이터 입력 양식
실시간 협업 편집
재고 관리 시스템
재무 스프레드시트
인터랙티브 대시보드
주요 기능
셀 수준 편집
사용자 정의 스타일링
동적 행/열 조작
변경에 대한 이벤트 콜백
크로스 플랫폼 지원
내장된 검증 후크
적합한 대상
인터랙티브 데이터 그리드를 구축하는 개발자
실시간 데이터 입력이 필요한 앱
스프레드시트와 유사한 기능이 필요한 프로젝트
다중 플랫폼 앱을 개발하는 팀
UI 중심의 데이터 시각화 도구
고려 사항
대규모 데이터 세트에 대한 성능 최적화가 필요할 수 있습니다
사용자 정의 스타일은 개발 시간을 늘릴 수 있습니다
제한된 내장 형식 옵션
신중한 상태 관리가 필요합니다
정적 읽기 전용 테이블에 적합하지 않음
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Editable
⚡️A highly customizable, editable table package for Flutter projects.
Specs
This package allows you to create editable tables and spreadsheets with ease, either by providing inital row and column count
to display an empty table, or use it with predefined rows and column data sets.
It is compatible with Flutter Desktop (Windows, Linux, MacOS), IOS, Android, and Web. ❤️
Features
Save Edited Rows
Save Edited cell
Customize cell data
Add Empty rows
Create Empty tables
Customizable Save button
Customize Table headers
Zebra - Stripe table
Style table border
Adjustable Column widths
Spread Some :heart:
Support us
You can buy us a cup of coffee. Sponsor our next milestones
Getting started
In the pubspec.yaml of your flutter project, add the following
dependency:
dependencies:...editable:"^1.1.4"
In your library add the following import:
import'package:editable/editable.dart';
API
Create Table
To create a new table, use the Editable() widget class and provide the table data properties as follows:
[widthFactor] a custom size ratio of each column width, if not provided, defaults to [columnRatio = 0.20]
dart 'widthFactor': 0.1 //gives 10% of screen size to the column 'widthFactor': 0.2 //gives 20% of screen size to the column
[key] an identifyer preferably without space and special characters
rows: an array of objects, where each object key represents a column [key],
example:
trHeight: Table Row Height, cannot be less than 40.0 ;
thWeight: Table headers fontweight;
thSize: Table headers fontSize;
tdEditableMaxLines : Max lines allowed in editable text, default: 1 (longer data will not wrap and be hidden), setting to 100 will allow wrapping and not increase row size;
showSaveIcon: Toogles the save button, if [true] displays an icon to save rows,
adds an addition column to the right
saveIcon: Icon for to save row data, example:
dart saveIcon : Icons.add
saveIconColor: Color for the save Icon
saveIconSize: Size for the saveIcon
showCreateButton: displays a button that adds a new row onPressed
stripeColor1: The first row alternate color, if stripe is set to true
stripeColor2: The Second row alternate color, if stripe is set to true;
zebraStripe: Enable zebra-striping, set to false by default
// if zebraStripe is enabled, you can style the colors [stripeColor1] and [stripeColor2]
createButtonAlign: Aligns the button for adding new rows;
createButtonIcon: Icon displayed in the create new row button;
createButtonColor: Color for the create new row button;
createButtonShape: border shape of the create new row button
createButtonShape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8) )
createButtonLabel: Label for the create new row button
EditableTheme
Default styles can be supplied using EditableThemeData. Add the theme to
ThemeData.extensions or wrap a subtree with EditableTheme:
Unset parameters on widgets will fall back to values from the nearest
EditableTheme.
Save methods
onSubmitted: [onSubmitted] callback is triggered when the enter button is tapped (for desktop users)
Or when edit is complete(on mobile) on a table data cell
it returns a value of the edited cell data
onRowSaved: [onRowSaved] callback is triggered when a [saveButton] is pressed.
returns only values if row is edited, otherwise returns a string ['no edit']
EditableState key: To get all Edited Rows outside the current context, you can access the editable state using a GlobalKey,
example:
/// Create a Key for EditableStatefinal _editableKey = GlobalKey<EditableState>();
/// Function to add a new row/// Using the global key assigined to Editable widget/// Access the current state of Editablevoid_addNewRow() {
setState(() {
_editableKey.currentState.createRow();
});
}
///Print only edited rows.void_printEditedRows() {
List editedRows = _editableKey.currentState.editedRows;
print(editedRows);
}
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
appBar: AppBar(
leadingWidth: 200,
leading: FlatButton.icon(
onPressed: () => _addNewRow(),
icon: Icon(Icons.add),
label: Text(
'Add',
style: TextStyle(fontWeight: FontWeight.bold),
)),
title: Text(widget.title),
actions: [
Padding(
padding: constEdgeInsets.all(8.0),
child: FlatButton(
onPressed: () => _printEditedRows(),
child: Text('Print Edited Rows',
style: TextStyle(fontWeight: FontWeight.bold))),
)
],
),
body: Editable(
key: _editableKey, //Assign Key to Widget
columns: cols,
rows: rows,
zebraStripe: true,
stripeColor2: Colors.grey[200],
borderColor: Colors.blueGrey,
),
);
}
Screenshots
Editable Table with Data (zebraStripe)
Empty SpreadSheet (zebraStripe)
Empty SpreadSheet (No Stripe)
Table with Save Icon
:-------------:|
Tutorials
The Following are resources to help you build with Editable:
I highly encourage the community to step forward and improve this
library further. You can fix any reported bug, propose or implement new
features, write tests, etc.
Here is a quick list of things to remember
Check the open issues before creating a new one,
Help me in reducing the number of open issues by fixing any existing
bugs,
Check the roadmap to see if you can help in implementing any new
feature,
You can contribute by writing unit and integration tests for this
library,
If you have any new idea that aligns with the goal of this library,
feel free to raise a feature request and discuss it.
Author
This Editable table package for Flutter is developed by Godwin Asuquo