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
{{ message }}
Repository navigation
TextStyle with existing height cannot be copied with height=null #58765
Another way to do this without introducing a new param: use a private constant as the default value for height. That way we can determine exactly whether the caller specified some value for height during copy. There is one downsize though, the method signature will have to replace double? height with dynamic height = _default.
TextStyle.height shouldn't be negative (it won't render anything), can we use a magic value of -1 to reset the height to null? Better yet, we can do an assert for TextStyle.new to disallow negative value and in TextStyle.copyWith, any negative value will reset the height.
This issue is assigned to @LongCatIsLooong but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
daohoangson commentedon Jan 31, 2022
Another way to do this without introducing a new param: use a private constant as the default value for
height. That way we can determine exactly whether the caller specified some value forheightduring copy. There is one downsize though, the method signature will have to replacedouble? heightwithdynamic height = _default.daohoangson commentedon Jun 10, 2023
TextStyle.heightshouldn't be negative (it won't render anything), can we use a magic value of-1to reset the height tonull? Better yet, we can do anassertforTextStyle.newto disallow negative value and inTextStyle.copyWith, any negative value will reset the height.LongCatIsLooong commentedon Jan 12, 2024
It's not only
copyWiththat is not working. The meaning of null is ambiguous in the TextStyle context:TextStyle.mergeis called, orI think we should follow the TextStyle convention and assume 1, let null represent "inherited", and pick a magic value for "disabled".
The other TextStyle class from dart:ui has the same problem.
daohoangson commentedon Jan 12, 2024
That would be great. Thank you.
flutter-triage-bot commentedon May 17, 2024
This issue is assigned to @LongCatIsLooong but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
Allow unsetting `TextStyle.height` (#52940)
Add a sentinel value for `TextStyle.height` (#149049)
Add a sentinel value for `TextStyle.height` (flutter#149049)
github-actions commentedon Jun 12, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.