formatChatThreadStatusText function
Implementation
String formatChatThreadStatusText(String text, {DateTime? startedAt, int? totalBytes, int? linesAdded, int? linesRemoved}) {
if (linesAdded != null || linesRemoved != null) {
final added = linesAdded != null ? "+${_formatGroupedStatusByteDigits(linesAdded)}" : null;
final removed = linesRemoved != null ? "-${_formatGroupedStatusByteDigits(linesRemoved)}" : null;
return [text, ?added, ?removed].join(" ");
}
if (totalBytes != null && totalBytes > 100) {
return "$text ${_formatStatusByteCount(totalBytes)}";
}
if (startedAt == null) {
return text;
}
final elapsed = DateTime.now().difference(startedAt);
final seconds = _clampedElapsedSeconds(elapsed);
if (seconds == 0) {
return text;
}
return "$text ${_formatStatusSecondCount(seconds)}";
}