Coder Social home page Coder Social logo

leandronovak / extended_masked_text Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 12.0 461 KB

A small set of custom TextEditingControllers that allows masked text inputs for flutter apps

Home Page: https://pub.dev/packages/extended_masked_text

License: MIT License

Kotlin 0.16% Swift 2.08% Objective-C 0.05% Dart 41.88% CMake 23.36% C++ 28.56% C 1.71% HTML 2.21%
flutter mask mask-controller masked-controller masked-textfield

extended_masked_text's Introduction

leandronovak

extended_masked_text's People

Contributors

brasizza avatar fabricio-godoi avatar leandronovak avatar lomski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

extended_masked_text's Issues

On latest Flutter version, it doesn't work properly

Hi @LeandroNovak

I've been using this package for many months. But with Flutter version 2.2.3, the behavior has changed, and my masked currency text field is not working properly. If I downgrade Flutter back to 2.0.3 (the previous version I was working with), then it works as expected again.

The issue is that when I type in a masked field on 2.2.3 version, it jumps back to the first character, so the whole text gets typed backwards, which is terrible. When deleting characters, it also jumps to start.

Can you look into this?

Cursor

Uso para fazer a mascara de CPF, como o exemplo, mas nestas ultimas versoes, com o cursor, parou de funcionar.
Cada vez que chega no proximo digito apos o . ele volta o cursor uma casa.
Tem alguma forma de desativar esse cursor? Em dispositivos moveis parece sem sentido...

obrigado...

Flutter: 2.2.0, sdk 2.13.0, iphone simulator 14.5

Remove print on listener

First of all, great lib and thank you for the maintenance.

If you could remove the print in the listener would be great, it's a really minor thing but annoying when debugging.

image

Adding dot at the beginning of a negative number less than 1,000

When working with MoneyMaskedTextController I noticed that when I draw on the screen a text coming from my controller that has a negative initial value less than 1,000 it adds a point between the minus sign and the value.
As a solution for my project I use a replaceFirst to replace the '-.' for '-'

Value before entering controller = -397.5

This is the print of my controller
MoneyMaskedTextController#439e6(TextEditingValue(text: โ”คR$ -.397,50โ”œ, selection: TextSelection(baseOffset: 11, extentOffset: 11, affinity: TextAffinity.downstream, isDirectional: false), composing: TextRange(start: -1, end: -1)))

This is what renders on screen
R$ -.397,50

afterChange and beforeChange listeners

The original no longer supported library have a afterChange and beforeChange listener:
Function afterChange = (String previous, String next) {};
Function beforeChange = (String previous, String next) { return true; };

Can we have this here?

Cursor behavior

Greetings,

I'm trying to update de previous library to this one, but I'm getting some behaviors in the 2.1.0 version that I don't know if it is intended.

When typing (both in Android and iOS) I cannot set the cursor to the previous letters with the MaskedTextController. Is there a way to unlock the cursor to be able to put it in the middle of a sentence? I was not able to debug the code to find the reason, but if possible, to put a flag to enable/disable this behavior would be awesome.

Another bug that I found that is coming from the previous library is when it is changing the mask and the cursor is in the middle. Testing the MoneyMaskedTextController I got the cursor to jump back to the end when the mask is changing (when the value goes from 100 to 1000 for instance). It is possible to avoid that cursor flick? I think it is possible to determine from the previous mask where the cursor is, and then update its position based on the new mask.

Best regards!

FormatException: Invalid number (at character 1)

With the following code I get this error:

MoneyMaskedTextController?  moneyController = MoneyMaskedTextController(
          decimalSeparator: '.',
          thousandSeparator: ',');

moneyController!.updateValue(45.67);

[Bug report] Decimal keeps when returning

I have a money masked text controller:

 MoneyMaskedTextController(
      decimalSeparator: ',', leftSymbol: '\$', thousandSeparator: '.', initialValue: widget.initialValue, precision: 2
    );

The initialValue is 25000.25, and when I want to set the value to 0 typing, .5 keeps on the text field and I have to move the cursor to the end and start returning again.

Focus MaskedTextController

I wonder if anyone has had this problem.

I have a list of MaskedTextController, however as it is in the middle of the page it throws the focus to it, if I use a TextEditingController this same problem does not happen.

Git

Problem when using MoneyMaskedTextController on TextFormField

When i use this basic money controller in a TextFormField:

MoneyMaskedTextController moneyController = MoneyMaskedTextController(leftSymbol: 'R\$');

TextFormField(controller: moneyController)

I get this error when the field is empty:

Exception has occurred.
RangeError (RangeError: Value not in range: -1)

After this, the there is some value on the field, there is another error:

Exception has occurred.
FormatException (FormatException: Invalid radix-10 number (at character 1)
R$5.555,554
^
)

In debug console, nothing appers

String alignment

Supose we have a mask 000.000-00 and user types 1234, with right alignment we should get 000.012-34. With left alignment, for the same mask and user input we should get 123.400-00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.