PauseOverlay class
Pause panel wired directly to GameSessionController — the pause
button/system-lifecycle-pause round trip this repo already has (see
game_session_controller.dart's own RoyLifecycleCoordinator hook) gets
exactly one visible UI on top of it. Caller mounts this unconditionally
inside their own Stack (same "always mounted, NeonDialog.overlaySlot
animates the panel in/out" convention as every other in-tree overlay in
this kit) — it decides on its own, from session, whether to show:
- Visible when GameSessionController.snapshot is GameSessionPhase.paused AND GamePauseReason.user is one of the active reasons — a background-triggered GamePauseReason.system pause does NOT show this by default (a player didn't ask to see a pause menu just because the app backgrounded), unless showForSystemPause.
- The Android/back gesture resumes instead of popping the underlying
route while visible (a real PopScope, not the show()-then-pop trick
NeonDialog.show uses for a route dialog — this overlay is never a
route, exactly like NeonDialog.overlay/
.overlaySlot). - onResume/onRestart/onSettings/onQuit are overridable; leaving
onResume/onRestart unset falls back to
GameSessionController.resume/GameSessionController.restart.
onSettings/onQuit have no sensible package-level default (the kit
doesn't know a game's settings screen or what "quit" means for it) —
leaving either
nullhides that one button instead of wiring a no-op.
Focus: the panel is wrapped in FocusTrapScope (FEAT-82), which
autofocuses into the panel as soon as it becomes visible AND restores
focus to whatever had it right before, the moment the panel is
dismissed — a keyboard/TV-remote/gamepad/screen-reader user lands on
the pause menu and gets their exact place back afterward, not
wherever FocusManager happens to fall back to. Every button inside
(via CommonButton's own PressableScale) is real-keyboard-
activatable (Enter/Space/gamepad A), not gesture-only — closes the gap
this doc comment used to flag as out of scope for FEAT-53.
Game-time coordination is automatic and needs no wiring here: a
GameTimeController built with session: this same session already
freezes itself from GameSessionController's own pause state (FEAT-49).
Audio is deliberately NOT auto-paused/resumed by this widget — whether
background music should keep playing behind a pause menu is a per-game
call this kit shouldn't make for every consumer; pause/resume AudioManager
yourself in onResume/wherever you call GameSessionController.pause if
your game wants that.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PauseOverlay
Constructors
- PauseOverlay({Key? key, required GameSessionController session, bool showForSystemPause = false, VoidCallback? onResume, VoidCallback? onRestart, VoidCallback? onSettings, VoidCallback? onQuit, String? title, String? resumeLabel, String? restartLabel, String? settingsLabel, String? quitLabel, Color? color})
-
const
Properties
- color → Color?
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onQuit → VoidCallback?
-
final
- onRestart → VoidCallback?
-
final
- onResume → VoidCallback?
-
final
- onSettings → VoidCallback?
-
final
- quitLabel → String?
-
final
- restartLabel → String?
-
final
- resumeLabel → String?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → GameSessionController
-
final
- settingsLabel → String?
-
final
- showForSystemPause → bool
-
final
- title → String?
-
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