Coder Social home page Coder Social logo

wahello / dynamicformflutter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liodali/dynamicformflutter

0.0 1.0 0.0 231 KB

Flutter widget to build forms with easier way

Home Page: https://pub.dev/packages/dynamic_form

License: MIT License

Java 0.80% Swift 0.75% Objective-C 0.07% Dart 98.37%

dynamicformflutter's Introduction

dynamicform

pub GitHub

create your form with easier way

Getting Started

  • generate form
  • Pre-existing elements

Installing

Add the following to your pubspec.yaml file:

dependencies:
	dynamic_form: ^0.3.7+3

Simple Usage

Creating a basic SimpleDynamicForm

SimpleDynamicForm(
      key: dynamicFormKey,
      groupElements: [
              GroupElement(
                            directionGroup: DirectionGroup.Vertical,
                            textElements: [
                            TextElement(label: "name"),
                            TextElement(
                                 label: "password", typeInput: TypeInput.Password)
                              ],
                             )
                  ],
              );

Declare GlobalKey to get validation,list values of forms

GlobalKey<SimpleDynamicFormState> dynamicFormKey = GlobalKey<SimpleDynamicFormState>();

validate forms

dynamicFormKey.currentState.validate()

all values in form

dynamicFormKey.currentState.recuperateAllValues()

LoginForm

pre-existing login form to make easy for you to build

Simple Usage

Creating a basic LoginForm

LoginForm(
      callback: (email,password){
            //api call
      },
      backgroundColorButton: Colors.amber,
      onlyEmail: false,
      widthSubmitButton: 200,
      labelLogin: "Username",
      password: "Password",
      textButton: Text("Log IN"),
      radiusBorderButton: 10,
      decorationElement: RoundedDecorationElement(
        filledColor: Colors.grey[300],
      ),
    )

Properties in LoginForm

Properties Description
decorationElement input decoration of fields of form
directionGroup Direction of form (Vertical/Horizontal)
paddingFields padding between fields
onlyEmail enable only email type fieldtext
labelLogin label of username/email textField
password label of the passwordField
callback callback to make your api call when you form is validate
textButton Text widget of the submit button
radiusBorderButton radius corner of the submit button
backgroundColorButton background color of the submit button
widthSubmitButton width size of the submit button
passwordError messages errors to show when password field not validate
usernameEmailError messages errors to show when email/username not validate

How to skectch your form ?

textElement is small element in dynamicForm GroupElement is group of TextElement

GroupElement

Properties Description
directionGroup Direction of form (Vertical/Horizontal)
sizeElements size of each textElement of form When direction Horizontal,sum of values should be egal a 1
textElements group of textElement.
padding padding of groups.
decoration decoration of container groups.
backgroundColor color of the container groups.

textElement

Properties Description
typeInput Enumerate to specifie type of TextField.
label text label of TextField.
DecorationElement input decoration of TextField.
onTap callback when you click on TextField .
hint text hint of textField.
errorMsg message to show when TextField isn't validate.
labelStyle style of label TextField
errorStyle style of error message TextField
hintStyle style of hint TextFieldcolor
readOnly enable TextField uneditable
validator callback validation of TextField
padding padding of TextField

EmailElement

Pre-exsiting element

check validation of email

Pre-initialized values

extends from TextElement

Properties Description
label text label of TextField.
hint text hint of textField.
isRequired make textField required in validation
errorEmailIsRequired error message for textField when it's required
errorEmailPattern error message for textField input when it's not email in validation
labelStyle style of label TextField
errorStyle style of error message TextField
hintStyle style of hint TextFieldcolor
readOnly enable TextField uneditable
padding padding of TextField

PasswordElement

Pre-exsiting element

check validation of password

Pre-initialized values

show/hide password

extends from TextElement

Properties Description
label text label of TextField.
hint text hint of textField.
errorMsg message to show when TextField isn't validate.
labelStyle style of label TextField
errorStyle style of error message TextField
hintStyle style of hint TextFieldcolor
readOnly enable TextField uneditable
padding padding of TextField
enableShowPassword enable eye icon,make password text visible
isRequired make passwordField required
minLength minimun length accepted by password
hasUppercase make password contains at least one upperCase character
hasSpecialCharacter make password contains at least one special character
hasDigits make password contains at least one digits
requiredErrorMsg message error to show when password is required
minLengthErrorMsg message error to show when password length is less then the specified
uppercaseErrorMsg message error to show when password doesn't contain any upperCase character
specialCharacterErrorMsg message error to show when password doesn't contain any special character

NumberElement

Pre-exsiting element for Number input

Pre-initialized values

enabled digitsOnly

extends from TextElement

Properties Description
label text label of TextField.
hint text hint of textField.
errorMsg message to show when TextField isn't validate.
labelStyle style of label TextField
errorStyle style of error message TextField
hintStyle style of hint TextFieldcolor
readOnly enable TextField uneditable
padding padding of TextField
isDigits enable only digit number

CountryElement

Pre-exsiting element for Country input

Pre-initialized values

pick country via BottomSheet

show flag of countries

Properties Description
label text label of TextField.
initValue Initiale Value to country input.
labelModalSheet Title of modalSheet
labelSearchModalSheet hint search textfield in BottomSheet
countryTextResult enumeration get result of selection countries
showFlag show flag of countris in modalsheet
padding padding of TextField

DecorationElement

abstract class

Pre-exsiting inputDecoration for TextFormField

Pre-initialized values

Typically one of UnderlineDecorationElement or OutlineDecorationElement or RoundedDecorationElement can be used.

UnderlineDecorationElement
Properties Description
borderColor The border Color to display when the InputDecorator does not have the focus.
errorBorderColor The borwidthLineder Color to display when the InputDecorator does have the error.
focusBorderColor The border Color to display when the InputDecorator does have the focus.
disabledBorderColor The border Color to display when the InputDecorator is disabled.
radius radius of the border.
widthSide The width of this line of the border
filledColor base fill color of the decoration
focusColor focused fill color of the decoration
OutlineDecorationElement
Properties Description
borderColor The border Color to display when the InputDecorator does not have the focus.
errorBorderColor The borwidthLineder Color to display when the InputDecorator does have the error.
focusBorderColor The border Color to display when the InputDecorator does have the focus.
disabledBorderColor The border Color to display when the InputDecorator is disabled.
radius radius of the border.
widthSide The width of this line of the border
filledColor base fill color of the decoration
focusColor focused fill color of the decoration

RoundedDecorationElement

without BorderSide

Properties Description
radius radius of the border.
filledColor base fill color of the decoration
focusColor focused fill color of the decoration

dynamicformflutter's People

Contributors

liodali avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.