Skip to content

Commit

Permalink
feat: Added Enterprise in wallet profile #2143
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Dec 13, 2023
1 parent 8925897 commit 83953b4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
7 changes: 5 additions & 2 deletions lib/app/shared/enum/type/profile/profile_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ enum ProfileType {
}

extension ProfileTypeX on ProfileType {
String getTitle(AppLocalizations l10n) {
String getTitle({
required AppLocalizations l10n,
String? name,
}) {
switch (this) {
case ProfileType.custom:
return l10n.profileCustom;
Expand All @@ -17,7 +20,7 @@ extension ProfileTypeX on ProfileType {
case ProfileType.dutch:
return l10n.profileDutchBlockchainCoalition;
case ProfileType.enterprise:
return 'Enterprise';
return name ?? 'Enterprise';
}
}
}
16 changes: 13 additions & 3 deletions lib/dashboard/drawer/profile/widget/profile_selector_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ class ProfileSelectorWidget extends StatelessWidget {
itemBuilder: (context, index) {
final profileType = ProfileType.values[index];

if (context.read<ProfileCubit>().state.model.walletType !=
WalletType.enterprise &&
final profile = context.read<ProfileCubit>().state.model;

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

if (!isEnterprise &&
profileType == ProfileType.enterprise) {
return Container();
}
Expand Down Expand Up @@ -81,7 +85,13 @@ class ProfileSelectorWidget extends StatelessWidget {
),
),
title: Text(
profileType.getTitle(l10n),
profileType.getTitle(
l10n: l10n,
name: isEnterprise
? profile.profileSetting.generalOptions
.companyName
: null,
),
style: Theme.of(context)
.textTheme
.bodyLarge
Expand Down
15 changes: 14 additions & 1 deletion lib/dashboard/drawer/src/view/drawer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class DrawerView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;

final profileSetting =
context.read<ProfileCubit>().state.model.profileSetting;
return SizedBox(
width: MediaQuery.of(context).size.width,
child: Drawer(
Expand All @@ -37,7 +40,17 @@ class DrawerView extends StatelessWidget {
color: Theme.of(context).colorScheme.onPrimary,
),
),
const Center(child: AltMeLogo(size: 90)),

Center(
child: profileSetting.generalOptions.companyLogo.isNotEmpty
? CachedImageFromNetwork(
profileSetting.generalOptions.companyLogo,
fit: BoxFit.contain,
height: 90,
width: 90,
)
: const AltMeLogo(size: 90),
),
const SizedBox(height: Sizes.spaceSmall),
const AppVersionDrawer(),
const SizedBox(height: Sizes.spaceLarge),
Expand Down

0 comments on commit 83953b4

Please sign in to comment.