Niku Button
Style property builder for building various type of button, including:
- TextButton
- TextButton.icon
- ElevatedButton
- ElevatedButton.icon
- OutlinedButton
- OutlinedButton.icon
Example usage:
As Widget
NikuButton("As widget")
..color(Colors.blue)
..fontSize(21)
As Property
TextButton("As Property")
.asNiku()
..bg(Colors.blue)
..fontSize(21)
Availability
To use this widget, you can import from the following:
// All Widget
import 'package:niku/niku.dart';
// Extension
import 'package:niku/extension/widget.dart';
// Just widget
import 'package:niku/widget/button.dart';
Factory Method
Factory method for composing button consists of 5 as the following:
- .icon
- .elevated
- .elevatedIcon
- .outlined
- outlinedIcon
Where default is TextButton.
Example Usage
NikuButton(
Text("Text Button")
);
NikuButton.elevated(
Text("Elevated Button")
);
OutlinedButton(
child: Text("With Niku"),
onPressed: log,
)
.asNiku()
niku
Switch to use parent property builder.
Example Usage:
NikuText()
.niku();
Equivalent to
Niku(
Text(),
);
apply
Apply predefined style properties to widget.
Example Usage:
final title = NikuText()
..color(Colors.red)
..fontSize(21);
NikuText()
..apply(title);
Equivalent to
Text()
..color(Colors.red)
..fontSize(21);
onPressed
Callback when button is pressed.
Example Usage:
NikuButton()
..onPressed(() {
print("Clicked");
}));
Equivalent to
TextButton(
onPressed: input,
);
onLongPressed
Callback when button is long pressed.
Example Usage:
NikuButton()
..onLongPressed(() {
print("Long pressed");
}));
Equivalent to
TextButton(
onLongPressed: input,
);
padding
Apply padding using EdgeInsets.
Example Usage:
NikuButton()
..padding(EdgeInsets.all(20));
Equivalent to
TextButton(
padding: input,
);
p
Shorten syntax of padding
Apply padding to all side.
Example Usage:
NikuButton()
..p(20);
Equivalent to
TextButton(
padding: EdgeInsets.all(input),
);
px
Shorten syntax of padding
Apply padding to x-axis.
Example Usage:
NikuButton()
..px(20);
Equivalent to
TextButton(
padding: EdgeInsets.symmetric(horizontal: input),
);
py
Shorten syntax of padding
Apply padding to y-axis.
Example Usage:
NikuButton()
..px(20);
Equivalent to
TextButton(
padding: EdgeInsets.symmetric(vertical: input),
);
pt
Shorten syntax of padding
Apply padding to top.
Example Usage:
NikuButton()
..pt(20);
Equivalent to
TextButton(
padding: EdgeInsets.only(top: input),
);
pb
Shorten syntax of padding
Apply padding to bottom.
Example Usage:
NikuButton()
..pb(20);
Equivalent to
TextButton(
padding: EdgeInsets.only(bottom: input),
);
pl
Shorten syntax of padding
Apply padding to left.
Example Usage:
NikuButton()
..pl(20);
Equivalent to
TextButton(
padding: EdgeInsets.only(left: input),
);
pr
Shorten syntax of padding
Apply padding to right.
Example Usage:
NikuButton()
..pr(20);
Equivalent to
TextButton(
padding: EdgeInsets.only(right: input),
);
alignment
Apply alignment to widget.
Example Usage:
NikuButton()
..alignment(Alignment.topLeft);
Equivalent to
TextButton(
alignment: input,
);
align
Apply alignment to widget.
Example Usage:
NikuButton()
..align(Alignment.topLeft);
Equivalent to
TextButton(
alignment: input,
);
topLeft
Shorten syntax of align
Apply alignment to widget as Alignment.topLeft
Example Usage:
NikuButton()
..topLeft();
Equivalent to
TextButton(
alignment: Alignment.topLeft,
);
topCenter
Shorten syntax of align
Apply alignment to widget as Alignment.topLeft
Example Usage:
NikuButton()
..topCenter();
Equivalent to
TextButton(
alignment: Alignment.topCenter,
);
topRight
Shorten syntax of align
Apply alignment to widget as Alignment.topRight
Example Usage:
NikuButton()
..topRight();
Equivalent to
TextButton(
alignment: Alignment.topRight,
);
centerLeft
Shorten syntax of align
Apply alignment to widget as Alignment.centerLeft
Example Usage:
NikuButton()
..centerLeft();
Equivalent to
TextButton(
alignment: Alignment.centerLeft,
);
center
Shorten syntax of align
Apply alignment to widget as Alignment.centerLeft
Example Usage:
NikuButton()
..center();
Equivalent to
TextButton(
alignment: Alignment.center,
);
centerRight
Shorten syntax of align
Apply alignment to widget as Alignment.centerRight
Example Usage:
NikuButton()
..centerRight();
Equivalent to
TextButton(
alignment: Alignment.centerRight,
);
bottomLeft
Shorten syntax of align
Apply alignment to widget as Alignment.bottomLeft
Example Usage:
NikuButton()
..bottomLeft();
Equivalent to
TextButton(
alignment: Alignment.bottomLeft,
);
bottomCenter
Shorten syntax of align
Apply alignment to widget as Alignment.bottomLeft
Example Usage:
NikuButton()
..bottomCenter();
Equivalent to
TextButton(
alignment: Alignment.bottomCenter,
);
bottomRight
Shorten syntax of align
Apply alignment to widget as Alignment.bottomRight
Example Usage:
NikuButton()
..bottomRight();
Equivalent to
TextButton(
alignment: Alignment.bottomRight,
);
backgroundColor
Apply color to background providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..backgroundColor(
base: Colors.blue,
disabled: Colors.blue.shade200,
);
Equivalent to
TextButton(
backgroundColor: MaterialStateProperty.resolveWith<T>((states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
bg
Shorten syntax of backgroundColor
Apply color to background for all MaterialStateProperty.
Example Usage:
NikuButton()
..bg(Colors.blue);
Equivalent to
TextButton(
backgroundColor: MaterialStateProperty.resolveWith<T>((_states) {
return input;
});
);
highlight
Mimick old material button 'highlight' properrty.
Example Usage:
NikuButton()
..highlight(
Colors.blue.withOpacity(.1)
);
Equivalent to
TextButton(
backgroundColor: MaterialStateProperty.resolveWith<T>((states) {
if (states.contains(MaterialState.focused)) return input;
if (states.contains(MaterialState.hovered)) return input;
if (states.contains(MaterialState.pressed)) return input;
if (states.contains(MaterialState.selected)) return input;
return input;
});
);
foregroundColor
Apply color to foreground, ie. Text Color, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..foregroundColor(
base: Colors.blue,
disabled: Colors.blue.shade200,
);
Equivalent to
TextButton(
foregroundColor: MaterialStateProperty.resolveWith<T>((states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
fg
Shorten syntax of foregroundColor
Apply color to foreground, ie. Text Color.
Example Usage:
NikuButton()
..fg(Colors.blue);
Equivalent to
TextButton(
foregroundColor: MaterialStateProperty.resolveWith<T>((_states) {
return input;
});
);
overlayColor
Apply color to splash (ripple effect) providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..overlay(
base: Colors.blue,
);
Equivalent to
TextButton(
overlayColor: MaterialStateProperty.resolveWith<T>((_states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
overlay
Shorten syntax of overlayColor
Apply color to splash (ripple effect) to all MaterialStateProperty.
Example Usage:
NikuButton()
..overlay(Colors.blue);
Equivalent to
TextButton(
overlayColor: MaterialStateProperty.resolveWith<T>((_states) {
return input;
});
);
splash
Shorten syntax of splash
Apply color to splash (ripple effect) to all MaterialStateProperty.
Example Usage:
NikuButton()
..splash(Colors.blue);
Equivalent to
TextButton(
overlayColor: MaterialStateProperty.resolveWith<T>((_states) {
return input;
});
);
shadowColor
Apply color to shadow of ElevatedButton providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..shadowColor(
base: Colors.blue,
);
Equivalent to
ElevatedButton(
shadowColor: MaterialStateProperty.resolveWith<T>((_states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
shadow
Shorten syntax of shadowColor
Apply color to shadow of ElevatedButton to all MaterialStateProperty.
Example Usage:
NikuButton()
..shadow(Colors.blue);
Equivalent to
ElevatedButton(
shadow: MaterialStateProperty.resolveWith<T>((_states) {
return input;
});
);
elevation
Apply elevation to button, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..elevation(Colors.blue);
Equivalent to
TextButton(
elevation: MaterialStateProperty.resolveWith<T>((_states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
borderSide
Apply styling to border, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..borderSide(
base: BorderSide(
width: 1,
color: Colors.blue,
),
);
Equivalent to
TextButton(
borderSide: MaterialStateProperty.resolveWith<T>((_states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
b
Shorten syntax of borderSide
Apply styling to border, apply to all MaterialStateProperty.
Example Usage:
NikuButton()
..b(
BorderSide(
width: 1,
color: Colors.blue,
),
);
Equivalent to
TextButton(
borderSide: MaterialStateProperty.resolveWith<T>((_states) {
return input;
});
);
borderWidth
Apply styling to border width, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..borderSide(
base: BorderSide(
width: 2,
color: Colors.blue,
),
);
Equivalent to
TextButton(
borderSide: MaterialStateProperty.resolveWith<T>((_states) {
if (states.contains(MaterialState.disabled)) return BorederSide(
width: disabled,
);
if (states.contains(MaterialState.dragged)) return BorederSide(
width: dragged,
);
if (states.contains(MaterialState.error)) return BorederSide(
width: error,
);
if (states.contains(MaterialState.focused)) return BorederSide(
width: focused,
);
if (states.contains(MaterialState.hovered)) return BorederSide(
width: hovered,
);
if (states.contains(MaterialState.pressed)) return BorederSide(
width: pressed,
);
if (states.contains(MaterialState.selected)) return BorederSide(
width: selected,
);
return base;
});
);
bw
Shorten syntax of borderWidth
Apply styling to border width, apply to all MaterialStateProperty.
Example Usage:
NikuButton()
..bw(2);
Equivalent to
TextButton(
borderSide: MaterialStateProperty.resolveWith<T>((_states) {
return BorderSide(
width: input,
);
});
);
borderColor
Apply styling to border color, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..borderSide(
base: BorderSide(
color: 2,
color: Colors.blue,
),
);
Equivalent to
TextButton(
borderSide: MaterialStateProperty.resolveWith<T>((_states) {
if (states.contains(MaterialState.disabled)) return BorederSide(
color: disabled,
);
if (states.contains(MaterialState.dragged)) return BorederSide(
color: dragged,
);
if (states.contains(MaterialState.error)) return BorederSide(
color: error,
);
if (states.contains(MaterialState.focused)) return BorederSide(
color: focused,
);
if (states.contains(MaterialState.hovered)) return BorederSide(
color: hovered,
);
if (states.contains(MaterialState.pressed)) return BorederSide(
color: pressed,
);
if (states.contains(MaterialState.selected)) return BorederSide(
color: selected,
);
return base;
});
);
bc
Shorten syntax of borderColor
Apply styling to border color, apply to all MaterialStateProperty.
Example Usage:
NikuButton()
..bw(2);
Equivalent to
TextButton(
borderSide: MaterialStateProperty.resolveWith<T>((_states) {
return BorderSide(
color: input,
);
});
);
borderStyle
Apply styling to border style, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..borderSide(
base: BorderSide(
style: 2,
style: Styles.blue,
),
);
Equivalent to
TextButton(
borderSide: MaterialStateProperty.resolveWith<T>((_states) {
if (states.contains(MaterialState.disabled)) return BorederSide(
style: disabled,
);
if (states.contains(MaterialState.dragged)) return BorederSide(
style: dragged,
);
if (states.contains(MaterialState.error)) return BorederSide(
style: error,
);
if (states.contains(MaterialState.focused)) return BorederSide(
style: focused,
);
if (states.contains(MaterialState.hovered)) return BorederSide(
style: hovered,
);
if (states.contains(MaterialState.pressed)) return BorederSide(
style: pressed,
);
if (states.contains(MaterialState.selected)) return BorederSide(
style: selected,
);
return base;
});
);
bs
Shorten syntax of borderStyle
Apply styling to border style, apply to all MaterialStateProperty.
Example Usage:
NikuButton()
..bw(2);
Equivalent to
TextButton(
borderSide: MaterialStateProperty.resolveWith<T>((_states) {
return BorderSide(
style: input,
);
});
);
shape
Apply custom shape to button, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..shape(
base: RoundedRectangleBorder(
side: BorderSide.none,
),
);
Equivalent to
TextButton(
shape: MaterialStateProperty.resolveWith<T>((states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
s
Shorten syntax of shape
Apply custom shape to button, providing all MaterialStateProperty.
Example Usage:
NikuButton()
..s(
RoundedRectangleBorder(
side: BorderSide.none,
),
);
Equivalent to
TextButton(
shape: MaterialStateProperty.resolveWith<T>((states) {
return input;
});
);
mouseCursor
Set cursor when hovered on widget, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..mouseCursor(
disabled: MouseCursor.uncontrolled,
);
Equivalent to
TextButton(
mouseCursor: MaterialStateProperty.resolveWith<T>((states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
cursor
Shorten syntax of mouseCursor
Set cursor when hovered on widget, providing all MaterialStateProperty.
Example Usage:
NikuButton()
..cursor(MouseCursor.uncontrolled);
Equivalent to
TextButton(
cursor: MaterialStateProperty.resolveWith<T>((_states) {
return input;
});
);
clip
Set clip behavior of widget.
Example Usage:
NikuButton()
..clip(Clip.antiAlias);
Equivalent to
NikuButton(
clipBehavior: input,
);
autofocus
Determine whether button should be auto focus.
Example Usage:
NikuButton()
..autofocus(true);
Equivalent to
NikuButton(
autofocus: true
);
minimumSize
Set minimum size of button, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..minimumSize(
base: 160,
);
Equivalent to
TextButton(
minimumSize: MaterialStateProperty.resolveWith<T>((states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
);
minSize
Shorten syntax of minimumSize
Set cursor when hovered on widget, providing all MaterialStateProperty.
Example Usage:
NikuButton()
..minSize(160);
Equivalent to
TextButton(
minimumSize: MaterialStateProperty.resolveWith<T>((_states) {
return input;
});
);
animationDuration
Set Animaiton Duration of elevation effect.
Example Usage:
NikuButton()
..animationDuration(
Duration(milliseconds: 150),
);
Equivalent to
TextButton(
animationDuration: input,
);
duration
Shorten syntax of animationDuration
Set Animaiton Duration of elevation effect.
Example Usage:
NikuButton()
..duration(
Duration(milliseconds: 150),
);
Equivalent to
TextButton(
animationDuration: input,
);
immediate
Shorten syntax of animationDuration
Set Animaiton Duration of elevation effect.
Using Duration.zero.
Example Usage:
NikuButton()
..immediate();
Equivalent to
TextButton(
animationDuration: Duration.zero,
);
focusNode
An object that can be used by a stateful widget to obtain the keyboard focus and to handle keyboard events.
Example Usage:
NikuButton()
..focusNode(
FocusNode(
canRequestFocus: true,
),
);
Equivalent to
TextButton(
focusNode: input,
);
visualDensity
Defines the visual density of user interface components.
Example Usage:
NikuButton()
..visualDensity(
VisualDensity.adaptivePlatformDensity,
);
Equivalent to
TextButton(
visualDensity: input,
);
tapTargetSize
Configures the tap target and layout size of certain Material widgets.
Example Usage:
NikuButton()
..tapTargetSize(
MaterialTapTargetSize.padded,
);
Equivalent to
TextButton(
tapTargetSize: input,
);
rounded
Apply border radius to button, will override shape.
Default value will be complete rounded.
Example Usage:
NikuButton()
..rounded(8)
Equivalent to
TextButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(input),
),
);
label
Add label to IconButton
Example Usage:
NikuButton()
..tapTargetSize(
MaterialTapTargetSize.padded,
);
Equivalent to
IconButton(
label: input,
);
textColor
Set color of text, providing to each MaterialStateProperty.
The argument accept named paramters:
- base
- disabled
- dragged
- error
- focused
- hovered
- pressed
- selected
Example Usage:
NikuButton()
..textColor(
base: Colors.blue,
disabled: Colors.blue.shade200,
);
Equivalent to
TextButton(
textStyle: TextStyle(
colors: MaterialStateProperty.resolveWith<T>((states) {
if (states.contains(MaterialState.disabled)) return disabled;
if (states.contains(MaterialState.dragged)) return dragged;
if (states.contains(MaterialState.error)) return error;
if (states.contains(MaterialState.focused)) return focused;
if (states.contains(MaterialState.hovered)) return hovered;
if (states.contains(MaterialState.pressed)) return pressed;
if (states.contains(MaterialState.selected)) return selected;
return base;
});
)
);
textColors
Shorten syntax of textColor
Set color of text, providing to each MaterialStateProperty.
Example Usage:
NikuButton()
..textColors(Colors.blue);
Equivalent to
TextButton(
textStyle: TextStyle(
colors: MaterialStateProperty.resolveWith<T>((states) {
return input;
});
)
);
textBackgroundColor
Set background color.
Example Usage:
NikuButton()
..backgroundColor(Colors.red);
Equivalent to
TextButton(
textStyle: TextStyle(
backgroundColor: input,
),
);
textBg
Shorten syntax of backgroundColor
Set background color.
Example Usage:
NikuButton()
..bg(Colors.red);
Equivalent to
TextButton(
textStyle: TextStyle(
backgroundColor: input,
),
);
fontSize
Set font size.
Example Usage:
NikuButton()
..fontSize(21);
Equivalent to
TextButton(
textStyle: TextStyle(
fontSize: input,
),
);
fontWeight
Set font weight.
Example Usage:
NikuButton()
..fontWeight(fontWeight.bold);
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: input,
),
);
bold
Shorten syntax of fontWeight
Set font weight using FontWeight.bold.
Example Usage:
NikuButton()
..bold();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.bold,
),
);
w100
Shorten syntax of fontWeight
Set font weight using FontWeight.w100.
Example Usage:
NikuButton()
..w100();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w100,
),
);
w200
Shorten syntax of fontWeight
Set font weight using FontWeight.w200.
Example Usage:
NikuButton()
..w200();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w200,
),
);
w300
Shorten syntax of fontWeight
Set font weight using FontWeight.w300.
Example Usage:
NikuButton()
..w300();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w300,
),
);
w400
Shorten syntax of fontWeight
Set font weight using FontWeight.w400.
Example Usage:
NikuButton()
..w400();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w400,
),
);
w500
Shorten syntax of fontWeight
Set font weight using FontWeight.w500.
Example Usage:
NikuButton()
..w500();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w500,
),
);
w600
Shorten syntax of fontWeight
Set font weight using FontWeight.w600.
Example Usage:
NikuButton()
..w600();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w600,
),
);
w700
Shorten syntax of fontWeight
Set font weight using FontWeight.w700.
Example Usage:
NikuButton()
..w700();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w700,
),
);
w800
Shorten syntax of fontWeight
Set font weight using FontWeight.w800.
Example Usage:
NikuButton()
..w800();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w800,
),
);
w900
Shorten syntax of fontWeight
Set font weight using FontWeight.w900.
Example Usage:
NikuButton()
..w900();
Equivalent to
TextButton(
textStyle: TextStyle(
fontWeight: FontWeight.w900,
),
);
fontStyle
Set font style.
Example Usage:
NikuButton()
..fontStyle(FontStyle.italic);
Equivalent to
TextButton(
textStyle: TextStyle(
fontStyle: input,
),
);
italic
Shorten syntax of fontStyle
Set font weight using FontStyle.italic.
Example Usage:
NikuButton()
..italic();
Equivalent to
TextButton(
textStyle: TextStyle(
fontStyle: FontStyle.italic,
),
);
letterSpacing
Set letter spacing.
Example Usage:
NikuButton()
..letterSpacing(2);
Equivalent to
TextButton(
textStyle: TextStyle(
letterSpacing: input,
),
);
wordSpacing
Set word spacing.
Example Usage:
NikuButton()
..wordSpacing(2);
Equivalent to
TextButton(
textStyle: TextStyle(
wordSpacing: input,
),
);
textHeight
Set height.
Example Usage:
NikuButton()
..height(2);
Equivalent to
TextButton(
textStyle: TextStyle(
height: input,
),
);
textForeground
The paint drawn as a foreground for the text.
Example Usage:
final paint = Paint()..color = Colors.blue;
NikuButton()
..foreground(paint);
Equivalent to
TextButton(
textStyle: TextStyle(
foreground: input,
),
);
textBackground
The paint drawn as a foreground for the text.
Example Usage:
final paint = Paint()..color = Colors.blue;
NikuButton()
..background(paint);
Equivalent to
TextButton(
textStyle: TextStyle(
background: input,
),
);
textShadows
Collection of text's shadow.
Example Usage:
NikuButton()
..shadows([
Shadow(
offset: Offset(0, 4),
blurRadius: 8,
color: Colors.black.withOpacity(.1),
)
]);
Equivalent to
TextButton(
textStyle: TextStyle(
shadows: input,
),
);
fontFeature
A feature tag and value that affect the selection of glyphs in a font.
Example Usage:
NikuButton()
..fontFeatures([
FontFeature.enable('smcp'),
]);
Equivalent to
TextButton(
textStyle: TextStyle(
fontFeatures: input,
),
);
textDecoration
Add TextDecoration.
Example Usage:
NikuButton()
..textDecoration(TextDecoration.underline);
Equivalent to
TextButton(
textStyle: TextStyle(
textDecoration: input,
),
);
textDecorationColor
Set Color of text decoration
Example Usage:
NikuButton()
..textDecorationColor(Colors.blue);
Equivalent to
TextButton(
textStyle: TextStyle(textDecorationColor: input,
);
textDecorationThickness
Set thickness of text decoration
Example Usage:
NikuButton()
..textDecorationThickness(2);
Equivalent to
TextButton(
textStyle: TextStyle(
textDecorationThickness: input,
),
);
fontFamily
Set font of text.
Example Usage:
NikuButton()
..fontFamily('Helvetica Neue');
Equivalent to
TextButton(
textStyle: TextStyle(
fontFamily: input,
),
);
fontFamilyFallback
Set font fallback of text if fontFamily is missing.
Example Usage:
NikuButton()
..fontFamilyFallback([
'Roboto',
'Segoe UI',
'Open Sans',
]);
Equivalent to
TextButton(
textStyle: TextStyle(
fontFamilyFallback: input,
),
);
textBaseline
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.
Example Usage:
NikuButton()
..textBaseline(Textbaseline.alphabetic);
Equivalent to
TextButton(
textStyle: TextStyle(
textBaseline: input,
),
);
alphabetic
Shorten syntax of textBaseline
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.
Using Textbaseline.alphabetic
Example Usage:
NikuButton()
..alphabetic();
Equivalent to
TextButton(
textStyle: TextStyle(
textBaseline: Textbaseline.alphabetic,
),
);
ideographic
Shorten syntax of textBaseline
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.
Using Textbaseline.ideographic
Example Usage:
NikuButton()
..ideographic();
Equivalent to
TextButton(
textStyle: TextStyle(
textBaseline: Textbaseline.ideographic,
),
);