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

Padding numbers in integer picker #35

Closed
insin opened this issue Feb 1, 2019 · 1 comment
Closed

Padding numbers in integer picker #35

insin opened this issue Feb 1, 2019 · 1 comment

Comments

@insin
Copy link
Contributor

insin commented Feb 1, 2019

Would it be possible to add some configuration for integer pickers to zero-pad the numbers displayed in the generated list items?

I have a dialog widget which uses a pair of NumberPicker.integers to select minutes and seconds and gives you back a Duration object, which currently looks like this:

qemu-system-x86_64_2019-02-02_03-26-04

It would be nice to be able to pad the numbers less than 10 out with a zero so they match the way minutes and seconds are displayed elsewhere in the app, e.g. 00 : 09 in the example above.

@markflarup
Copy link

A quick fix (even though it is a really bad habit to change library files) is to change line 281 to child: new Text(value.toString().padLeft(2, '0'), style: itemStyle), inside _integerInfiniteListView(). The values will be stored without the padding 0, so you will have to take care of that as well.

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

No branches or pull requests

2 participants