asHTML method

String asHTML({
  1. int? colorWidth,
  2. int? colorHeight,
  3. int colorMargin = 5,
  4. bool inlineBlock = false,
})

Returns a <div> with a visual palette of colors _basicColors.

Implementation

String asHTML(
    {int? colorWidth,
    int? colorHeight,
    int colorMargin = 5,
    bool inlineBlock = false}) {
  colorWidth ??= colorHeight;
  colorHeight ??= colorWidth;

  colorWidth ??= 20;
  colorHeight ??= colorWidth;

  var styleDisplay = inlineBlock ? 'display: inline-block ;' : '';

  var html = '<div style="$styleDisplay">';
  for (var color in _basicColors) {
    html +=
        '<div style="display: inline-block ; background-color: ${color.toString()} ; margin: ${colorMargin}px ; width: ${colorWidth}px ; height: ${colorHeight}px"></div>';
  }
  html += '</div>';

  return html;
}