getListMarkerText method

String getListMarkerText(
  1. String type,
  2. int i
)

Returns marker text for the specified list style type at index i.

Implementation

String getListMarkerText(String type, int i) {
  switch (type) {
    case kCssListStyleTypeAlphaLower:
    case kCssListStyleTypeAlphaLatinLower:
      if (i >= 1 && i <= 26) {
        // the specs said it's unspecified after the 26th item
        // TODO: generate something like aa, ab, etc. when needed
        return '${String.fromCharCode(96 + i)}.';
      }
      return '';
    case kCssListStyleTypeAlphaUpper:
    case kCssListStyleTypeAlphaLatinUpper:
      if (i >= 1 && i <= 26) {
        // the specs said it's unspecified after the 26th item
        // TODO: generate something like AA, AB, etc. when needed
        return '${String.fromCharCode(64 + i)}.';
      }
      return '';
    case kCssListStyleTypeDecimal:
      return '$i.';
    case kCssListStyleTypeRomanLower:
      final roman = _getListMarkerRoman(i)?.toLowerCase();
      return roman != null ? '$roman.' : '';
    case kCssListStyleTypeRomanUpper:
      final roman = _getListMarkerRoman(i);
      return roman != null ? '$roman.' : '';
    case kCssListStyleTypeNone:
    default:
      return '';
  }
}