Skip to content

fix: keep the minus sign in front of zero-padded negative values - #107

Open
palmoni5 wants to merge 1 commit into
ubuntu-flutter-community:mainfrom
palmoni5:fix/negative-value-padding
Open

palmoni5 wants to merge 1 commit into
ubuntu-flutter-community:mainfrom
palmoni5:fix/negative-value-padding

Conversation

@palmoni5

Copy link
Copy Markdown

Problem

With digits, -3 was displayed as 00-3. That text is not a number: the value parsed as 0, and a +/- step threw a FormatException when building the onSubmitted value.

Fix

Pad only the magnitude, so -3 shows as -003.

Tests

test/negative_value_padding_test.dart.

CI on main currently fails in the Android example build and the publish dry-run; it goes green with #102.

With digits set, negative values were padded as a whole string, so -3
with digits: 4 was displayed as "00-3". That text is not a number:
typing could not continue from it, and a +/- step threw a
FormatException when the padded text was parsed for onSubmitted.

Pad only the magnitude and keep the sign first ("-003").
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 this pull request may close these issues.

1 participant