LevelUpOverlayController class
Pure state machine driving LevelUpOverlay — no Animation/
BuildContext here, so it's unit-testable without pumping a widget
tree (same shape as SceneTransitionController, FEAT-58).
Never grants anything: this controller only presents
LevelUpEvents a caller already obtained from
PlayerProgressionService.grantXp — it has no reference to that
service or to RewardTransactionPipeline, and calls neither. The
reward was already committed before show is ever called.
Token-guarded: every show mints a new token, and only that
token's continuation may mutate phase/queueIndex — a previous,
still-in-flight show superseded by a newer one silently drops its
own late completion instead of stomping the newer sequence's state or
double-firing its onComplete. The same guard makes skip and
dispose immediately stop any in-flight show from mutating state
further.
Constructors
- LevelUpOverlayController({Duration xpFillDuration = const Duration(milliseconds: 600), Duration levelPopDuration = const Duration(milliseconds: 400), Duration rewardRevealDuration = const Duration(milliseconds: 500)})
Properties
- current → LevelUpCelebration?
-
The celebration currently being shown, or
nullwhen isActive isfalse.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isActive → bool
-
no setter
- levelPopDuration → Duration
-
final
-
phase
→ Rx<
LevelUpPhase> -
final
- queueIndex → RxInt
-
final
- rewardRevealDuration → Duration
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- xpFillDuration → Duration
-
final
Methods
-
dispose(
) → void -
Marks this controller disposed — any in-flight show stops mutating
state from this point on and its
onCompleteis dropped, never called (same reasoning asSceneTransitionController.dispose: a widget tearing down shouldn't have a stale timer reach back into it later). show called after dispose is a safe no-op. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
show(
List< LevelUpCelebration> celebrations, {VoidCallback? onComplete}) → Future<void> -
Starts the celebration sequence for
celebrations, shown in list order (already-ascending, since that's howPlayerProgressionService.grantXpfires them). Starting a new show while a previous one is still running supersedes it — the old one'sonCompleteis dropped, never called. -
skip(
) → void -
Immediately ends the whole queue, jumping straight to LevelUpPhase.idle
and firing
onComplete(once) as if it had finished naturally — for a player tapping "skip" through a celebration they don't want to watch. Safe to call multiple times or after the sequence already finished — only the first call after an active show actually fires anything. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited