mask_text_input_formatter icon indicating copy to clipboard operation
mask_text_input_formatter copied to clipboard

Backspace not handled correctly

Open andrewwahid opened this issue 4 years ago • 32 comments

When you press backspace it removes the character before the last character, and the cursor jumps just before the last character. I can confirm that these issue only appears in flutter 1.22.5+ I think this issue is related to https://github.com/flutter/flutter/pull/67892 somehow... (all functionalities of textfield works as expected without the mast formatter)

Here is the mask formatter I used to test this issue: var phoneMaskFormatter = new MaskTextInputFormatter(mask: '### ### ####', filter: { "#": RegExp(r'[0-9]') });

andrewwahid avatar Jan 17 '21 13:01 andrewwahid

Yes, Even i am also facing same issue, below is my regexp MaskTextInputFormatter( mask: '######-##-####', filter: {"#": RegExp(r'[0-9]')})

venkimurthy07 avatar Jan 22 '21 09:01 venkimurthy07

same issue

handzup avatar Jan 31 '21 08:01 handzup

Related to https://github.com/flutter/flutter/issues/75502

siqwin avatar Feb 05 '21 15:02 siqwin

same issue. I'm using the flutter 1.27.0-2.0.pre.1 and mask_text_input_formatter: ^2.0.0-nullsafety.2

orlandobj avatar Feb 23 '21 00:02 orlandobj

Issue also occurs when keyboardType is set to TextInputType.datetime.

przemyslaw-holownia avatar Mar 08 '21 11:03 przemyslaw-holownia

It has been corrected?

JulioLongo avatar Mar 15 '21 13:03 JulioLongo

It has been corrected?

Tested and is working on 2.1.0-13.0.pre.86

tbdrz avatar Mar 15 '21 15:03 tbdrz

I am using Flutter 2.0.2 and still the problem exists

dmvvilela avatar Mar 18 '21 01:03 dmvvilela

https://github.com/flutter/flutter/issues/77855#issuecomment-801335050

Overman775 avatar Mar 18 '21 19:03 Overman775

I have the same problem in flutter 2.0.2, I tested it on a new standard project, easily reproducible, the bug only happens when using a custom keyboardType with visible numbers, such as datetime, number, phone and visiblepassword

mateusdalmeida avatar Mar 20 '21 17:03 mateusdalmeida

Yeah I also have the same problem, but only with a custom keyboardType. Any fix for it?

bdlukaa avatar Mar 20 '21 19:03 bdlukaa

I performed tests with another package and the behavior did not replicate, so I believe that the problem is not in the flutter

https://github.com/danilocoppi/flutter-textfield-mask

mateusdalmeida avatar Mar 20 '21 21:03 mateusdalmeida

Confirming that I am no longer seeing this issue with the latest Flutter beta channel (2.1.0-12.2.pre) and version 1.2.1+ of this package.

daveols avatar Mar 21 '21 23:03 daveols

Hi, try set keyboardType to TextInputType.number. Just works fine for me

RakovskyiSerhii avatar Mar 22 '21 21:03 RakovskyiSerhii

still happens, especially when you press the backspace button on your pc keyboard. When i dont set the input type the backspace button on the android emulator keyboard works as expected but when i press the backspace button on my keyboard its not working as expected. May also not work in flutter web. Im using Flutter 2.0.3 and Plugin Version 1.2.1+

Surio89 avatar Mar 24 '21 17:03 Surio89

Has there been any update on this problem?

aristeu13 avatar Apr 03 '21 20:04 aristeu13

I had to use another package because of this issue: https://github.com/danilocoppi/flutter-textfield-mask

bdlukaa avatar Apr 03 '21 20:04 bdlukaa

I will try to downgrade the version of the flutter, if it does not work I will try another package

aristeu13 avatar Apr 03 '21 21:04 aristeu13

I will try to downgrade the version of the flutter, if it does not work I will try another package

use easy_mask plugin and downgrade flutter version to 1.22.6

bhanuka96 avatar Apr 15 '21 11:04 bhanuka96

@amadeu01 @siqwin please check this issue and check this comment.

issue comment

bhanuka96 avatar Apr 16 '21 08:04 bhanuka96

same issue!

Flutter (Channel stable, 2.0.4, on macOS 11.2.3 20D91 darwin-x64, locale pt-BR) • Flutter version 2.0.4 • Framework revision b1395592de (2 weeks ago), 2021-04-01 14:25:01 -0700 • Engine revision 2dce47073a • Dart version 2.12.2

jhonatanluiz avatar Apr 17 '21 00:04 jhonatanluiz

Same issue here

jacopofranza avatar Apr 19 '21 19:04 jacopofranza

same issue! In iOS seens normal, but I had this problem in Android.

GabrielGoliveira04 avatar Apr 29 '21 02:04 GabrielGoliveira04

I solved it using flutter channel beta, so we will wait for the next stable release

jacopofranza avatar Apr 29 '21 07:04 jacopofranza

I solved it using flutter channel beta, so we will wait for the next stable release

Which version of the beta channel is that?

firatcetiner avatar May 10 '21 11:05 firatcetiner

I solved it using flutter channel beta, so we will wait for the next stable release

Which version of the beta channel is that?

I'm now back to the latest stable version 2.0.6 and the problem seems to be solved with the latest update

jacopofranza avatar May 10 '21 15:05 jacopofranza

Which version of the package are you using ? (using flutter 2.0.6 and package version ^2.0.0-nullsafety.2 and still having this bug)

Jojoooo1 avatar May 17 '21 20:05 Jojoooo1

also having this issue with Flutter 2.0.6 and package version ^2.0.0-nullsafety.2

henrikskul avatar May 18 '21 07:05 henrikskul

Same issue. I'm using this mask: MaskTextInputFormatter(mask: '(##) ###-##-##', filter: {"#": RegExp(r'[0-9]')})

Backspace removes not correctly. But, when I change keyboardType of TextField from TextInputType.number to TextInputType.text, so it works correctly. Any idea how to fix?

rustamkhon avatar Jun 12 '21 13:06 rustamkhon

Fix https://github.com/siqwin/mask_text_input_formatter/pull/55/commits/8f7b40a41772079d34228b90fa36007f72a327cb

KateZakirova avatar Jul 12 '21 13:07 KateZakirova