Skip to content

Commit 4e7f329

Browse files
naezithCharlVS
authored andcommitted
wallet only logout confirmation description
1 parent 853517b commit 4e7f329

File tree

3 files changed

+50
-53
lines changed

3 files changed

+50
-53
lines changed

assets/translations/en.json

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
"swapFeeDetailsNone": "None",
195195
"swapFeeDetailsPaidFromReceivedVolume": "Paid from received volume",
196196
"logoutPopupTitle": "Confirm log out?",
197+
"logoutPopupDescriptionWalletOnly": "Are you sure you want to logout?",
197198
"logoutPopupDescription": "Are you sure you want to logout? Your opened orders will no longer be available to match with other users and any trades in progress may not be completed",
198199
"transactionDetailsTitle": "Transaction completed",
199200
"customSeedWarningText": "Custom seed phrases are generally less secure and easier to crack than a generated BIP39 compliant seed phrase. To confirm you understand and are aware of the risk, type \"I\u00A0Understand\" in the box below.",

lib/generated/codegen_loader.g.dart

+1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ abstract class LocaleKeys {
190190
static const swapFeeDetailsPaidFromReceivedVolume = 'swapFeeDetailsPaidFromReceivedVolume';
191191
static const logoutPopupTitle = 'logoutPopupTitle';
192192
static const logoutPopupDescription = 'logoutPopupDescription';
193+
static const logoutPopupDescriptionWalletOnly = 'logoutPopupDescriptionWalletOnly';
193194
static const transactionDetailsTitle = 'transactionDetailsTitle';
194195
static const customSeedWarningText = 'customSeedWarningText';
195196
static const customSeedIUnderstand = 'customSeedIUnderstand';

lib/shared/widgets/logout_popup.dart

+48-53
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import 'package:easy_localization/easy_localization.dart';
22
import 'package:flutter/material.dart';
33
import 'package:flutter_bloc/flutter_bloc.dart';
4-
import 'package:komodo_ui_kit/komodo_ui_kit.dart';
4+
import 'package:web_dex/app_config/app_config.dart';
55
import 'package:web_dex/bloc/auth_bloc/auth_bloc.dart';
6-
import 'package:web_dex/bloc/coins_bloc/coins_bloc.dart';
6+
import 'package:web_dex/bloc/auth_bloc/auth_bloc_event.dart';
7+
import 'package:web_dex/blocs/blocs.dart';
78
import 'package:web_dex/generated/codegen_loader.g.dart';
89
import 'package:web_dex/model/wallet.dart';
10+
import 'package:komodo_ui_kit/komodo_ui_kit.dart';
911

1012
class LogOutPopup extends StatelessWidget {
1113
const LogOutPopup({
@@ -18,63 +20,56 @@ class LogOutPopup extends StatelessWidget {
1820

1921
@override
2022
Widget build(BuildContext context) {
21-
return BlocBuilder<AuthBloc, AuthBlocState>(
22-
builder: (context, state) {
23-
final currentWallet = state.currentUser?.wallet;
24-
return Container(
25-
constraints: const BoxConstraints(maxWidth: 300),
26-
child: Column(
27-
crossAxisAlignment: CrossAxisAlignment.center,
23+
return Container(
24+
constraints: const BoxConstraints(maxWidth: 300),
25+
child: Column(
26+
crossAxisAlignment: CrossAxisAlignment.center,
27+
mainAxisSize: MainAxisSize.min,
28+
children: [
29+
SelectableText(
30+
LocaleKeys.logoutPopupTitle.tr(),
31+
style: const TextStyle(
32+
fontSize: 18,
33+
fontWeight: FontWeight.w700,
34+
),
35+
),
36+
const SizedBox(height: 12),
37+
if (currentWalletBloc.wallet?.config.type == WalletType.iguana)
38+
SelectableText(
39+
kIsWalletOnly
40+
? LocaleKeys.logoutPopupDescriptionWalletOnly.tr()
41+
: LocaleKeys.logoutPopupDescription.tr(),
42+
style: const TextStyle(
43+
fontSize: 14,
44+
fontWeight: FontWeight.w500,
45+
),
46+
),
47+
const SizedBox(height: 25),
48+
Row(
2849
mainAxisSize: MainAxisSize.min,
2950
children: [
30-
SelectableText(
31-
LocaleKeys.logoutPopupTitle.tr(),
32-
style: const TextStyle(
33-
fontSize: 18,
34-
fontWeight: FontWeight.w700,
35-
),
51+
UiUnderlineTextButton(
52+
key: const Key('popup-cancel-logout-button'),
53+
width: 120,
54+
height: 36,
55+
text: LocaleKeys.cancel.tr(),
56+
onPressed: onCancel,
3657
),
37-
const SizedBox(height: 12),
38-
if (currentWallet?.config.type == WalletType.iguana)
39-
SelectableText(
40-
LocaleKeys.logoutPopupDescription.tr(),
41-
style: const TextStyle(
42-
fontSize: 14,
43-
fontWeight: FontWeight.w500,
44-
),
45-
),
46-
const SizedBox(height: 25),
47-
Row(
48-
mainAxisSize: MainAxisSize.min,
49-
children: [
50-
UiUnderlineTextButton(
51-
key: const Key('popup-cancel-logout-button'),
52-
width: 120,
53-
height: 36,
54-
text: LocaleKeys.cancel.tr(),
55-
onPressed: onCancel,
56-
),
57-
const SizedBox(width: 12),
58-
UiPrimaryButton(
59-
key: const Key('popup-confirm-logout-button'),
60-
width: 120,
61-
height: 36,
62-
text: LocaleKeys.logOut.tr(),
63-
onPressed: () => _onConfirmLogout(context),
64-
),
65-
],
58+
const SizedBox(width: 12),
59+
UiPrimaryButton(
60+
key: const Key('popup-confirm-logout-button'),
61+
width: 120,
62+
height: 36,
63+
text: LocaleKeys.logOut.tr(),
64+
onPressed: () {
65+
context.read<AuthBloc>().add(const AuthLogOutEvent());
66+
onConfirm();
67+
},
6668
),
6769
],
6870
),
69-
);
70-
},
71+
],
72+
),
7173
);
7274
}
73-
74-
void _onConfirmLogout(BuildContext context) {
75-
// stop listening to balance updates before logging out
76-
context.read<CoinsBloc>().add(CoinsSessionEnded());
77-
context.read<AuthBloc>().add(const AuthSignOutRequested());
78-
onConfirm();
79-
}
8075
}

0 commit comments

Comments
 (0)