Input Formatter not applied when showing paste dialog
The PinCodeTextField allows you to provide inputFormatters, but the paste process ingores these. I created a pull request to solve this: https://github.com/adar2378/pin_code_fields/pull/401 (changes should be non-breaking)
Let's say you only allow numbers and you have 6 digits:
PinCodeTextField(
length: 6,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
],
// ...
)
Now try to paste the following plain text content on android: "123 456" (note the whitespace in between).
A user would most expect this to paste as "123456" but what actually gets inserted is "123 45". These are exactly 6 characters but as the inputFormatters are ignored, a whitespace gets pasted, the digits "45" end up in the wrong place and the last digit "6" is omitted as there is no space left for it.
I also found other issues and fixed them in the pull request as they are tightly related:
- the file was broken exactly at place where i did the edits, something with the braces was messed up, looks like a previous merge corrupted it, is now fix
- paste previously differed if you enabled/disabled
showPasteConfirmationDialogas_showPasteDialogtrimmed the content while_pastedid not - there was no way to disable the trim when pasting, so if somebody really needs whitespace (e.g. pasting some kind of obsucre password), pasting did not work for them.
Is this library reliable? I see no one has maintained it for two years.
@adar2378 please merge this https://github.com/adar2378/pin_code_fields/pull/401
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.