Add explicit surface visibility signal

Provide composable shown/current visibility for retained surfaces and migrate visibility readers away from TickerMode. This keeps ticker muting separate from painted and current-surface state.
This commit is contained in:
2026-11-10 20:28:09 +00:00
parent e0e8ca68f3
commit 7ff012880b
13 changed files with 179 additions and 25 deletions
@@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
import '../../../ui/floating/floating_layer.dart';
import '../../../ui/motion/motion.dart';
import '../../../ui/motion/surface_visibility.dart';
import '../ui/sessions/chat_adaptive.dart';
import 'chat_float_binding.dart';
import 'chat_float_shortcut.dart';
@@ -322,7 +323,14 @@ class _ChatFloatSlotState extends State<_ChatFloatSlot>
onDock: widget.onDock,
onHide: widget.onHide,
// A hidden window's chat pauses its tickers like a hidden tab.
child: TickerMode(enabled: !offstage, child: widget.child),
child: TickerMode(
enabled: !offstage,
child: SurfaceVisibility(
shown: !offstage,
current: !offstage,
child: widget.child,
),
),
);
},
);
@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import '../../../ui/motion/motion.dart';
import '../../../ui/motion/surface_visibility.dart';
/// Reopens a retained mobile workspace without moving it to another route.
/// Its child keeps the same element, scroll positions, panes and drafts.
@@ -68,7 +69,14 @@ class _ChatWorkspaceEntranceState extends State<ChatWorkspaceEntrance>
// Both surfaces share one route here; only the workspace entrance
// animates, so no Hero inside the chat flies or duplicates a tag.
enabled: false,
child: TickerMode(enabled: widget.visible, child: widget.child),
child: TickerMode(
enabled: widget.visible,
child: SurfaceVisibility(
shown: widget.visible,
current: widget.visible,
child: widget.child,
),
),
);
final transition = widget.cupertino
? CupertinoPageTransition(