Skip to content

Dart-Docs for grouping of constants. #2783

Closed
@terrylucas

Description

@terrylucas

I've many groups of constants and would like to see similar constants grouped and sorted together. Some argument sake I'm using [+group name] as the Dart-doc for grouping/sorting. Notice that a constant can be used in multiple groups (see NORMAL). For example:

class Font {
  /** [+Font style][+Font variant][+Font weight] [NORMAL] default. /
  static final String NORMAL = "normal";
  /
* [+Font style] [ITALIC] right-slant font (if it exist). /
  static final String ITALIC = "italic";
  /
* [+Font style] [OBLIQUE] generate right-slant font. */
  static final String OBLIQUE = "oblique";

  /** [+Font variant] [SMALL_CAPS] lowercase characters in smaller cap font. */
  static final String SMALL_CAPS = "small-caps";

  /** [+Font weight] [NORMAL_BOLD] bold thickness. */
  static final int BOLD_WEIGHT = 700;

  /** [+Generic family] sans-serif (w/o serifs). /
  static final String SANS_SERIF_GENERIC = "sans-serif";
  /
* [+Generic family] serif font. /
  static final String SERIF_GENERIC = "serif";
  /
* [+Generic family] fixed-width font. /
  static final String MONOSPACE_GENERIC = "monospace";
  /
* [+Generic family] emulate handwriting font. /
  static final String CURSIVE_GENERIC = "cursive";
  /
* [+Generic family] decorative font. */
  static final String FANTASY_GENERIC = "fantasy";
}

Would like output to be:

Font Style
  ITALIC right-slant font (if it exist).
  NORMAL default.
  OBLIQUE generate right-slant font.

Font Variant
  NORMAL default.
  SMALL_CAPS lowercase characters in smaller cap font.

Font Weight
  NORMAL default.
  BOLD_WEIGHT bold thickness.

Generic family
  CURSIVE_GENERIC emulate handwriting font.
  FANTASY_GENERIC decorative font.
  MONOSPACE_GENERIC fixed-width font.
  SANS_SERIF_GENERIC sans-serif font.
  SERIF_GENERIC serif font.

Also, would be nice to somehow bind a parameter name in a method to the group for example:

class Font {
  num weight;
  String style;

  /**
   * [weight [+Font weight]] [style [+Font style]] [family [+Generic family][+Serif family][+Sans-serif family]]
  Font([this.weight, this.style, this.family]);
}

So that weight, style and family are bookmarks to the appropriate definition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions