NikuButton constructor

NikuButton(
  1. Widget child, {
  2. NikuButtonType type = NikuButtonType.Text,
  3. Key? key,
})

Niku extension for Material various Button Including:

  • TextButton
  • TextButton.icon
  • Elevated
  • Elevated.icon
  • OutlinedButton
  • OutlinedButton.icon

Style property builder for building Flat Button

Example usage:

NikuButton(Text("Flat Button"))
  .bg(Colors.blue)
  .px(40)
  .py(20)
  .rounded(8)
  .my(8)

NikuButton.elevated(Text("Flat Button"))
  .bg(Colors.blue)
  .px(40)
  .py(20)
  .rounded(8)
  .my(8)

Meta property list:

  • niku() - Switch to Niku() property
  • build() - Build as TextButton
  • apply() - Apply existing NikuFlatButton's property to current style

Factory Method

Style Property list:

  • onPressed - Callback when button is pressed

  • onLongPressed - Callback when button is long pressed

  • padding, p - Padding of container

    • padding, p - apply padding to all side
    • px - apply padding to x axis
    • py - apply padding y axis
    • pt - apply padding top side
    • pl - apply padding left side
    • pb - apply padding bottom side
    • pl - apply padding right side
  • margin, m - Padding of container

    • margin, m - apply margin to all side
    • mx - apply margin to x axis
    • my - apply margin y axis
    • mt - apply margin top side
    • ml - apply margin left side
    • mb - apply margin bottom side
    • ml - apply margin right side
  • backgroundColor, bg - Apply color to background

    • bg - Shorten form for applying to all button state
    • backgroundColor
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • foregroundColor, fg - Apply color to foreground (ie. Text color)

    • fg - Shorten form for applying to all button state
    • foregroundColor
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • overlay, splash, overlayColor - Apply color to splash (ripple effect)

    • overlay, splash - Shorten form for applying to all button state
    • overlayColor
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • shadow, shadowColor - Apply color to shadow of ElevatedButton

    • shadow - Shorten form for applying to all button state
    • shadowColor
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • elevation - Apply elevation to button

    • base
    • disabled
    • dragged
    • error
    • hovered
    • pressed
    • selected
  • borderSide, b - Apply styling to border

    • b - Shorten form for applying to all button state
    • border
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • borderWidth, bw - Apply width to border

    • bw - Shorten form for applying to all button state
    • borderWidth
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • borderColor, bc - Apply color to border

    • bc - Shorten form for applying to all button state
    • borderColor
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • borderStyle, bs - Apply BorderStyle to border

    • bs - Shorten form for applying to all button state
    • borderStyle
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • shape, s - Apply shape to button

    • s - Shorten form for applying to all button state
    • shape
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • cursor, mouseCursor - Apply cursor to border

    • cursor, mouseCursor
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • clip - Apply clip to button

  • autofocus - Determine whether button should be auto focus

  • cursor - Set cursor when hovered on widget

  • minSize, minimumSize - Set minimum size of button

    • minSize - Shorten form for applying to all button state
    • minimumSize
      • base
      • disabled
      • dragged
      • error
      • hovered
      • pressed
      • selected
  • animationDuration, duration - Animaiton Duration of elevation effect

  • focusNode - An object that can be used by a stateful widget to obtain the keyboard focus and to handle keyboard events

  • visualDensity - Defines the visual density of user interface components

  • tapTargetSize - Configures the tap target and layout size of certain Material widgets

  • rounded - Apply border radius to button, will override shape

  • textColor - 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

Implementation

NikuButton(
  this.child, {
  this.type = NikuButtonType.Text,
  this.key,
});