Skip to content

Commit

Permalink
feat: Solve display issue #3219
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Dec 26, 2024
1 parent f264c7f commit 5353601
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ part of 'credential_subject_type.dart';

extension CredentialSubjectTypeExtension on CredentialSubjectType {
Color backgroundColor(CredentialModel credentialModel) {
final Color backgroundColor;
if (credentialModel.display?.backgroundColor != null) {
backgroundColor = Color(
int.parse(
'FF${credentialModel.display?.backgroundColor!.replaceAll('#', '')}',
radix: 16,
),
);
} else {
backgroundColor = defaultBackgroundColor;
try {
final Color backgroundColor;
if (credentialModel.display?.backgroundColor != null) {
backgroundColor = Color(
int.parse(
'FF${credentialModel.display?.backgroundColor!.replaceAll('#', '')}',
radix: 16,
),
);
} else {
backgroundColor = defaultBackgroundColor;
}
return backgroundColor;
} catch (e) {
return defaultBackgroundColor;
}
return backgroundColor;
}

Color get defaultBackgroundColor {
Expand All @@ -31,7 +35,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
case CredentialSubjectType.selfIssued:
return const Color(0xffEFF0F6);
case CredentialSubjectType.defaultCredential:
return Colors.white;
return const Color(0xff6600FF);
case CredentialSubjectType.professionalStudentCard:
return const Color(0xffCAFFBF);
case CredentialSubjectType.kycAgeCredential:
Expand Down Expand Up @@ -88,7 +92,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
case CredentialSubjectType.identityCredential:
case CredentialSubjectType.eudiPid:
case CredentialSubjectType.pid:
return Colors.white;
return const Color(0xff6600FF);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/helper_functions/get_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dynamic getDisplay(dynamic value, String languageCode) {
element['locale'].toString().contains('en'),
orElse: () => displays.firstWhere(
(element) =>
element is Map<String, dynamic> && element.containsKey('locale'),
element is Map<String, dynamic> && !element.containsKey('locale'),
orElse: () => displays.firstWhere(
(element) =>
element is Map<String, dynamic>, // if local is not provided
Expand Down
10 changes: 6 additions & 4 deletions lib/app/shared/helper_functions/helper_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,7 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
(Display display) => display.locale.toString().contains('en'),
) ??
credSupportedDisplay.firstWhereOrNull(
(Display display) => display.locale != null,
(Display display) => display.locale == null,
) ??
credSupportedDisplay.first; // if local is not provided
}
Expand Down Expand Up @@ -1791,7 +1791,8 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
) ??
displays.firstWhereOrNull(
(Display display) => display.locale != null,
);
) ??
displays.first; // if local is not provided
}
}
}
Expand All @@ -1808,8 +1809,9 @@ Future<(String?, String?, String?, String?, String?)> getClientDetails({
(Display display) => display.locale.toString().contains('en'),
) ??
displays.firstWhereOrNull(
(Display display) => display.locale != null,
);
(Display display) => display.locale == null,
) ??
displays.first; // if local is not provided;
}
return (display, credentialSupported);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Credential {
return Credential(
'dummy1',
['dummy2'],
['dummy3'],
[''],
'dummy4',
'dummy5',
'', //date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class Oidc4vcCredentialPickView extends StatelessWidget {
),
credDisplayType: CredDisplayType.List,
profileSetting: profileSetting,
displyalDescription: false,
displyalDescription: true,
isDiscover: false,
)
else
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: altme
description: AltMe Flutter App

version: 2.18.17+5590
version: 2.18.18+5591

publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment:
Expand Down

0 comments on commit 5353601

Please sign in to comment.