GithubHelp home page GithubHelp logo

shiba-kar / flutter-pin-pad Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 80-20-labs/flutter-pin-pad

0.0 0.0 0.0 89 KB

generic num pad widget used to create a custom pin input widget.

License: Other

Dart 93.54% Objective-C 3.88% Kotlin 0.61% Swift 1.98%

flutter-pin-pad's Introduction

pin-pad

simple, generic and opinionated numpad meant for stylish pin inputs.

video-example

Importing

in pubspec.yaml:

dependencies:
  pinpad:
    git: https://github.com/80-20-labs/pin-pad

in .dart file:

import 'package: pinpad/numpad.dart';
import 'package: pinpad/numpad_controller.dart';

Usage

style parameters

you can customize the look by passing the following parameters to NumPad():

Parameters Description
backgroundColor self explanatory.
keyColor color of each individual regular key (doesn't include backspace or clear).
clearKeyBackgroundColor background color for the clear button.
clearKeyFontColor font color for clear key.
backKeyBackgroundColor background color for the backspace button.
backKeyFontColor font color for the backspace key.
numPadFontColor font color of the number keys.
pinInputFieldColor font color for the input field.
pinInputLength limit input length, defaults to 5.
pinPlaceholder customize placeholder text for the input field, defaults to "PIN"
pinPlaceholderColor font color for the placeholder text

controller

with the NumPadController object, you can add custom behaviors for what to do once you want to process the pin input.

Type Name Description
function wrongInputBehavior() Shakes pin input, also clears input field
string code returns String for the content of the pin input code
bool doneTyping returns true once the pin input field text has reached the pinInputLength set

example code.

full code implementation can be found at example/lib/main.dart.

NumPadController npc = NumpadController();
npc.addListener((){
  String realCode = "111";
  if (npc.doneTyping) {
    print("do any behavior you want here");
    if (realCode != npc.code) {
      // shakes the input field and clears text.
      npc.wrongInputBehavior();
    }
  }
});

...

return NumPad(
  controller: npc
  pinInputLength: 4,
);

flutter-pin-pad's People

Contributors

ericmichael avatar shiba-kar avatar shibakar 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.