From 00f3982a8c3dfc96cd253184d6f02d57f15def34 Mon Sep 17 00:00:00 2001 From: Ava Shilling <165050625+avashilling@users.noreply.github.com> Date: Fri, 16 Jan 2026 13:24:16 -0500 Subject: [PATCH] use showOkCancelAlertDialog --- lib/config/routes.dart | 62 +++++++----------------------------------- lib/l10n/intl_en.arb | 2 +- 2 files changed, 11 insertions(+), 53 deletions(-) diff --git a/lib/config/routes.dart b/lib/config/routes.dart index 392e1e6ac..3157d3f87 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -61,6 +61,7 @@ import 'package:fluffychat/pangea/space_analytics/space_analytics.dart'; import 'package:fluffychat/pangea/spaces/space_constants.dart'; import 'package:fluffychat/pangea/subscription/pages/settings_subscription.dart'; import 'package:fluffychat/pangea/vocab_practice/vocab_practice_page.dart'; +import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart'; import 'package:fluffychat/widgets/config_viewer.dart'; import 'package:fluffychat/widgets/layouts/empty_page.dart'; import 'package:fluffychat/widgets/layouts/two_column_layout.dart'; @@ -591,59 +592,16 @@ abstract class AppRoutes { return true; } - final bool confirm = await showDialog( - context: context, - builder: (context) { - return Center( - child: ConstrainedBox( - constraints: const BoxConstraints( - maxWidth: 400, - ), - child: Dialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Padding( - padding: const EdgeInsets.all(24.0), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: - CrossAxisAlignment.stretch, - children: [ - Center( - child: Text( - L10n.of(context).exitPractice, - style: const TextStyle( - fontSize: 28, - ), - ), - ), - const SizedBox(height: 16), - ElevatedButton( - onPressed: () { - Navigator.of(context).pop(true); - }, - child: Text(L10n.of(context).yes), - ), - const SizedBox(height: 16), - ElevatedButton( - onPressed: () { - Navigator.of(context) - .pop(false); - }, - child: Text(L10n.of(context).no), - ), - ], - ), - ), - ), - ), - ); - }, - ) ?? - false; + final result = await showOkCancelAlertDialog( + useRootNavigator: false, + context: context, + title: L10n.of(context).areYouSure, + okLabel: L10n.of(context).yes, + cancelLabel: L10n.of(context).cancel, + message: L10n.of(context).exitPractice, + ); - return confirm; + return result == OkCancelResult.ok; }, ), GoRoute( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index a168acbcd..effc63fc6 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -5047,5 +5047,5 @@ "youLeftTheChat": "🚪 You left the chat", "downloadInitiated": "Download initiated", "webDownloadPermissionMessage": "If your browser blocks downloads, please enable downloads for this site.", - "exitPractice": "Exit practice? Your progress will be lost." + "exitPractice": "Your practice session progress won't be saved." }