AddToCartButton class

Help you create a button that is used to let the users can add items to their shopping cart. This will be useful for eCommerce app.

Inheritance

Constructors

AddToCartButton({Key? key, Duration duration = const Duration(milliseconds: 3000), required Widget trolley, required Widget text, required Widget check, required dynamic onPressed(AddToCartButtonStateId id), BorderRadius? borderRadius, Color? backgroundColor, double streetLineHeight = 2, double streetLineDashWidth = 12, double trolleyLeftMargin = 12, AddToCartButtonStateId stateId = AddToCartButtonStateId.idle})
Constructor Create an Add To Cart button.
const

Properties

backgroundColor Color?
backgroundColor : the button background color.
final
borderRadius BorderRadius?
By default, this is designed as a RoundedRectangleBorder button, borderRadius helps you fit this widget with your design.
final
check Widget
check : The icon is used for AddToCartButtonStateId.done state.
final
duration Duration
duration : The duration use to animate from AddToCartButtonStateId.loading state to AddToCartButtonStateId.done
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onPressed → dynamic Function(AddToCartButtonStateId id)
onPressed : The users only are able to press on this button on AddToCartButtonStateId.idle state (then this will be turned to AddToCartButtonStateId.loading state), and on AddToCartButtonStateId.done state (then this will be turned to AddToCartButtonStateId.idle state).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateId AddToCartButtonStateId
stateId : the current state of this button, its parent control this.
final
streetLineDashWidth double
final
streetLineHeight double
streetLineHeight & streetLineDashWidth & trolleyLeftMargin : are used to create the _RunningTrolley
final
text Widget
text : The text on center, it will be disappeared during AddToCartButtonStateId.loading state.
final
trolley Widget
trolley : The icon on the left side, see also _RunningTrolley
final
trolleyLeftMargin double
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _AddToCartButtonState
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}) 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