GithubHelp home page GithubHelp logo

vonqo / block_input Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 1.0 295 KB

Flutter Plugin - Simple character blocked input that usually used for redeem/validation input.

License: Apache License 2.0

Java 7.47% Ruby 6.90% Swift 2.81% Objective-C 2.14% Dart 80.69%
flutter dart flutter-plugin inputform

block_input's Introduction

Block Input

build pub package

Simple character blocked input that usually used for redeem code or validation code input.

Gallery

Example

Full example

import 'package:block_input/block_input.dart';
BlockInput(
  controller: blockInputController,
  keyboardType: BlockInputKeyboardType.number, // Number or Text
  axisAlignment: MainAxisAlignment.spaceBetween, // Same as Row/Column MainAxisAlignment
  blockInputStyle: BlockInputStyle(
    backgroundColor: Colors.black12, // Color
    border: OutlineInputBorder( // Same as InputDecoration border
         borderRadius: BorderRadius.all(Radius.circular(10)),
         borderSide: BorderSide(color: Colors.deepOrange, width: 1)
    ),
    focusedBorder: OutlineInputBorder( // Same as InputDecoration border
         borderRadius: BorderRadius.all(Radius.circular(10)),
         borderSide: BorderSide(color: Colors.blueAccent, width: 2)
    )
  )
)

Cyrillic support

Mongolian cyrillic input is loosely supported for now. This feature will help you to build Mongolian Registration No input. Cyrillic input triggers custom keyboard layout. Usage:

BlockInput(
  keyboardType: BlockInputKeyboardType.mnCyrillic
  ...
)

Cyrillic keyboard styling:

BlockInputStyle(
    keyboardStyle: BlockKeyboardStyle(
      keyColor: Colors.blueAccent,
      backgroundColor: Colors.white,
      width: 40,
      height: 40,
      textStyle: TextStyle(),
      keyShape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(18.0),
          side: BorderSide(color: Colors.red)
      ),
    ),
    ...
),

Controller and Listener

Controller is almost same as classic TextEditingController :D

// Initializing controller
int inputSize = 6; // input size is required for controller
BlockInputController blockInputController = BlockInputController(inputSize);

// Attaching listener
blockInputController.addListener(() {
  print(blockInputController.text);
});

// Getting and Setting value
String getValue = blockInputController.text; // get
blockInputController.text = 'maaraa'; // set + 
// + throws exception when text length was exceeded from input size

blockInputController.clear(); // clear

// Disposing
blockInputController.dispose();

Attributes

BlockInput

Attribute Type
blockInputKeyboardType BlockInputController
blockInputKeyboardType BlockInputKeyboardType
blockInputStyle BlockInputStyle
errorMessage String
errorMessageStyle TextStyle
axisAlignment MainAxisAlignment

BlockInputStyle

Attribute Type
backgroundColor Color
border OutlineInputBorder
focusedBorder OutlineInputBorder
padding EdgeInsets
width double
textStyle TextStyle
keyboardStyle BlockKeyboardStyle

Licence

Apache License version 2.0

Enkh-Amar.G // vonqo

block_input's People

Contributors

vonqo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.