mask_shifter 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 90

mask_shifter #

This package provides a way to switch between two masks in a TextField

Getting Started #

Import the packages:

import 'package:flutter_masked_text/flutter_masked_text.dart';

Is very simple to use: #

Just pass the class as an input formatter. Example:

return TextField(
          inputFormatters: [
            MaskedTextInputFormatterShifter(
                maskONE:"XXX.XXX.XXX-XX",
                maskTWO:"XX.XXX.XXX/XXXX-XX"
             ),
          ],
          decoration: InputDecoration(
            border: OutlineInputBorder(),
            labelText: this.label,
            labelStyle: TextStyle(fontWeight: FontWeight.bold),
          ),
        );

There are two parameters, maskONE and maskTWO. maskONE must be the shorter mascara, and maskTWO the longest.

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

[0.0.1] - 03/12/2018

  • Initial Release of Package

example/example.dart

import 'package:flutter/material.dart';
//Componentes
import 'package:mask_shifter/mask_shifter.dart';

class UsersData extends StatefulWidget {
  UsersData({Key key}) : super(key: key);

  @override
  _UsersData createState() => _UsersData();
}

class _UsersData extends State<UsersData> {
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: NestedScrollView(
        body: ListView(
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: TextField(
                //HERE IS HOW USE THE LIBRARY
                inputFormatters: [
                  MaskedTextInputFormatterShifter(
                      maskONE: "XXX.XXX.XXX-XX", maskTWO: "XX.XXX.XXX/XXXX-XX"),
                ],
                decoration: InputDecoration(
                  border: OutlineInputBorder(),
                  labelText: "CPF/CNPJ MASK",
                  labelStyle: TextStyle(fontWeight: FontWeight.bold),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mask_shifter: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mask_shifter/mask_shifter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
81
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
90
Learn more about scoring.

We analyzed this package on Nov 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/mask_shifter.dart. (-1 points)

Analysis of lib/mask_shifter.dart reported 2 hints:

line 32 col 18: Name non-constant identifiers using lowerCamelCase.

line 55 col 18: Name non-constant identifiers using lowerCamelCase.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test