cnpj_cpf_formatter 1.0.7 copy "cnpj_cpf_formatter: ^1.0.7" to clipboard
cnpj_cpf_formatter: ^1.0.7 copied to clipboard

outdated

This library gives you a formatter to CNPJ or CPF documents. Enjoy it!

example/cnpj_cpf_formatter_example.dart

import 'package:flutter/material.dart';
import 'package:cnpj_cpf_formatter/cnpj_cpf_formatter.dart';

void main() => runApp(App());

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(8),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextField(
              decoration: InputDecoration(
                labelText: 'CPF',
                helperText: 'just CPF formatting',
              ),
              inputFormatters: [
                CnpjCpfFormatter(
                  eDocumentType: EDocumentType.CPF,
                )
              ],
            ),
            SizedBox(
              height: 16,
            ),
            TextField(
              decoration: InputDecoration(
                labelText: 'CNPJ',
                helperText: 'just CNPJ formatting',
              ),
              inputFormatters: [
                CnpjCpfFormatter(
                  eDocumentType: EDocumentType.CNPJ,
                )
              ],
            ),
            SizedBox(
              height: 16,
            ),
            TextField(
              decoration: InputDecoration(
                labelText: 'CNPJ/CPF',
                helperText: 'CNPJ and CPF formatting',
              ),
              inputFormatters: [
                CnpjCpfFormatter(
                  eDocumentType: EDocumentType.BOTH,
                )
              ],
            )
          ],
        ),
      ),
    );
  }
}
4
likes
30
pub points
39%
popularity

Publisher

unverified uploader

This library gives you a formatter to CNPJ or CPF documents. Enjoy it!

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cnpj_cpf_helper, flutter

More

Packages that depend on cnpj_cpf_formatter