Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/hnvn/flutter_pattern_formatter

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns
https://github.com/hnvn/flutter_pattern_formatter

flutter flutter-package formatters textinputformatter

Last synced: 3 months ago
JSON representation

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

Lists

README

        

# PatternFormatter

[![pub package](https://img.shields.io/pub/v/pattern_formatter.svg)](https://pub.dartlang.org/packages/pattern_formatter) ![](https://github.com/hnvn/flutter_pattern_formatter/workflows/unit%20test/badge.svg) [![codecov](https://codecov.io/gh/hnvn/flutter_pattern_formatter/branch/master/graph/badge.svg)](https://codecov.io/gh/hnvn/flutter_pattern_formatter)

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

## How to use

```dart
import 'package:pattern_formatter/pattern_formatter.dart';
```

### Thousands grouping

* Integer number:



```dart
TextField(
keyboardType: TextInputType.number,
inputFormatters: [
ThousandsFormatter()
],
)
```

* Decimal number:



```dart
TextField(
keyboardType: TextInputType.number,
inputFormatters: [
ThousandsFormatter(allowFraction: true)
],
)
```

### Card number grouping



```dart
TextField(
keyboardType: TextInputType.number,
inputFormatters: [
CreditCardFormatter(),
],
)
```

### Date format



```dart
TextField(
keyboardType: TextInputType.number,
inputFormatters: [
DateInputFormatter(),
],
)
```