NikuSelectableText class

Niku extension for SelectableText

Style property builder for building Selectable Text

Example usage:

NikuSelectableText("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 NikuSelectableText's property to current style
  • style() - Apply existing NikuSelectableText'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
  • textScaleFactor - The number of font pixels for each logical pixel
  • maxLines - Max line for text
  • 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

NikuSelectableText(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) NikuSelectableText
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() NikuSelectableText
Set alignment to center
alignEnd() NikuSelectableText
Set alignment to end, suitable for dynamic TextDirection
alignJustify() NikuSelectableText
Set alignment to justify
alignLeft() NikuSelectableText
Set alignment to left
alignRight() NikuSelectableText
Set alignment to right
alignStart() NikuSelectableText
Set alignment to start, suitable for dynamic TextDirection
alphabetic() NikuSelectableText
Using TextBaseline.alphabetic
apply(NikuSelectableText instance) NikuSelectableText
Apply existing NikuSelectableText's property to current style
background(Paint background) NikuSelectableText
  • forground - The paint drawn as a foreground for the text.
  • backgroundColor(Color backgroundColor) NikuSelectableText
    Set background color of text
    bg(Color backgroundColor) NikuSelectableText
    Set background color of text
    bold() NikuSelectableText
    Set font to bold, using FontWeight.bold
    build(BuildContext context) Widget
    Apply styles and build Text as Widget
    override
    center() NikuSelectableText
    Set alignment to center
    clone(dynamic item) Map<String, dynamic>
    inherited
    color(Color color) NikuSelectableText
    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() NikuSelectableText
    Set alignment to end, suitable for dynamic TextDirection
    fontFamily(String fontFamily) NikuSelectableText
    Apply font to text
    fontFamilyFallback(List<String> fontFamily) NikuSelectableText
    Apply font to text
    fontFeatures(List<FontFeature> fontFeatures) NikuSelectableText
    A feature tag and value that affect the selection of glyphs in a font
    fontSize(double fontSize) NikuSelectableText
    Set size of text
    fontStyle(FontStyle fontStyle) NikuSelectableText
    Whether to slant the glyphs in the font
    fontWeight(FontWeight fontWeight) NikuSelectableText
    The thickness of the glyphs used to draw the text
    foreground(Paint foreground) NikuSelectableText
  • forground - The paint drawn as a foreground for the text.
  • height(double height) NikuSelectableText
    Fixed height for text
    ideographic() NikuSelectableText
    Using TextBaseline.ideographic
    internalBuild(Widget widget) Widget
    inherited
    italic() NikuSelectableText
    Whether to slant the glyphs in the font
    justify() NikuSelectableText
    Set alignment to justify
    left() NikuSelectableText
    Set alignment to left
    letterSpacing(double letterSpacing) NikuSelectableText
    Spacing for each letter
    ltr() NikuSelectableText
    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) NikuSelectableText
    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
    Set alignment to right
    rtl() NikuSelectableText
    Use right-to-left direction
    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, double? textScaleFactor, int? maxLines, TextWidthBasis? textWidthBasis, TextHeightBehavior? textHeightBehavior, double mt = 0, double ml = 0, double mb = 0, double mr = 0}) NikuSelectableText
    shadows(List<Shadow> shadows) NikuSelectableText
    Collection of text's shadow
    start() NikuSelectableText
    Set alignment to start, suitable for dynamic TextDirection
    style(TextStyle? theme) NikuSelectableText
    Apply text theme to Text
    textAlign(TextAlign textAlign) NikuSelectableText
    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) NikuSelectableText
    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) NikuSelectableText
    Text decoration
    textDecorationColor(Color textDecorationColor) NikuSelectableText
    Color of text decoration
    textDecorationThickness(double textDecorationThickness) NikuSelectableText
    Thickness of text decoration
    textDirection(TextDirection textDirection) NikuSelectableText
    Set whether text is left-to-right or right-to-left direction.
    textHeightBehavior(TextHeightBehavior textHeightBehavior) NikuSelectableText
    Defines how the paragraph will apply TextStyle.height to the ascent of the first line and descent of the last line
    textScaleFactor(double textScaleFactor) NikuSelectableText
    The number of font pixels for each logical pixel
    textWidthBasis(TextWidthBasis textWidthBasis) NikuSelectableText
    Defines how to measure the width of the rendered text
    theme(BuildContext context, TextStyle? callback(TextTheme theme)) NikuSelectableText
    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() NikuSelectableText
    Use font weight of 100
    w200() NikuSelectableText
    Use font weight of 200
    w300() NikuSelectableText
    Use font weight of 300
    w400() NikuSelectableText
    Use font weight of 400
    w500() NikuSelectableText
    Use font weight of 500
    w600() NikuSelectableText
    Use font weight of 600
    w700() NikuSelectableText
    Use font weight of 700
    w800() NikuSelectableText
    Use font weight of 800
    w900() NikuSelectableText
    Use font weight of 900
    wordSpacing(double wordSpacing) NikuSelectableText
    Spacing for each word

    Operators

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