NikuText class

Niku extension for Text

Style property builder for building Text

Example usage:

NikuText("Text")
  .color(Colors.blue)
  .fontSize(21)
  .build()

Meta property list:

  • niku() - Switch to Niku() property
  • build() - Apply styles and build Text as Widget
  • apply() - Apply existing NikuText's property to current style
  • style() - Apply existing NikuText's property to current style and build

Style Property list:

  • text - Set text
  • color - Color of text
  • bg, background - Background color of text
  • fontSize - Set text size
  • fontWeight - Font weight
    • fontWeight - Set font weight of text
    • bold - Set font to bold, equivalent to w700()
    • w100 - Use font weight of 100
    • w200 - Use font weight of 200
    • w300 - Use font weight of 300
    • w400 - Use font weight of 400
    • w500 - Use font weight of 500
    • w600 - Use font weight of 600
    • w700 - Use font weight of 700
    • w800 - Use font weight of 800
    • w900 - Use font weight of 900
  • fontWeight - The thickness of the glyphs used to draw the text
  • fontStyle - Whether to slant the glyphs in the font
    • fontStyle - Use FontStyle to apply
    • italic - Use italic style
  • letterSpacing - Spacing for each letter
  • wordSpacing - Spacing for each word
  • textBaseline - A horizontal line used for aligning text
  • height - Fixed height for text
  • forground - The paint drawn as a foreground for the text.
  • background - The paint drawn as a background for the text.
  • shadows - Collection of text's shadow
  • fontFeatures - A feature tag and value that affect the selection of glyphs in a font
  • textDecoration - Text decoration
  • textDecorationColor - Text decoration's color
  • textDecorationThickness - Thickness of decoration
  • fontFamily - Apply font to text
  • fontFamilyFallback - Fallback for font family
  • textAlign, align - Set alignment of text
    • alignLeft, left - Set alignment to left
    • alignCenter, center - Set alignment to center
    • alignRight, right - Set alignment to right
    • alignStart, start - Set alignment to start, suitable for dynamic TextDirection
    • alignEnd, end - Set alignment to end, suitable for dynamic TextDirection
    • alignJustify, justify - Set alignment to justify
  • textDirection - Set whether text is left-to-right or right-to-left direction.
    • textDirection - Set textDirection by using TextDirection
    • ltr - Use left-to-right direction
    • rtl - Use right-to-left direction
  • locale - Set locale languages of text
  • softWrap - Whether the text should break at soft line breaks.
  • overflow - How visual overflow should be handled
  • textScaleFactor - The number of font pixels for each logical pixel
  • maxLines - Max line for text
  • semanticsLabel, label - Semantics label for text, good for screen reader
  • textWidthBasis - Defines how to measure the width of the rendered text
  • textHeightBehavior - Defines how the paragraph will apply TextStyle.height to the ascent of the first line and descent of the last line

Constructors

NikuText(String _text)
Niku extension for Text

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

