NikuButton class
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("Text Button"))
.bg(Colors.blue)
.px(40)
.py(20)
.rounded(8)
.my(8)
NikuButton.elevated(Text("Elevated Button"))
.bg(Colors.blue)
.px(40)
.py(20)
.rounded(8)
.my(8)
NikuButton.outlinedIcon(Text("Elevated 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
- elevated() - Build as ElevatedButton
- outlined() - Build as OutlinedButton
- icon() - Build as TextButton.icon
- elevatedIcon() - Build as ElevatedButton.icon
- outlinedIcon() - Build as OutlinedButton.icon
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
- highlight - Apply highlight color
- 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
- cursor, mouseCursor
-
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
-
label - Add label to IconButton
-
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
- alphabetic - Using TextBaseline.alphabetic
- ideographic - Using TextBaseline.ideographic
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- NikuCore
- NikuButton
- Available extensions
Constructors
- NikuButton(Widget child, {NikuButtonType type = NikuButtonType.Text, Key? key})
- Niku extension for Material various Button Including:
- NikuButton.elevated(Widget child, {Key? key})
-
factory
- NikuButton.elevatedIcon(Widget child, {Key? key})
-
factory
- NikuButton.icon(Widget child, {Key? key})
-
factory
- NikuButton.outlined(Widget child, {Key? key})
-
factory
- NikuButton.outlinedIcon(Widget child, {Key? key})
-
factory
Properties
- child → Widget
-
final
- getMb → double
-
no setterinherited
-
getMinimumSize
↔ NikuMaterialPropertyContainer<
Size> -
getter/setter pair
- getMl → double
-
no setterinherited
-
getMouseCursor
↔ NikuMaterialPropertyContainer<
MouseCursor> -
getter/setter pair
- 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
- type → NikuButtonType
-
final
Methods
-
align(
Alignment align) → NikuButton - Apply alignment to widget
-
alignment(
Alignment align) → NikuButton - Apply alignment to widget
-
alphabetic(
) → NikuButton - Using TextBaseline.alphabetic
-
animationDuration(
Duration duration) → NikuButton - Animaiton Duration of elevation effect
-
apply(
NikuButton instance) → NikuButton - Apply existing NikuButton's property to current style
-
autofocus(
bool autofocus) → NikuButton - Determine whether button should be auto focus
-
b(
BorderSide input) → NikuButton - Apply styling to border
-
backgroundColor(
{Color? base, Color? disabled, Color? dragged, Color? error, Color? focused, Color? hovered, Color? pressed, Color? selected}) → NikuButton - Apply color to background
-
bc(
Color color) → NikuButton - Apply styling to border color
-
bg(
Color color) → NikuButton - Apply color to background
-
bold(
) → NikuButton - Set font to bold, using FontWeight.bold
-
borderColor(
{Color base = Colors.black12, Color disabled = Colors.black12, Color dragged = Colors.black12, Color error = Colors.black12, Color focused = Colors.black12, Color hovered = Colors.black12, Color pressed = Colors.black12, Color selected = Colors.black12}) → NikuButton - Apply styling to border color
-
borderSide(
{BorderSide? base, BorderSide? disabled, BorderSide? dragged, BorderSide? error, BorderSide? focused, BorderSide? hovered, BorderSide? pressed, BorderSide? selected}) → NikuButton - Apply styling to border
-
borderStyle(
{BorderStyle base = BorderStyle.solid, BorderStyle disabled = BorderStyle.solid, BorderStyle dragged = BorderStyle.solid, BorderStyle error = BorderStyle.solid, BorderStyle focused = BorderStyle.solid, BorderStyle hovered = BorderStyle.solid, BorderStyle pressed = BorderStyle.solid, BorderStyle selected = BorderStyle.solid}) → NikuButton - Apply BorderStyle to border
-
borderWidth(
{double base = 1, double disabled = 1, double dragged = 1, double error = 1, double focused = 1, double hovered = 1, double pressed = 1, double selected = 1}) → NikuButton - Apply styling to border width
-
bottomCenter(
) → NikuButton - Apply widget to bottom center
-
bottomLeft(
) → NikuButton - Apply widget to bottom left
-
bottomRight(
) → NikuButton - Apply widget to bottom right
-
bs(
BorderStyle style) → NikuButton - Apply BorderStyle to border
-
build(
BuildContext context) → Widget -
Apply styles and build as TextButton
override
-
bw(
double width) → NikuButton - Apply styling to border width
-
center(
) → NikuButton - Apply widget to center
-
centerLeft(
) → NikuButton - Apply widget to center left
-
centerRight(
) → NikuButton - Apply widget to center right
-
clip(
Clip clip) → NikuButton - Apply clip to button
-
clone(
dynamic item) → Map< String, dynamic> -
inherited
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
cursor(
{MouseCursor? base, MouseCursor? disabled, MouseCursor? dragged, MouseCursor? error, MouseCursor? focused, MouseCursor? hovered, MouseCursor? pressed, MouseCursor? selected}) → NikuButton - Set cursor when hovered on widget
-
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
-
duration(
Duration duration) → NikuButton - Animaiton Duration of elevation effect
-
elevation(
{double? base, double? disabled, double? dragged, double? error, double? focused, double? hovered, double? pressed, double? selected}) → NikuButton - Apply elevation to button
-
fg(
Color base) → NikuButton - Apply color to foreground (ie. Text color)
-
focusNode(
FocusNode focusNode) → NikuButton - An object that can be used by a stateful widget to obtain the keyboard focus and to handle keyboard events
-
fontFamily(
String fontFamily) → NikuButton - Apply font to text
-
fontFamilyFallback(
List< String> fontFamily) → NikuButton - Apply font to text
-
fontFeatures(
List< FontFeature> fontFeatures) → NikuButton - A feature tag and value that affect the selection of glyphs in a font
-
fontSize(
double fontSize) → NikuButton - Set size of text
-
fontStyle(
FontStyle fontStyle) → NikuButton - Whether to slant the glyphs in the font
-
fontWeight(
FontWeight fontWeight) → NikuButton - The thickness of the glyphs used to draw the text
-
foregroundColor(
{Color? base, Color? disabled, Color? dragged, Color? error, Color? focused, Color? hovered, Color? pressed, Color? selected}) → NikuButton - Apply color to foreground (ie. Text color)
-
highlight(
Color highlight) → NikuButton - Apply highlight color
-
ideographic(
) → NikuButton - Using TextBaseline.ideographic
-
immediate(
) → NikuButton - Immediate animation
-
internalBuild(
Widget widget) → Widget -
inherited
-
italic(
) → NikuButton - Whether to slant the glyphs in the font
-
label(
Widget label) → NikuButton - Add label to IconButton
-
letterSpacing(
double letterSpacing) → NikuButton - Spacing for each letter
-
m(
double margin) → NikuCore -
Apply margin to top
inherited
-
margin(
EdgeInsets padding) → NikuCore -
Apply margin using
EdgeInsetinherited -
mb(
double margin) → NikuCore -
Apply margin to bottom
inherited
-
minimumSize(
Size? base, Size? disabled, Size? dragged, Size? error, Size? focused, Size? hovered, Size? pressed, Size? selected) → NikuButton - Apply custom shape to button
-
minSize(
Size input) → NikuButton - Set minimum size of button
-
ml(
double margin) → NikuCore -
Apply margin to left side
inherited
-
mouseCursor(
{MouseCursor? base, MouseCursor? disabled, MouseCursor? dragged, MouseCursor? error, MouseCursor? focused, MouseCursor? hovered, MouseCursor? pressed, MouseCursor? selected}) → NikuButton - Set cursor when hovered on widget
-
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 as TextButton
-
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
-
onLongPressed(
VoidCallback callback) → NikuButton - Callback when button is long pressed
-
onPressed(
VoidCallback? callback) → NikuButton - Callback when button is pressed
-
overlay(
Color base) → NikuButton - Apply color to splash (ripple effect)
-
overlayColor(
{Color? base, Color? disabled, Color? dragged, Color? error, Color? focused, Color? hovered, Color? pressed, Color? selected}) → NikuButton - Apply color to button background
-
p(
double padding) → NikuButton - Apply padding to all side
-
padding(
EdgeInsets padding) → NikuButton -
Apply padding using
EdgeInset -
pb(
double padding) → NikuButton - Apply padding to bottom
-
pl(
double padding) → NikuButton - Apply padding to left side
-
pr(
double padding) → NikuButton - Apply padding to right
-
pt(
double padding) → NikuButton - Apply padding to top
-
px(
double padding) → NikuButton - Apply padding to x axis
-
py(
double padding) → NikuButton - Apply padding to y axis
-
rounded(
[double radius = 999999]) → NikuButton - Apply border radius to button, will override shape
-
s(
RoundedRectangleBorder input) → NikuButton - Apply custom shape to button
-
set(
{VoidCallback? onPressed, VoidCallback? onLongPressed, FocusNode? focusNode, bool autofocus = false, Clip clipBehavior = Clip.none, NikuMaterialPropertyContainer< Color> ? backgroundColor, NikuMaterialPropertyContainer<Color> ? foregroundColor, NikuMaterialPropertyContainer<Color> ? overlayColor, NikuMaterialPropertyContainer<Color> ? shadowColor, NikuMaterialPropertyContainer<double> ? elevation, double pt = 0, double pb = 0, double pl = 0, double pr = 0, double mt = 0, double mb = 0, double ml = 0, double mr = 0, NikuMaterialPropertyContainer<Size> ? minimumSize, NikuMaterialPropertyContainer<BorderSide> ? side, NikuMaterialPropertyContainer<RoundedRectangleBorder> ? shape, NikuMaterialPropertyContainer<MouseCursor> ? mouseCursor, VisualDensity? visualDensity, MaterialTapTargetSize? tapTargetSize, Duration? animationDuration, bool enableFeedback = false, AlignmentGeometry? alignment, Widget? label, NikuMaterialPropertyContainer<Color> ? text_color, Color? text_backgroundColor, double? text_fontSize, FontWeight? text_fontWeight, FontStyle? text_fontStyle, double? text_letterSpacing, double? text_wordSpacing, double? text_height, Paint? text_foreground, Paint? text_background, List<Shadow> ? text_shadows, List<FontFeature> ? text_fontFeatures, TextDecoration? text_textDecoration, Color? text_textDecorationColor, double? text_textDecorationThickness, String? text_fontFamily, List<String> ? text_fontFamilyFallback, TextBaseline? text_textBaseline}) → NikuButton -
shadow(
Color base) → NikuButton - Apply color to shadow of ElevatedButton
-
shadowColor(
{Color? base, Color? disabled, Color? dragged, Color? error, Color? focused, Color? hovered, Color? pressed, Color? selected}) → NikuButton - Apply color to shadow of ElevatedButton
-
shape(
{RoundedRectangleBorder? base, RoundedRectangleBorder? disabled, RoundedRectangleBorder? dragged, RoundedRectangleBorder? error, RoundedRectangleBorder? focused, RoundedRectangleBorder? hovered, RoundedRectangleBorder? pressed, RoundedRectangleBorder? selected}) → NikuButton - Apply custom shape to button
-
splash(
Color base) → NikuButton - Apply color to splash (ripple effect)
-
tapTargetSize(
MaterialTapTargetSize tapTargetSize) → NikuButton - Configures the tap target and layout size of certain Material widgets
-
textBackground(
Paint foreground) → NikuButton -
- background - The paint drawn as a background for the text.
-
textBackgroundColor(
Color backgroundColor) → NikuButton - Set background color of text
-
textBaseline(
TextBaseline textBaseline) → NikuButton - 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.
-
textBg(
Color backgroundColor) → NikuButton - Set background color of text
-
textColor(
{Color? base, Color? disabled, Color? dragged, Color? error, Color? focused, Color? hovered, Color? pressed, Color? selected}) → NikuButton - Set color of text
-
textColors(
Color color) → NikuButton - Set color of text
-
textDecoration(
TextDecoration textDecoration) → NikuButton - Text decoration
-
textDecorationColor(
Color textDecorationColor) → NikuButton - Color of text decoration
-
textDecorationThickness(
double textDecorationThickness) → NikuButton - Thickness of text decoration
-
textForeground(
Paint foreground) → NikuButton -
- forground - The paint drawn as a foreground for the text.
-
textHeight(
double height) → NikuButton - Fixed height for text
-
textShadows(
List< Shadow> shadows) → NikuButton - Collection of text's shadow
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
topCenter(
) → NikuButton - Apply widget to top center
-
topLeft(
) → NikuButton - Apply widget to top left
-
topRight(
) → NikuButton - Apply widget to top right
-
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
-
visualDensity(
VisualDensity visualDensity) → NikuButton - Defines the visual density of user interface components.
-
w100(
) → NikuButton - Use font weight of 100
-
w200(
) → NikuButton - Use font weight of 200
-
w300(
) → NikuButton - Use font weight of 300
-
w400(
) → NikuButton - Use font weight of 400
-
w500(
) → NikuButton - Use font weight of 500
-
w600(
) → NikuButton - Use font weight of 600
-
w700(
) → NikuButton - Use font weight of 700
-
w800(
) → NikuButton - Use font weight of 800
-
w900(
) → NikuButton - Use font weight of 900
-
wordSpacing(
double wordSpacing) → NikuButton - Spacing for each word
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited