DsButton class

A Designsystemet button with primary, secondary, and tertiary variants.

Supports loading state (shows spinner), icon placement, and inherits color/size from DsColorScope/DsSizeScope when not set explicitly.

Inheritance

Constructors

DsButton({Key? key, required Widget child, VoidCallback? onPressed, DsButtonVariant variant = DsButtonVariant.primary, DsSize? size, DsColor? color, bool disabled = false, bool loading = false, Widget? icon, DsIconPosition iconPosition = DsIconPosition.left, FocusNode? focusNode, bool autofocus = false})
const

Properties

autofocus bool
Whether this button should request focus when it is first inserted into the tree. Forwarded to the underlying Focus widget. Defaults to false.
final
child Widget
Innholdet i knappen, vanligvis en DsParagraph eller Text.
final
color DsColor?
Fargetema for knappen. Faller tilbake til omgivende DsColorScope når null.
final
disabled bool
Om knappen er deaktivert (ikke-interaktiv og nedtonet).
final
focusNode FocusNode?
Valgfri fokusnode for å styre knappens fokus eksternt.
final
hashCode int
The hash code for this object.
no setterinherited
icon Widget?
Valgfritt ikon som vises sammen med child.
final
iconPosition DsIconPosition
Om icon plasseres før eller etter child. Standard er til venstre.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loading bool
Om knappen viser en spinner i stedet for innholdet og blokkerer interaksjon.
final
onPressed VoidCallback?
Kalles når knappen trykkes eller aktiveres med Enter/Mellomrom. Når null, vises knappen som deaktivert.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size DsSize?
Størrelse på knappen. Faller tilbake til omgivende DsSizeScope når null.
final
variant DsButtonVariant
Visuell variant: primær (fylt), sekundær (omriss) eller tertiær.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<DsButton>
Creates the mutable state for this widget at a given location in the tree.
override
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
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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

Operators

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