align(TextAlign textAlign) NikuText
The common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box.
alignCenter() NikuText
Set alignment to center
alignEnd() NikuText
Set alignment to end, suitable for dynamic TextDirection
alignJustify() NikuText
Set alignment to justify
alignLeft() NikuText
Set alignment to left
alignRight() NikuText
Set alignment to right
alignStart() NikuText
Set alignment to start, suitable for dynamic TextDirection
alphabetic() NikuText
Using TextBaseline.alphabetic
apply(NikuText instance) NikuText
Apply existing NikuText's property to current style
background(Paint foreground) NikuText
  • forground - The paint drawn as a foreground for the text.
  • backgroundColor(Color backgroundColor) NikuText
    Set background color of text
    bg(Color backgroundColor) NikuText
    Set background color of text
    bold() NikuText
    Set font to bold, using FontWeight.bold
    build({Key? key}) Text
    Apply styles and build Text as Widget
    center() NikuText
    Set alignment to center
    color(Color color) NikuText
    Set color of text
    end() NikuText
    Set alignment to end, suitable for dynamic TextDirection
    fontFamily(String fontFamily) NikuText
    Apply font to text
    fontFamilyFallback(List<String> fontFamily) NikuText
    Apply font to text
    fontFeatures(List<FontFeature> fontFeatures) NikuText
    A feature tag and value that affect the selection of glyphs in a font
    fontSize(double fontSize) NikuText
    Set size of text
    fontStyle(FontStyle fontStyle) NikuText
    Whether to slant the glyphs in the font
    fontWeight(FontWeight fontWeight) NikuText
    The thickness of the glyphs used to draw the text
    foreground(Paint foreground) NikuText
  • forground - The paint drawn as a foreground for the text.
  • height(double height) NikuText
    Fixed height for text
    ideographic() NikuText
    Using TextBaseline.ideographic
    italic() NikuText
    Whether to slant the glyphs in the font
    justify() NikuText
    Set alignment to justify
    label(String semanticsLabel) NikuText
    Semantics label for text, good for screen reader
    left() NikuText
    Set alignment to left
    letterSpacing(double letterSpacing) NikuText
    Spacing for each letter
    locale(Locale locale) NikuText
    Set locale languages of text
    ltr() NikuText
    Use left-to-right direction
    maxLines(int maxLines) NikuText
    Max line for text
    niku() Niku
    Switch to Niku() property
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    overflow(TextOverflow overflow) NikuText
    How visual overflow should be handled
    Set alignment to right
    rtl() NikuText
    Use right-to-left direction
    semanticsLabel(String semanticsLabel) NikuText
    Semantics label for text, good for screen reader
    set({Color? color, Color? backgroundColor, double? fontSize, FontWeight? fontWeight, FontStyle? fontStyle, double? letterSpacing, double? wordSpacing, TextAlign? textAlign, double? height, Paint? foreground, Paint? background, List<Shadow>? shadows, List<FontFeature>? fontFeatures, TextDecoration? textDecoration, Color? textDecorationColor, double? textDecorationThickness, String? fontFamily, List<String>? fontFamilyFallback, TextBaseline? textBaseline, TextDirection? textDirection, Locale? locale, bool? softWrap, TextOverflow? overflow, double? textScaleFactor, int? maxLines, String? semanticsLabel, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior}) NikuText
    shadows(List<Shadow> shadows) NikuText
    Collection of text's shadow
    softWrap(bool softWrap) NikuText
    Whether the text should break at soft line breaks.
    start() NikuText
    Set alignment to start, suitable for dynamic TextDirection
    style(NikuText instance) Widget
    Apply existing NikuText's property to current style and build
    text(String text) NikuText
    Set text content
    textAlign(TextAlign textAlign) NikuText
    The common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box.
    textBaseline(TextBaseline textBaseline) NikuText
    The common baseline that should be aligned between this text span and its parent text span, or, for the root text spans, with the line box.
    textDecoration(TextDecoration textDecoration) NikuText
    Text decoration
    textDecorationColor(Color textDecorationColor) NikuText
    Color of text decoration
    textDecorationThickness(double textDecorationThickness) NikuText
    Thickness of text decoration
    textDirection(TextDirection textDirection) NikuText
    Set whether text is left-to-right or right-to-left direction.
    textHeightBehavior(TextHeightBehavior textHeightBehavior) NikuText
    Defines how the paragraph will apply TextStyle.height to the ascent of the first line and descent of the last line
    textScaleFactor(double textScaleFactor) NikuText
    The number of font pixels for each logical pixel
    textWidthBasis(TextWidthBasis textWidthBasis) NikuText
    Defines how to measure the width of the rendered text
    toString() String
    A string representation of this object.
    inherited
    w100() NikuText
    Use font weight of 100
    w200() NikuText
    Use font weight of 200
    w300() NikuText
    Use font weight of 300
    w400() NikuText
    Use font weight of 400
    w500() NikuText
    Use font weight of 500
    w600() NikuText
    Use font weight of 600
    w700() NikuText
    Use font weight of 700
    w800() NikuText
    Use font weight of 800
    w900() NikuText
    Use font weight of 900
    wordSpacing(double wordSpacing) NikuText
    Spacing for each word

    Operators

    operator ==(Object other) bool
    The equality operator.
    inherited