toLengthFloatOrNull
Converts a string representation of a length to a float value.
The input string can be either a percentage value (e.g., "50%") or a plain float value (e.g., "10.5").
If the input string is a percentage value, the result is calculated as a percentage of the maximum between the given width and height.
For example, if the input is "50%" and the width is 100 and the height is 200, the result will be 100 (50% of 200).
If the input string is a plain float value, the result is the float value parsed from the string.
If the input string cannot be parsed to a float value, the result is null.
Return
The float value represented by the input string, or null if the string cannot be parsed.
Parameters
The width to use for percentage calculations.
The height to use for percentage calculations.