Files
buzz/mobile/lib/shared/widgets/reconnect_capsule.dart
klopez4212 a25f3cd1d7 fix(mobile): match Agents sign-in to Home’s reconnect capsule (#9204)
Replaces Agents’ inline sign-in row with Home’s reconnect capsule. It
appears at the top of Agents, scrolls with the agent cards, and remains
available until leaving the page or signing in. Home is unchanged.

Validated with mobile checks, the full test suite, scrolling and
sign-in/re-entry regression journeys, and an approved iPhone Air visual
preview. The device preview forces the capsule visible while signed in;
that override is excluded from this PR.

| Before (widget render) | After (widget render) |
| --- | --- |
|
![Before](https://github.com/user-attachments/assets/3ab65502-8469-4c64-956b-40c9362175ce)
|
![After](https://github.com/user-attachments/assets/dbdcd3f3-80d1-4274-812e-90636378a3a3)
|

<details>
<summary>iPhone Air and large-text snapshots</summary>

Physical iPhone Air, with preview-only visibility override:

![iPhone Air
preview](https://github.com/user-attachments/assets/75d85f8e-704f-4e24-bfe4-08edfa27c229)

3x text, 320×568 widget render:

![Large
text](https://github.com/user-attachments/assets/79dd0223-5c64-4983-971e-1f20fb75c1b5)

</details>

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-06 11:20:53 -08:00

59 lines
1.7 KiB
Dart

part of 'buzz_toast.dart';
/// Parent-owned persistent feedback with the same motion as transient toasts.
class ReconnectCapsule extends HookWidget {
const ReconnectCapsule({
super.key,
required this.onSignIn,
this.visible = true,
this.message = 'Reconnect to Builderlab',
this.actionLabel = 'Sign in',
this.destructiveAction = false,
this.secondaryAction,
this.islandOrigin,
this.islandSpeed = 0.75,
this.inline = false,
});
final VoidCallback onSignIn;
final bool visible;
/// Persistent status displayed beside or above the actions.
final String message;
/// Label for the primary recovery action.
final String actionLabel;
/// Uses the theme error colors for the primary action.
final bool destructiveAction;
/// Adds a second recovery action and stacks both buttons below the message.
final ({String label, VoidCallback onPressed})? secondaryAction;
final Rect? islandOrigin;
final double islandSpeed;
/// Reserves space in a page layout instead of overlaying its content.
final bool inline;
@override
Widget build(BuildContext context) {
final transientVisible = useValueListenable(_toastCoordinator(context));
// Remove immediately so neither text nor island surfaces overlap.
// Remounting after dismissal restarts the persistent entrance if needed.
if (transientVisible) return const SizedBox.shrink();
return _ToastBubble(
message: message,
actionLabel: actionLabel,
destructiveAction: destructiveAction,
secondaryAction: secondaryAction,
onRetry: onSignIn,
onDismiss: () {},
persistent: true,
visible: visible,
islandOrigin: islandOrigin,
islandSpeed: islandSpeed,
inline: inline,
);
}
}