Skip to content

A numpad input widget for flutter with optional formatting and output text.

License

Notifications You must be signed in to change notification settings

a43mrk/flutter_numpad_widget

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A numpad input widget for flutter with optional formatting and output text.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 90.6%
  • Ruby 3.0%
  • Objective-C 2.9%
  • Shell 2.1%
  • Java 1.4%