From c5f5d1dd4dc93b31b516b80e6b678e7f02ea0715 Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Mon, 10 Mar 2025 11:49:16 +0200 Subject: [PATCH] fix edit token page minor fixes --- lib/src/screens/dashboard/dashboard_page.dart | 7 ++----- .../settings/widgets/settings_switcher_cell.dart | 11 ++++++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/src/screens/dashboard/dashboard_page.dart b/lib/src/screens/dashboard/dashboard_page.dart index f219409da..cf1f6fa17 100644 --- a/lib/src/screens/dashboard/dashboard_page.dart +++ b/lib/src/screens/dashboard/dashboard_page.dart @@ -187,7 +187,6 @@ class _DashboardPageView extends BasePage { int get initialPage => dashboardViewModel.shouldShowMarketPlaceInDashboard ? 1 : 0; ObservableList pages = ObservableList(); bool _isEffectsInstalled = false; - StreamSubscription? _onInactiveSub; @override Widget body(BuildContext context) { @@ -275,7 +274,7 @@ class _DashboardPageView extends BasePage { } void _setEffects(BuildContext context) async { - if (_isEffectsInstalled) { + if (_isEffectsInstalled || !context.mounted) { return; } if (dashboardViewModel.shouldShowMarketPlaceInDashboard) { @@ -305,11 +304,9 @@ class _DashboardPageView extends BasePage { _showHavenPopup(context); var needToPresentYat = false; - var isInactive = false; - _onInactiveSub = rootKey.currentState?.isInactive.listen( + rootKey.currentState?.isInactive.listen( (inactive) { - isInactive = inactive; if (needToPresentYat) { Future.delayed(Duration(milliseconds: 500)).then( diff --git a/lib/src/screens/settings/widgets/settings_switcher_cell.dart b/lib/src/screens/settings/widgets/settings_switcher_cell.dart index bc3421ead..6173cb34d 100644 --- a/lib/src/screens/settings/widgets/settings_switcher_cell.dart +++ b/lib/src/screens/settings/widgets/settings_switcher_cell.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:cake_wallet/src/widgets/standard_list.dart'; import 'package:cake_wallet/src/widgets/standard_switch.dart'; import 'package:flutter/material.dart'; @@ -30,7 +29,13 @@ class SettingsSwitcherCell extends StandardListRow { height: 56, padding: EdgeInsets.only(left: 12, right: 12), child: TextButton( - onPressed: () => onValueChange?.call(context, !value), + onPressed: () { + if (onTap != null) { + onTap!.call(context); + } else { + onValueChange?.call(context, !value); + } + }, style: ButtonStyle( //backgroundColor: MaterialStateProperty.all(Theme.of(context).cardColor), shape: MaterialStateProperty.all( @@ -45,7 +50,7 @@ class SettingsSwitcherCell extends StandardListRow { children: [ if (leading != null) leading, buildCenter(context, hasLeftOffset: leading != null), - if (trailing != null) trailing, + trailing, ], ), ),