You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The text input shows incorrect vertical alignment when NumberBox has no suffix widgets (e.g., when ClearButton = false and mode = SpinButtonPlacementMode.none). The text appears slightly shifted upward compared to the focused state, creating an inconsistent appearance.
To Reproduce
Steps to reproduce the behavior:
Create a NumberBox with the following configuration:
NumberBox(
clearButton:false,
mode:SpinButtonPlacementMode.none,
// ... other properties
)
Observe the text alignment in both focused and unfocused states
Notice the text is not vertically centered when unfocused
Expected behavior
Text should remain vertically centered in both focused and unfocused states
Screenshots
Additional context
This issue appears to be related to #1027, where TextBox's vertical alignment depends on the presence of decorations:
When NumberBox has no suffix widgets, no decorations are present, causing the alignment to default to TextAlignVertical.top. If this behavior is not intentional, it would be better to modify this logic to maintain consistent vertical centering, especially for NumberBox use cases.
Simple solution by directly setting textAlignVertical in NumberBox:
final child =TextBox(
key: _textBoxKey,
// ...
textAlign: widget.textAlign ??TextAlign.start,
textAlignVertical:TextAlignVertical.center, // This ensures consistent centering// ...
);
The text was updated successfully, but these errors were encountered:
Describe the bug
The text input shows incorrect vertical alignment when NumberBox has no suffix widgets (e.g., when
ClearButton = false
andmode = SpinButtonPlacementMode.none
). The text appears slightly shifted upward compared to the focused state, creating an inconsistent appearance.To Reproduce
Steps to reproduce the behavior:
NumberBox
with the following configuration:Expected behavior
Text should remain vertically centered in both focused and unfocused states
Screenshots
![image](https://private-user-images.githubusercontent.com/12293818/391767182-e0ea090c-7042-4130-a18f-20410d0ae131.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NzkxNTksIm5iZiI6MTczOTU3ODg1OSwicGF0aCI6Ii8xMjI5MzgxOC8zOTE3NjcxODItZTBlYTA5MGMtNzA0Mi00MTMwLWExOGYtMjA0MTBkMGFlMTMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDAwMjA1OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE5MGMxMTgyMmM1N2EwMDFjOGNjYjQ4MThmOWJmOTBhZDk4NWU2YTZmNzRkNjMwNTY1OThmNWRlNmVmOTdlNjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.OwQkjHMQSHgqOKmXduU1-qSGi1umASKURw_R9RJrBJU)
Additional context
This issue appears to be related to #1027, where TextBox's vertical alignment depends on the presence of decorations:
When NumberBox has no suffix widgets, no decorations are present, causing the alignment to default to
TextAlignVertical.top
. If this behavior is not intentional, it would be better to modify this logic to maintain consistent vertical centering, especially for NumberBox use cases.Simple solution by directly setting
textAlignVertical
in NumberBox:The text was updated successfully, but these errors were encountered: