Skip to content

Commit

Permalink
feat: When chat is not available on Enterprise wallet, remove the ico…
Browse files Browse the repository at this point in the history
…n on the bottom righ #2455
  • Loading branch information
bibash28 committed Mar 6, 2024
1 parent ef2835a commit 783574f
Showing 1 changed file with 46 additions and 24 deletions.
70 changes: 46 additions & 24 deletions lib/dashboard/src/view/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ class _DashboardViewState extends State<DashboardView> {
if (state.selectedIndex == 3) {
context.read<AltmeChatSupportCubit>().setMessagesAsRead();
}

final displayChatSupport = !context
.read<ProfileCubit>()
.state
.model
.profileSetting
.helpCenterOptions
.displayChatSupport;

return WillPopScope(
onWillPop: () async {
if (scaffoldKey.currentState!.isDrawerOpen) {
Expand Down Expand Up @@ -187,17 +196,20 @@ class _DashboardViewState extends State<DashboardView> {
onPageChanged:
context.read<DashboardCubit>().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(),
],
),
),
Expand Down Expand Up @@ -232,23 +244,33 @@ class _DashboardViewState extends State<DashboardView> {
onTap: () => bottomTapped(2),
isSelected: state.selectedIndex == 2,
),
StreamBuilder(
initialData: context
.read<AltmeChatSupportCubit>()
.unreadMessageCount,
stream: context
.read<AltmeChatSupportCubit>()
.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<AltmeChatSupportCubit>()
.unreadMessageCount,
stream: context
.read<AltmeChatSupportCubit>()
.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,
),
],
],
),
),
Expand Down

0 comments on commit 783574f

Please sign in to comment.