mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-15 16:12:16 +00:00
ensure only one firo ex addr popup is active at any one time
This commit is contained in:
parent
f634ce8701
commit
769edc3bc0
3 changed files with 32 additions and 8 deletions
|
@ -128,6 +128,8 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
|
||||
bool _addressToggleFlag = false;
|
||||
|
||||
bool _isFiroExWarningDisplayed = false;
|
||||
|
||||
bool _cryptoAmountChangeLock = false;
|
||||
late VoidCallback onCryptoAmountChanged;
|
||||
|
||||
|
@ -400,8 +402,13 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
(coin as Firo).isExchangeAddress(_address ?? "");
|
||||
|
||||
if (ref.read(publicPrivateBalanceStateProvider) == FiroType.spark &&
|
||||
ref.read(pIsExchangeAddress)) {
|
||||
showFiroExchangeAddressWarning(context);
|
||||
ref.read(pIsExchangeAddress) &&
|
||||
!_isFiroExWarningDisplayed) {
|
||||
_isFiroExWarningDisplayed = true;
|
||||
showFiroExchangeAddressWarning(
|
||||
context,
|
||||
() => _isFiroExWarningDisplayed = false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1034,9 +1041,16 @@ class _SendViewState extends ConsumerState<SendView> {
|
|||
});
|
||||
}
|
||||
|
||||
if (previous != next && next == FiroType.spark && isExchangeAddress) {
|
||||
if (previous != next &&
|
||||
next == FiroType.spark &&
|
||||
isExchangeAddress &&
|
||||
!_isFiroExWarningDisplayed) {
|
||||
_isFiroExWarningDisplayed = true;
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => showFiroExchangeAddressWarning(context),
|
||||
(_) => showFiroExchangeAddressWarning(
|
||||
context,
|
||||
() => _isFiroExWarningDisplayed = false,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -122,6 +122,8 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
|
||||
bool _addressToggleFlag = false;
|
||||
|
||||
bool _isFiroExWarningDisplayed = false;
|
||||
|
||||
bool _cryptoAmountChangeLock = false;
|
||||
late VoidCallback onCryptoAmountChanged;
|
||||
|
||||
|
@ -951,9 +953,13 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
|
||||
final firoType = ref.watch(publicPrivateBalanceStateProvider);
|
||||
if (coin is Firo && firoType == FiroType.spark) {
|
||||
if (ref.watch(pIsExchangeAddress)) {
|
||||
if (ref.watch(pIsExchangeAddress) && !_isFiroExWarningDisplayed) {
|
||||
_isFiroExWarningDisplayed = true;
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => showFiroExchangeAddressWarning(context),
|
||||
(_) => showFiroExchangeAddressWarning(
|
||||
context,
|
||||
() => _isFiroExWarningDisplayed = false,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,13 @@ class FiroExchangeAddressDialog extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> showFiroExchangeAddressWarning(BuildContext context) async {
|
||||
return await showDialog<void>(
|
||||
Future<void> showFiroExchangeAddressWarning(
|
||||
BuildContext context,
|
||||
VoidCallback onClosed,
|
||||
) async {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => const FiroExchangeAddressDialog(),
|
||||
);
|
||||
onClosed();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue