japan_fields 0.1.0 japan_fields: ^0.1.0 copied to clipboard
A simple way to use japanese data formats and patterns on your application
Japan Fields #
The simplest way to use japanese formats in your application!
This package contains input formatters for common used formats in Japan.
Features #
Formatters #
Formatter | Supported formats |
---|---|
Credit card number | 1111 2222 3333 4444 |
Credit card expiration date | 12/26 |
Date | 1900/01/01 or 1900年01月01日 |
Phone | 123-456-7890 |
Postal code | 123-4567 or 〒123-4567 |
Time | 23:59 |
Yen | 1,000,000 or ¥1,000,000 |
Getting started #
To use this package as library, depend on it.
- Run this command (with flutter)
flutter pub add japan_fields
This will add a line like this to yours pubspec.yaml
dependencies:
japan_fields: ^0.1.0
- Run this command (with flutter)
flutter pub get
- Import it in your Dart code
import 'package:japan_fields/japan_fields.dart';
Usage #
Just include the formatter of your need to the input formatters list of the field.
To ensure that the field only accepts numeric values, used in conjunction with the FilteringTextInputFormatter.digitsOnly formatter.
TextField(
inputFormatters: [
//Add to ensure that only numeric values is accepted
FilteringTextinputFormatter.digitysOnly,
CreditCardInputFormatter(),
],
);
TextField(
inputFormatters: [
//Add to ensure that only numeric values is accepted
FilteringTextinputFormatter.digitysOnly,
//Passing true to enableMark will format with the postal code mark
PostalCodeInputFormatter(enableMark: true),
],
);
TextField(
inputFormatters: [
//Add to ensure that only numeric values is accepted
FilteringTextinputFormatter.digitysOnly,
//Passing true to enableYenMark will format with the yen mark
YenInputFormatter(enableYenMark: true),
],
);