패키지, 저장소 및 앱 카테고리 검색

패키지 상세v1.0.4

flutter_laravel_form_validation

간단한 Dart 확장 기반의 Flutter 폼 검증. Laravel 검증에 영감을 받음.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
224
좋아요
24
Pub 점수
160

패키지 설치

flutter pub add flutter_laravel_form_validation

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Laravel의 검증 규칙에 영감을 받아 문법을 사용하여 폼 검증을 단순화하는 플러터 패키지입니다. Dart에서 검증 제약 조건을 깔끔하고 표현력 있게 직접 정의할 수 있어 여러 플랫폼에서 사용자 입력을 검증하기가 더 쉬워집니다. 확장 기능은 플러터 위젯과 원활하게 통합되며, 사용자 정의 오류 메시지, 규칙 체이닝 및 실시간 피드백을 지원합니다. Laravel의 검증 시스템에 익숙한 개발자 또는 폼 검증에 더 직관적인 접근 방식을 원하는 개발자에게 이상적입니다.

사용 사례

  • 사용자 등록 폼 검증
  • 실시간 입력 검증 구현
  • 재사용 가능한 검증 규칙 만들기
  • 복잡한 폼 로직 처리
  • 오류 메시지 간소화
  • 기존 Flutter 양식과의 통합

주요 기능

  • Laravel를 영감으로 한 검증 구문
  • 체인 가능한 검증 규칙
  • 사용자 정의 가능한 오류 메시지
  • 다중 플랫폼 지원
  • Flutter 위젯과의 간편한 통합
  • 실시간 검증 피드백

적합한 대상

  • Laravel에 익숙한 Flutter 개발자
  • 일관된 검증 패턴을 추구하는 팀
  • 강력한 폼 검증이 필요한 프로젝트
  • 간결한 검증 코드를 원하는 개발자
  • 복잡한 폼 요구사항을 가진 앱

고려 사항

  • Laravel 검증 개념에 대한 이해가 필요합니다
  • 기본 예제 외에 문서가 제한적
  • 고급 사용 사례를 위해 추가 설정이 필요할 수 있습니다
  • 폼 검증이 아닌 시나리오에는 적합하지 않습니다
  • 상태 관리 솔루션과 함께 사용하는 것이 가장 좋습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Flutter Laravel Form Validation

A simplified dart extension based flutter form validation . Inspired by Laravel Validation.

🎖 Installing

dependencies:
  flutter_laravel_form_validation : ^1.0.4
⚡️ Import
import 'package:flutter_laravel_form_validation/flutter_laravel_form_validation.dart';

🎮 How To Use

Validation rules in a list, short form without label or custom messages

    TextFormField(
        validator : ['required','max:10','uppercase'].v,
    ),

Validation rules in a list using the FLValidator class, short form without label or custom messages

    TextFormField(
        validator : [FLValidator.required,FLValidator.max(10),FLValidator.uppercase].v,
    ),

Custom validation in a list

    TextFormField(
        validator : [FLValidator.required,customValidation].v,
    ),

    String? customValidation(String? value) {
    if (value == "flutterdev") {
        return "Value cannot be flutterdev";
    }
    return null;
    }

Validation rules in a string, short form without label or custom messages

    TextFormField(
        validator : "required|max:10|uppercase".v,
    ),

Validation rules in a list with label or custom messages

 TextFormField(
        validator : ['required','max:10','uppercase',].validate(attribute: 'Username',
        customMessages: {
            'required': "You must input your username",
            'max': "The length must be 10",
             'uppercase': "Only uppercase is allowed"
            },
    ),

Validation rules in a list with label or custom messages

 TextFormField(
        validator : "required|max:10|uppercase".validate(attribute: 'Username',
        customMessages: {
            'required': "You must input your username",
            'max': "The length must be 10",
             'uppercase': "Only uppercase is allowed"
            },
    ),

Rules

Class property String Description Example
FLValidator.required required For making sure a form field value is required ['required'] or 'required' or [FLValidator.required]
FLValidator.numeric numeric For making sure a form field value is numeric ['numeric'] or 'numeric' or [FLValidator.numeric]
FLValidator.integer interger For making sure a form field value is an interger ['interger'] or 'interger' or [FLValidator.interger]
FLValidator.double double For making sure a form field value is a double ['double'] or 'double' or [FLValidator.double]
FLValidator.between(min,max) between(min,max) For making sure a form field value is between the of min and max ['between:2,8'] or 'between(2,8)' or [FLValidator.between(2,8)]
FLValidator.max(length) max:length For making sure a form field value length is limited to the max length ['max:5'] or 'max:5' or [FLValidator.max(5)
FLValidator.min(length) min:length For making sure a form field value length is limited to the min length ['min:5'] or 'min:5' or [FLValidator.min(5)]
FLValidator.gt(number) gt:number For making sure a form field value is greater than the number specified ['gt:10'] or 'gt:10' or [FLValidator.gt(10)]
FLValidator.lt(number) lt:number For making sure a form field value is less than the number specified ['lt:10'] or 'lt:10' or [FLValidator.lt(10)]
FLValidator.gte(number) gte:number For making sure a form field value is greater than or equal to the number specified ['gte:10'] or 'gte:10' or [FLValidator.gte(10)]
FLValidator.lte(number) lte:number For making sure a form field value is less than or equal to the number specified ['lte:10'] or 'lte:10' or [FLValidator.lte(10)]
FLValidator.uppercase uppercase For making sure a form field value is uppercase ['uppercase'] or 'uppercase' or [FLValidator.uppercase]
FLValidator.lowercase lowercase For making sure a form field value is lowercase ['lowercase'] or 'lowercase' or [FLValidator.lowercase]
FLValidator.startsWith(value) starts_with:value For making sure a form field value starts with the specified value ['starts_with:man'] or 'starts_with:man' or [FLValidator.startsWith(man)]
FLValidator.endsWith(value) ends_with:value For making sure a form field value ends with the specified value ['ends_with:man'] or 'ends_with:man' or [FLValidator.endsWith(man)]
FLValidator.same(other) same:other For making sure a form field value is same as other ['same:other'] or 'same:other' or [FLValidator.same(other)]
FLValidator.alphaNum alpha_num For making sure a form field value is alpha numeric ['alpha_num'] or 'alpha_num' or [FLValidator.alphaNum]
FLValidator.inItems(List items) in: For making sure a form field value exist in a list ['in:he,she,it'] or 'in:he,she,it' or [FLValidator.inItems([he,she,it])]
FLValidator.notInItems(List items) not_in: For making sure a form field value does exist in a list ['not_in:he,she,it'] or 'not_in:he,she,it' or [FLValidator.notInItems([he,she,it])]
FLValidator.regEx(pattern) regex:pattern For making sure a form field value match the specified regular expression pattern ['regex:pattern'] or 'regex:pattern' or [FLValidator.regEx(pattern)]
FLValidator.email email For making sure a form field value is an email ['email'] or 'email' or [FLValidator.email]
FLValidator.ip ip For making sure a form field value is an ip address ['ip'].v or 'ip'.v or [FLValidator.ip].v
FLValidator.url url For making sure a form field value is a url ['url'].v or 'url'.v or [FLValidator.url].v

Also, localization is a work in progress

🐛 Bugs/Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on Github and I'll look into it. Pull request are also welcome.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.