Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support eager formatting #44

Closed
steven-spiel opened this issue Feb 16, 2021 · 3 comments
Closed

Support eager formatting #44

steven-spiel opened this issue Feb 16, 2021 · 3 comments

Comments

@steven-spiel
Copy link

This is a great plugin. Thank you for simplifying TextInputFormatters.

One feature request is to have eager formatting

Given this configuration for date formatting:

MaskTextInputFormatter(
  mask: '##/##/####',
  filter: <String, RegExp>{'#': RegExp('[0-9]')},
),

I would expect that upon entering 01, that the text field would add the formatting so it read 01/. Reason being, if a user was really trying to enter in / after the 01, the text field doesn't allow them to do that, which could be frustrating.

Is that doable? I think the trickiest bit might be that when using backspace, we wouldn't want to add the / on every text input event, or they'd never be able to delete any of the formatting. So there'd need to be some way to compare the state of the text before/after the change.

@KevinZhang19870314
Copy link

@steven-spiel Hi any solution or workaround for this? I am now facing the same requirement!

@steven-spiel
Copy link
Author

@KevinZhang19870314 We ended up just writing our own formatter

@harkairt
Copy link

harkairt commented Sep 6, 2021

Same issue, we'd like to have
##h ##m ##s but the trailing s won't appear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants