Giter VIP home page Giter VIP logo

flutter_numpad_widget's Introduction

flutter_numpad_widget

A set of Flutter widgets providing numpad input functionality without the soft keyboard.

Example Screenshot

Getting Started

In your Flutter project add the dependency:

dependencies:
    ...
    flutter_numpad_widget: 0.0.1

Usage Example

Import flutter_numpad_widget

import 'package:flutter_numpad_widget/flutter_numpad_widget.dart'

Formatted Phone Input

The simplest implementation involves creating a NumpadController and passing it to a Numpad and a NumpadText.

class ExampleNumpadWidget extends StatelessWidget {

//Instantiate a NumpadController
final _controller = NumpadController(format: NumpadFormat.PHONE);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          Padding(
            padding: const Edgeinsets.all(16),
            child:NumpadText(
              controller: _controller,
              style: TextStyle(fontSize: 40)
            )
          ),
          Expanded(
            child: Numpad(
              controller: _controller,
              buttonTextSize: 40
            )
          )
        ]
      )
    );
  }
}

This will display a Numpad with a masked TextField above it showing the phone number the user has typed in.

Other uses

It is also possible to use the Numpad on its own, and respond to user input by attaching a listener to the NumpadController.

class NumpadOnlyExample extends StatelessWidget {
  final _controller = NumpadController();

  NumpadOnlyExample() {
    this._controller.addListener(_controllerListener);
  }

  void _controllerListener() {
    //Do things with the data in the controller.
  }

  @override
  Widget build() {
    return Numpad(controller: _controller);
  }
}

The NumpadController exposes a rawString, rawNumber, and formattedString.

Feature Overview

  • Optional hint text
  • Styleable text field and Numpad buttons
  • Automatic formatting of phone numbers, currency, and masked PINs.

For more information, see the documentation.

flutter_numpad_widget's People

Contributors

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