DsButton class
A design-system button that wraps the M3 button family.
All color decisions are delegated to the active ThemeData — specifically
filledButtonTheme, outlinedButtonTheme, and textButtonTheme configured
in BaseTheme. No color is hardcoded here.
// Primary CTA
DsButton(label: 'Get started', onPressed: _submit)
// Expanded width with loading state
DsButton(
label: 'Save',
onPressed: _save,
isLoading: _isSaving,
isExpanded: true,
)
// Outlined with icon
DsButton(
label: 'Share',
variant: DsButtonVariant.outlined,
icon: const Icon(Icons.share_outlined, size: 18),
onPressed: _share,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- DsButton
Constructors
- DsButton({Key? key, required String label, required VoidCallback? onPressed, DsButtonVariant variant = DsButtonVariant.filled, Widget? icon, bool isLoading = false, bool isExpanded = false})
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → Widget?
-
Optional leading icon shown before the label.
final
- isExpanded → bool
-
When
true, the button stretches to fill available horizontal space.final - isLoading → bool
-
When
true, replaces the label with a CircularProgressIndicator and disables the button.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String
-
final
- onPressed → VoidCallback?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- variant → DsButtonVariant
-
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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