opened
knopp
username_0
Right now, every widget dimensions pretty much have to be rounded to integer, which in practice can mean as much as 3 device pixels, or worse yet, on some devices (with deviceAspectRatio not being integer) it might not even be aligned on pixel boundary.

This causes noticeable issues with things like text alignment. Cupertino NavigationBar is a prime example. When sliding to previous page, as the back text button is resized, it is visibly jumping up and down. This does not happen with native iOS navigation bar.

Personally I wish flutter used both resolution independent points (for user specified things such as paddings, sizes, etc) and integer pixels for actual low level layout calculations. But I suppose that's completely out of question at this stage.

So I'd like to ask if there are any plans to fix this in foreseeable future? Is this even fixable without major breaking changes throughout flutter?
Actual solution for float pointing hacks all over flutter?
issue
created
knopp
username_0
Perhaps a pragmatic approach would be to snap values to pixel boundary?

i.e. instead of `layoutValue.ceilToDouble()` in TextPainter's `_applyFloatingPointHack` it would be

`(layoutValue * devicePixelRatio).ceilToDouble() / devicePixelRatio`

This would have to be done after individual layout calculations and before float comparisons. The benefit would be that everything gets to be pixel snapped even on devices with non integer pixelAspectRatio and on 3x devices the TextPainter size would get *much closer* to the actual text size.
comment
created
Hixie
username_1
We should just remove the _applyFloatingPointHack entirely. See https://github.com/flutter/flutter/issues/31707.
comment
created
Hixie
username_1
We should just remove the _applyFloatingPointHack entirely. See https://github.com/flutter/flutter/issues/31707.
comment
created
escamoteur
username_2
@username_1 can we close this one then?
comment
created
pedromassangocode
username_3
@username_1 can you please confirm if this one can be closed in favor of https://github.com/flutter/flutter/issues/31707?
comment
created
Hixie
username_1
Sure.
comment
closed
Hixie
username_1
issue