toMap method

Map<String, dynamic> toMap()

Converts the NyxTextFormat properties into a map of key-value pairs.

This method is useful for passing the text format options to platform-specific implementations. The map keys correspond to the text formatting properties, and the values are their respective settings.

Implementation

Map<String, dynamic> toMap() {
  return <String, dynamic>{
    'textSize': textSize,
    'underline': underline,
    'textScaleX': textScaleX,
    'textScaleY': textScaleY,
    'letterSpacing': letterSpacing,
    'lineSpacing': lineSpacing,
    'topPadding': topPadding,
    'leftPadding': leftPadding,
    'align': align == NyxAlign.left
        ? 0
        : align == NyxAlign.center
            ? 1
            : 2,
    'style': style == NyxFontStyle.normal
        ? 0
        : style == NyxFontStyle.bold
            ? 1
            : style == NyxFontStyle.italic
                ? 2
                : 3,
    'font': font == NyxFont.defaultFont
        ? 0
        : font == NyxFont.defaultBold
            ? 1
            : font == NyxFont.sansSerif
                ? 2
                : font == NyxFont.serif
                    ? 3
                    : 4,
  };
}