Button

button

Buttons initiate app-specific actions, have customizable backgrounds, and can include a title, icon or both. Buttons can be styled with several attributes to look a specific way.

Usage

XelaButton(
    onPressed: (){ /*TODO*/ },
    leftIcon: Icon(Icons.bookmark, size: 20, color: Colors.white),
    text: "Bookmark",
    size: XelaButtonSize.MEDIUM,
    background: XelaColor.Blue3,
    foregroundColor: Colors.white,
)

Properties

Name Type Default Value Required Description
text String? null NO Label text for button
onPressed GestureTapCallback - YES Action func for button
leftIcon Widget? null NO Left Icon widget
rightIcon Widget? null NO Right Icon widget
size XelaButtonSize XelaButtonSize.MEDIUM NO Size for button (LARGE, MEDIUM, SMALL)
state XelaButtonState XelaButtonState.DEFAULT NO State for button (DEFAULT, DISABLED)
type XelaButtonType XelaButtonType.PRIMARY NO Button type (PRIMARY, SECODARY)
background Color XelaColor.Blue NO Background color for button
foregroundColor Color Colors.white NO Foreground color for icons and text in button
defaultBorderColor Color XelaColor.Gray11 NO Default color for border in SECONDARY type button
autoResize Boolean true NO Button autoresize, if false button width equals button container width, else width equals button content width
borderLineWidth double 1 NO Border Line width
removePaddings bool false NO Remove insets paddings from button
horizontalAlignment MainAxisAlignment MainAxisAlignment.center NO Horizontal Alignment for content of button