From 783574f13e52d1bcbf18b1d6ee8dd65fbda88c6c Mon Sep 17 00:00:00 2001 From: Bibash Shrestha Date: Wed, 6 Mar 2024 18:48:21 +0545 Subject: [PATCH] feat: When chat is not available on Enterprise wallet, remove the icon on the bottom righ #2455 --- lib/dashboard/src/view/dashboard_page.dart | 70 ++++++++++++++-------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/lib/dashboard/src/view/dashboard_page.dart b/lib/dashboard/src/view/dashboard_page.dart index 4f6e0e3c3..750ea24af 100644 --- a/lib/dashboard/src/view/dashboard_page.dart +++ b/lib/dashboard/src/view/dashboard_page.dart @@ -148,6 +148,15 @@ class _DashboardViewState extends State { if (state.selectedIndex == 3) { context.read().setMessagesAsRead(); } + + final displayChatSupport = !context + .read() + .state + .model + .profileSetting + .helpCenterOptions + .displayChatSupport; + return WillPopScope( onWillPop: () async { if (scaffoldKey.currentState!.isDrawerOpen) { @@ -187,17 +196,20 @@ class _DashboardViewState extends State { onPageChanged: context.read().onPageChanged, physics: const NeverScrollableScrollPhysics(), - children: const [ - HomePage(), + children: [ + const HomePage(), if (Parameters.walletHandlesCrypto) - DiscoverTabPage() + const DiscoverTabPage() else - DiscoverPage(), + const DiscoverPage(), if (Parameters.walletHandlesCrypto) - WertPage() + const WertPage() + else + const SearchPage(), + if (displayChatSupport) + const AltmeSupportChatPage() else - SearchPage(), - AltmeSupportChatPage(), + Container(), ], ), ), @@ -232,23 +244,33 @@ class _DashboardViewState extends State { onTap: () => bottomTapped(2), isSelected: state.selectedIndex == 2, ), - StreamBuilder( - initialData: context - .read() - .unreadMessageCount, - stream: context - .read() - .unreadMessageCountStream, - builder: (_, snapShot) { - return BottomBarItem( - icon: IconStrings.messaging, - text: l10n.chat, - badgeCount: snapShot.data ?? 0, - onTap: () => bottomTapped(3), - isSelected: state.selectedIndex == 3, - ); - }, - ), + if (displayChatSupport) ...[ + StreamBuilder( + initialData: context + .read() + .unreadMessageCount, + stream: context + .read() + .unreadMessageCountStream, + builder: (_, snapShot) { + return BottomBarItem( + icon: IconStrings.messaging, + text: l10n.chat, + badgeCount: snapShot.data ?? 0, + onTap: () => bottomTapped(3), + isSelected: state.selectedIndex == 3, + ); + }, + ), + ] else ...[ + BottomBarItem( + icon: IconStrings.settings, + text: l10n.settings, + onTap: () => + scaffoldKey.currentState!.openDrawer(), + isSelected: false, + ), + ], ], ), ),