GameWidget<T extends Game> class

A StatefulWidget that is in charge of attaching a Game instance into the Flutter tree.

Inheritance

Constructors

GameWidget({Key? key, required T game, TextDirection? textDirection, GameLoadingWidgetBuilder? loadingBuilder, GameErrorWidgetBuilder? errorBuilder, WidgetBuilder? backgroundBuilder, Map<String, OverlayWidgetBuilder<T>>? overlayBuilderMap, List<String>? initialActiveOverlays, FocusNode? focusNode, bool autofocus = true, MouseCursor? mouseCursor})
Renders a game in a flutter widget tree.
const

Properties

autofocus bool
Whether the focusNode requests focus once the game is mounted. Defaults to true.
final
backgroundBuilder WidgetBuilder?
Builder to provide a widget tree to be built between the game elements and the background color provided via Game.backgroundColor.
final
errorBuilder GameErrorWidgetBuilder?
If set, errors during the onLoad method will not be thrown but instead this widget will be shown. If not provided, errors are propagated up.
final
focusNode FocusNode?
The FocusNode to control the games focus to receive event inputs. If omitted, defaults to an internally controlled focus node.
final
game → T
The game instance in which this widget will render
final
hashCode int
The hash code for this object.
no setterinherited
initialActiveOverlays List<String>?
A List of the initially active overlays, this is used only on the first build of the widget. To control the overlays that are active use Game.overlays.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loadingBuilder GameLoadingWidgetBuilder?
Builder to provide a widget tree to be built while the Game's Future provided via Game.onLoad and Game.onMount is not resolved. By default this is an empty Container().
final
mouseCursor MouseCursor?
Initial mouse cursor for this GameWidget mouse cursor can be changed in runtime using Game.mouseCursor
final
overlayBuilderMap Map<String, OverlayWidgetBuilder<T>>?
A map to show widgets overlay.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textDirection TextDirection?
The text direction to be used in text elements in a game.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _GameWidgetState<T>
Renders a game in a flutter widget tree alongside widgets overlays.
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