animated_text_field 0.0.1%2B2

SDKflutter
Platformandroidioswindowslinuxmacosweb

Animated Text Custom Field which can be used to animate text field and errors by modifying the text field widget. It use custom fade animation from package [simple_animations](https://pub.dev/packages/simple_animations) to animate the text field and errors and hide error after interval of time (default 10 seconds).

Animated Text Custom Field which can be used to animate text field and errors by modifying the text field widget. It use custom fade animation from package simple_animations to animate the text field and errors and hide error after interval of time (default 10 seconds).

Features

  • Easy to handle errors
  • Easy to handle text field
  • Keep remove boilerplate code
  • String extension to Capitalize first letter of string
  • Some Validation are already added
    • Email
    • Password
    • Phone
    • Url
    • Credit Card:Add following card types
      • Visa
      • MasterCard
      • American Express
      • Diners Club
      • Discover
      • JCB
      • UnionPay
      • Maestro
      • Mir
      • Forbrugsforeningen
      • dankort
      • Laser
      • InstaPayment
      • Laser
      • Switch
      • RuPay
    • CVV
    • Date
    • Time
    • IP Address
    • IP4 Address
    • IP6 Address
    • JSON
    • Pin Code
    • Passport Number
    • Latitude
    • Longitude

Getting started

  • Add the dependency to your pubspec.yaml file

      dependencies:
          animated_text_custom_field: 
    

    for latest version check animated_text_custom_field

  • Import the package

        import 'package:animated_text_custom_field/animated_text_custom_field.dart';
    
  • Use the widget

        CustomTextField(
                        errorKey: 'password',
                        controller: passwordController,
                        keyboardType: TextInputType.visiblePassword,
                        decoration: CustomTextInputDecoration(
                          prefixIcon: const Icon(Icons.lock),
                          hintText: "Enter your password",
                          enabledBorder: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(10),
                            borderSide: const BorderSide(
                              color: Colors.grey,
                              width: 2,
                            ),
                          ),
                          border: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(10),
                            borderSide: const BorderSide(
                              color: Colors.grey,
                              width: 2,
                            ),
                          ),
                          focusedBorder: OutlineInputBorder(
                            borderRadius: BorderRadius.circular(10),
                            borderSide: const BorderSide(
                              color: Colors.blue,
                              width: 2,
                            ),
                          ),
                        ),
                        validator: (String? value) {
                          if (value != null) {
                            if (!TextErrorservice.isValidPasswordLength(value,  //using TextErrorService to validate password 
                                length: 8)) {
                              return "Password must be at least 8 characters";
                            }
                          }
                          return null;
                        },
                      ),
    
  • Use String extension to Check if string is valid email

        String email = "test@test.com";
          if (email.isEmail()) {
            //do something
            }
    

Output

output sample1

Output sample2

Usage

A simple usage example:

  • open code folder "example" in code editor (VS Code, Android Studio, etc).
  • run the following command in terminal
    flutter run -d chrome

Properties and Methods

PropertyTypeDescription
controllerTextEditingControllerTextEditing Controller used to control text
errorDurationDurationDefault value second 10.
errorStyleTextStyleTextStyle for Error Text Widget
errorKeyStringKey for error
fadeAnimationDurationdoubleDefault value 1.5 seconds
customErrorWidgetWidgetCustom Error Widget
decorationCustomTextInputDecorationCustom Input Decoration(Input decoration)
validatorString Function(String?)Validator for text field (required)

Other methods and properties are inherited from TextFormField widget.

Extension Methods

MethodDescription
isEmailCheck if string is valid email
isPasswordCheck if string is valid password
hasPasswordLengthCheck if string has password length
isPhoneNumberCheck if string is valid phone number
isUrlCheck if string is valid url
isNameCheck if string is valid name
isVisaCardCheck if string is valid visa credit card
isMasterCardCheck if string is valid master card
isAmericanExpressCardCheck if string is valid american express
isDinersClubCardCheck if string is valid diners club
isDiscoverCardCheck if string is valid discover
isJCBCardCheck if string is valid JCB
isUnionPayCardCheck if string is valid union pay
isMaestroCardCheck if string is valid maestro
isMirCardCheck if string is valid mir
isForbrugsforeningenCardCheck if string is valid forbrugsforeningen
isDankortCardCheck if string is valid dankort
isLaserCardCheck if string is valid laser
isInstaPaymentCardCheck if string is valid insta payment
isSwitchCardCheck if string is valid switch
isSoloCardCheck if string is valid solo
isRuPayCardCheck if string is valid ruPay
isCVVCheck if string is valid cvv
isCVV2Check if string is valid cvv2
isExpiryDateCheck if String is valid Expiry Date
isCreditCardCheck if String is valid credit card
isIPCheck if String is valid IP
isIP4Check if String is valid IP4
isIP6Check if String is valid IP6
isJSONCheck if String is valid JSON
isPinCodeCheck if String is valid Pin Code
isPassportNumberCheck if String is valid Passport Number
isLatitudeCheck if String is valid Latitude
isLongitudeCheck if String is valid Longitude
capitalizeCapitalize first letter of string
isValidTimeCheck if String is valid Time
isValidDateCheck if String is valid Date

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request
  • If you have any questions, please open an issue.
  • If you found a bug, please open an issue.
  • If you have a feature request, please open an issue.
  • If you want to contribute, please submit a pull request.
  • If you use this package, please add a star on GitHub.
  • If you use this package, please tweet about it.
  • If you use this package, please mention it in a blog post.