BeuiPlinko class
A responsive Plinko board with source-shaped peg bounces and payouts.
slots overrides rows. It must contain at least two values to render; otherwise the board is empty. Without custom slots, rows is clamped to at least one and payouts come from beuiPlinkoSlots.
Drops can overlap up to maxBalls. onLand is called once for every ball that lands. pegFlash and sound each support controlled and uncontrolled ownership. Sound controls only its preference and callback here; audible playback awaits the shared audio capability.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BeuiPlinko
Constructors
-
BeuiPlinko({int rows = 12, List<
BeuiPlinkoValue> ? slots, void onLand(int slot, BeuiPlinkoValue value)?, int maxBalls = 12, String dropLabel = 'Drop ball', bool? pegFlash, bool defaultPegFlash = true, ValueChanged<bool> ? onPegFlashChange, String pegFlashLabel = 'Peg flash', bool? sound, bool defaultSound = false, ValueChanged<bool> ? onSoundChange, String soundLabel = 'Sound', String semanticLabel = 'Plinko board', Key? key}) -
Creates a responsive board. The default board has 12 peg rows.
const
Properties
- defaultPegFlash → bool
-
Initial peg-flash state when uncontrolled. Defaults to true.
final
- defaultSound → bool
-
Initial sound preference when uncontrolled. Defaults to false.
final
- dropLabel → String
-
Drop-button label. Defaults to "Drop ball".
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxBalls → int
-
Maximum number of simultaneous flights. Defaults to 12.
final
- onLand → void Function(int slot, BeuiPlinkoValue value)?
-
Called once with the slot index and value when a ball lands.
final
-
onPegFlashChange
→ ValueChanged<
bool> ? -
Called when peg-flash preference changes.
final
-
onSoundChange
→ ValueChanged<
bool> ? -
Called when sound preference changes. It does not play audio.
final
- pegFlash → bool?
-
Controlled peg-flash state. Null uses defaultPegFlash.
final
- pegFlashLabel → String
-
Tooltip and accessible name of the peg-flash control.
final
- rows → int
-
Peg rows when slots is omitted. Defaults to 12.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String
-
Accessible name of the board. Defaults to "Plinko board".
final
-
slots
→ List<
BeuiPlinkoValue> ? -
Left-to-right labels or payouts. The count determines rows as count - 1.
final
- sound → bool?
-
Controlled sound preference. Null uses defaultSound.
final
- soundLabel → String
-
Tooltip and accessible name of the sound control.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< BeuiPlinko> -
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