DialogueChoicesWidget class

Displays the current set of DialogueChoices and calls DialogueRunner.selectChoice when the player taps one.

Place this above DialogueBoxWidget in your stack:

Stack(
  children: [
    GameWidget(...),
    Positioned(
      left: 16, right: 16, bottom: 180,
      child: DialogueChoicesWidget(runner: runner),
    ),
    Positioned(
      left: 16, right: 16, bottom: 16,
      child: DialogueBoxWidget(runner: runner, onTap: runner.advance),
    ),
  ],
)

Unavailable choices (DialogueChoice.isAvailable == false) are shown greyed-out and are not tappable. Override unavailableStyle to change this.

Inheritance

Constructors

DialogueChoicesWidget({Key? key, required DialogueRunner runner, TextStyle? choiceStyle, TextStyle? unavailableStyle, Color backgroundColor = Colors.black54, Color selectedColor = const Color(0xFF1E3A5F), double borderRadius = 6.0, double spacing = 6.0, bool showUnavailable = true})
A column of buttons for runner's pending choices, one per choice; builds nothing while no choice is pending.
const

Properties

backgroundColor → Color
Each button's background at rest; translucent black by default.
final
borderRadius → double
Corner radius of each button, in logical pixels.
final
choiceStyle → TextStyle?
Text style for available choices.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runner → DialogueRunner
The runner whose choices are shown and told which one was picked.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedColor → Color
Background highlight when hovered / tapped.
final
showUnavailable → bool
Whether to show (greyed-out) unavailable choices at all.
final
spacing → double
Vertical gap between choice buttons.
final
unavailableStyle → TextStyle?
Text style for unavailable choices (greyed-out by default).
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