Flutter용 json_to_form 패키지는 개발자가 JSON 구성에서 동적으로 폼을 생성할 수 있도록 합니다. 텍스트 입력, 드롭다운, 체크박스와 같은 폼 필드에 JSON 구조를 매핑함으로써 인터랙티브한 UI 생성을 단순화합니다. 이 플러그인은 UI 컴포넌트를 하드코딩하지 않고도 유연하고 데이터 기반의 폼이 필요한 애플리케이션에 이상적입니다. Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 장치 간 일관된 동작을 보장합니다. 폼 로직을 UI 구현과 분리함으로써 개발 속도와 유지보수성을 향상시킵니다.
사용 사례
JSON에서 동적 폼 생성
사용자 입력 인터페이스 구성 가능
원격 폼 구성 업데이트
다중 플랫폼 양식 일관성
입력 화면의 빠른 프로토타이핑
주요 기능
JSON 기반 폼 생성
다양한 입력 유형에 대한 지원
플랫폼 독립적 설계
기존 Flutter 앱과의 간편한 통합
런타임 폼 사용자 정의
적합한 대상
데이터 기반 앱을 개발하는 개발자
유연한 폼 레이아웃이 필요한 팀
원격 폼 관리 기능을 갖춘 애플리케이션
프로토타이핑 및 MVP 개발
다중 플랫폼 폼 지원이 필요한 앱
고려 사항
유효한 JSON 스키마 정의가 필요합니다
제한된 내장 검증 규칙
사용자 정의 스타일링에는 추가 설정이 필요할 수 있습니다
정확한 JSON 구조에 의존합니다
복잡한 양식을 위해 추가 상태 관리가 필요할 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Convert Json to Form for Flutter apps.
:fire: Star and Share :fire: the repo to support the project. Thanks!
All fields has attribute labelHidden(default false)
Important add key for all field for validation required
TextInput or Input
1.- Types?
Input
Password
Email (has default validation)
TextArea
TextInput
// Example for json string// to start with a default value you can add the value attributeString formString = json.encode({
'fields': [
{
'key': 'inputKey',
'type': 'Input',
'label': 'Hi Group',
'placeholder': "Hi Group flutter",
'required': true
},
{
'key': 'inputKey',
'type': 'Input',
'label': 'Initial Value',
'value': 'Hello''required': true
},
]
});
// Example for json Map// in Map has Attributes validation and decoration//important to receive 2 parameters in function of ValidationStringvalidationExample(field, value) {
if (value.isEmpty) {
return'Please enter some text';
}
returnnull;
}
Map formMap = {
'fields': [
{
'key': 'inputKey',
'type': 'Input',
'label': 'Hi Group',
'placeholder': "Hi Group flutter",
'validator': 'digitsOnly',
'required': true,
'decoration': InputDecoration(
prefixIcon: Icon(Icons.account_box),
border: OutlineInputBorder(),
),
'validation':validationExample,
'keyboardType':TextInputType.number
},
]
};
1.- How can I place validations for my form String?
Excellent :D.
In JsonSchema has attributes (validations, decorations)
Important that each field has to has its unique key