Skip to content

Commit

Permalink
refactor: Update notification switch location #2869
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Sep 18, 2024
1 parent 91d8828 commit 3aa4b00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/l10n/l10n.dart';
import 'package:altme/matrix_notification/matrix_notification.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

Expand Down Expand Up @@ -85,6 +86,14 @@ class HelpCenterView extends StatelessWidget {
},
),
],
if (helpCenterOptions.displayNotification && isEnterprise) ...[
DrawerItem(
title: l10n.notificationRoom,
onTap: () {
Navigator.of(context).push<void>(NotificationPage.route());
},
),
],
if (helpCenterOptions.displayEmailSupport) ...[
DrawerItem(
title: l10n.sendAnEmail,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class WalletSecurityView extends StatelessWidget {

return BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
final helpCenterOptions = state.model.profileSetting.helpCenterOptions;
return BasePage(
backgroundColor: Theme.of(context).colorScheme.surface,
useSafeArea: true,
Expand Down Expand Up @@ -96,37 +95,6 @@ class WalletSecurityView extends StatelessWidget {
);
},
),
if (helpCenterOptions.customNotification != null &&
helpCenterOptions.customNotification! &&
helpCenterOptions.customNotificationRoom != null) ...[
Padding(
padding: const EdgeInsets.all(Sizes.spaceSmall / 2),
child: DrawerCategoryItem(
title: l10n.notification,
subTitle: l10n.notificationSubtitle,
trailing: SizedBox(
height: 25,
child: BlocBuilder<ProfileCubit, ProfileState>(
builder: (context, state) {
return Switch(
key: const Key('customNotificationRoom'),
onChanged: (value) async {
await context
.read<ProfileCubit>()
.updateProfileSetting(
displayNotification: value,
);
},
value: helpCenterOptions.displayNotification,
activeColor: Theme.of(context).colorScheme.primary,
);
},
),
),
),
),
const SizedBox(height: Sizes.spaceSmall),
],
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ class WalletSettingsMenuView extends StatelessWidget {
Widget build(BuildContext context) {
final l10n = context.l10n;

final profileModel = context.read<ProfileCubit>().state.model;

final helpCenterOptions = profileModel.profileSetting.helpCenterOptions;

final isEnterprise = profileModel.walletType == WalletType.enterprise;

return BasePage(
backgroundColor: Theme.of(context).colorScheme.surface,
useSafeArea: true,
Expand Down

0 comments on commit 3aa4b00

Please sign in to comment.