showExistingAccountSwitchDialog function
Confirms the destructive half of a guest-to-existing-account transition.
Kept as a separate function so the behavior is directly widget-testable and every caller presents the same warning before guest progress is abandoned.
Implementation
@visibleForTesting
Future<bool> showExistingAccountSwitchDialog(BuildContext context) async {
return await showDialog<bool>(
context: context,
builder: (dialogContext) => AlertDialog(
scrollable: true,
title: const Text('Sign in to your existing account?'),
content: const Text(
'That Google account already exists. You can sign in to it, but '
'this guest’s games, ratings, and friends cannot be transferred.',
),
actions: [
TextButton(
onPressed: () => Navigator.pop(dialogContext, false),
child: const Text('Keep playing as guest'),
),
FilledButton(
onPressed: () => Navigator.pop(dialogContext, true),
child: const Text('Sign in'),
),
],
),
) ??
false;
}