getFittedWidth method
Implementation
double getFittedWidth(String? key, dynamic value,
{double? maxKeyWidth, double? maxValueWidth}) {
double width = 0;
double? cached = cacheMain[key];
if (cached == null) {
cached =
messureText(key?.characters ?? nullCharacters, width: maxKeyWidth);
cacheMain[key] = cached;
}
width += cached;
if (isNotNullOrEmpty(value)) {
Characters? valueCharacters;
cached = null;
if (value is String) {
valueCharacters = value.characters;
} else if (value is num || value is bool || value == null) {
cached = cacheMain[value];
} else {
valueCharacters = value.toString().characters;
}
cached ??= messureText(valueCharacters, width: maxValueWidth);
width += cached;
}
return width;
}