Piece class

Inheritance

Constructors

Piece({Key? key, required Widget child, required PartialMove move, bool draggable = true, bool interactible = true, double dragFeedbackSize = 2.0, Offset dragFeedbackOffset = const Offset(0.0, -1.0), VoidCallback? onTap, VoidCallback? onDragStarted, VoidCallback? onDragCancelled, void onDragEnd(DraggableDetails)?})
const

Properties

child Widget
A widget that represents the piece.
final
dragFeedbackOffset Offset
A vector to offset the position of dragged pieces by, relative to the size of the piece. No offset is recommended for web, and Offset(0,-1) for mobile, in which case the bottom of the piece will be anchored to the finger.
final
dragFeedbackSize double
The size of the piece being dragged will be multiplied by this. 1.5 is a good value for mobile, but 1.0 is preferable for web.
final
draggable bool
Whether the piece on this square can be dragged.
final
hashCode int
The hash code for this object.
no setterinherited
interactible bool
Whether the piece can be interacted with. This must be false when any other piece is being dragged, to avoid the GestureDetector absorbing the drag.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
move PartialMove
A single-character symbol representing the piece of the square. e.g. 'N', 'k'.
final
onDragCancelled VoidCallback?
Called when a drag is cancelled.
final
onDragEnd → (void Function(DraggableDetails)?)
Called when a drag ends, i.e. it was dropped on a target.
final
onDragStarted VoidCallback?
Called when a drag is started.
final
onTap VoidCallback?
Called when the piece is tapped.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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}) 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