NikuText class

Niku extension for Text

Style property builder for building Text

Example usage:

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

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, backgroundColor - 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
  • style - Apply text style to Text
  • theme - Apply text theme to Text
Inheritance
Available extensions

Constructors

NikuText(String _text, {Key? key})
Niku extension for Text

Properties

getMb double
no setterinherited
getMl double
no setterinherited
getMr double
no setterinherited
getMt double
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
final
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 background) 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(BuildContext context) Widget
    Apply styles and build Text as Widget
    override
    center() NikuText
    Set alignment to center
    clone(dynamic item) Map<String, dynamic>
    inherited
    color(Color color) NikuText
    Set color of text
    createElement() StatelessElement
    Creates a StatelessElement to manage this widget's location in the tree.
    inherited
    debugDescribeChildren() List<DiagnosticsNode>
    Returns a list of DiagnosticsNode objects describing this node's children.
    inherited
    debugFillProperties(DiagnosticPropertiesBuilder properties) → void
    Add additional properties associated with the node.
    inherited
    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
    internalBuild(Widget widget) Widget
    inherited
    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
    m(double margin) NikuCore
    Apply margin to top
    inherited
    margin(EdgeInsets padding) NikuCore
    Apply margin using EdgeInset
    inherited
    maxLines(int maxLines) NikuText
    Max line for text
    mb(double margin) NikuCore
    Apply margin to bottom
    inherited
    ml(double margin) NikuCore
    Apply margin to left side
    inherited
    mr(double margin) NikuCore
    Apply margin to right side
    inherited
    mt(double margin) NikuCore
    Apply margin to top
    inherited
    mx(double margin) NikuCore
    Apply margin to x axis
    inherited
    my(double margin) NikuCore
    Apply margin to y axis
    inherited
    niku() Niku
    Switch to Niku() property
    niku() Niku

    Available on Widget, provided by the NikuWidget extension

    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, double mt = 0, double ml = 0, double mb = 0, double mr = 0}) 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(TextStyle? theme) NikuText
    Apply text theme to Text
    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
    theme(BuildContext context, TextStyle? callback(TextTheme theme)) NikuText
    Apply text theme to Text
    toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
    Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
    inherited
    toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
    A string representation of this object.
    inherited
    toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
    Returns a string representation of this node and its descendants.
    inherited
    toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
    Returns a one-line detailed description of the object.
    inherited
    toStringShort() String
    A short, textual description of this widget.
    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