Repository navigation
Conversation
setValue clamped the requested value and then formatted it with the configured number of decimals. A NaN or infinite value was written into the text field, and rounding could push a clamped value past a fractional bound (max: 0.29 with decimals: 1 accepted 0.3). Ignore non-finite values, round before validating, and drop a step whose rounded value falls outside [min, max]. onSubmitted now receives the already-rounded value.
A +/-, arrow or page step wrote the new text into the controller and relied on the controller listener to update the value and call onChanged. That listener ran inside setValue's setState, called canChange a second time for the same value and triggered a second setState. Suppress the listener while the widget writes its own text, update the value directly and call onChanged explicitly, once per step. _updateController now shifts the selection by the oldValue it is given (instead of the current value, which didUpdateWidget had already replaced), clamps it to the new text, and clears any IME composing range that referred to the old text.
…lid value Text that does not parse as a number yet (an empty field, "-", ".") was treated as 0: the state value became 0 and onChanged(0) was called while the user was still typing. The same happened for a number below min while typing towards a valid value (e.g. "1" on the way to "15" with min: 10). - Incomplete text keeps the current value and does not call onChanged. - An out-of-range number updates the internal value but calls onChanged only once it is within [min, max]. - The rollback value used on blur/submit and after a canChange rejection is the last accepted value (typed or stepped), instead of the value from the previous focus session. - A canChange rejection restores the previous text without re-entering the controller listener. The shared input tests now expect the value to stay at 1 after the field is cleared.
The formatter and bindings getters built a new SpinFormatter and a new shortcut map on every build. A new inputFormatters instance and a new CallbackShortcuts map make the text field and shortcut manager treat the configuration as changed on each rebuild. Create them in initState and recreate them only when min, max or decimals (formatter) or the presence of pageStep (bindings) change.
This was referenced Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #111 (textual dependency only; contains its commits); review only the last commit.
Problem
The
formatterandbindingsgetters created new instances on every build.Fix
Create them once; recreate the formatter when min, max or decimals change, and the bindings when the presence of
pageStepchanges.Tests
input helpers are reused on rebuild.CI on
maincurrently fails in the Android example build and the publish dry-run; it goes green with #102.