diff --git a/lib/dashboard/home/tab_bar/credentials/detail/widgets/developer_details.dart b/lib/dashboard/home/tab_bar/credentials/detail/widgets/developer_details.dart index ff68a0b1e..dcc60cbf9 100644 --- a/lib/dashboard/home/tab_bar/credentials/detail/widgets/developer_details.dart +++ b/lib/dashboard/home/tab_bar/credentials/detail/widgets/developer_details.dart @@ -2,7 +2,9 @@ import 'package:altme/app/app.dart'; import 'package:altme/dashboard/dashboard.dart'; import 'package:altme/l10n/l10n.dart'; import 'package:altme/theme/theme.dart'; +import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart'; import 'package:flutter/material.dart'; +import 'package:jwt_decode/jwt_decode.dart'; class DeveloperDetails extends StatelessWidget { const DeveloperDetails({ @@ -23,6 +25,26 @@ class DeveloperDetails extends StatelessWidget { credentialModel.credentialPreview.credentialSubjectModel.id ?? ''; final String type = credentialModel.credentialPreview.type.toString(); + final jwt = credentialModel.jwt; + + dynamic uri; + dynamic idx; + + if (jwt != null) { + final payload = JWTDecode().parseJwt(jwt); + final status = payload['status']; + if (status != null && status is Map) { + final statusList = status['status_list']; + if (statusList != null && statusList is Map) { + uri = statusList['uri']; + idx = statusList['idx']; + } + } + } + + final titleColor = Theme.of(context).colorScheme.titleColor; + final valueColor = Theme.of(context).colorScheme.valueColor; + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -30,16 +52,16 @@ class DeveloperDetails extends StatelessWidget { padding: const EdgeInsets.only(top: 10), title: l10n.format, value: credentialModel.getFormat, - titleColor: Theme.of(context).colorScheme.titleColor, - valueColor: Theme.of(context).colorScheme.valueColor, + titleColor: titleColor, + valueColor: valueColor, showVertically: showVertically, ), CredentialField( padding: const EdgeInsets.only(top: 10), title: l10n.issuerDID, value: issuerDid, - titleColor: Theme.of(context).colorScheme.titleColor, - valueColor: Theme.of(context).colorScheme.valueColor, + titleColor: titleColor, + valueColor: valueColor, showVertically: showVertically, ), if (credentialModel.credentialPreview.credentialSubjectModel @@ -49,18 +71,38 @@ class DeveloperDetails extends StatelessWidget { padding: const EdgeInsets.only(top: 10), title: l10n.subjectDID, value: subjectDid, - titleColor: Theme.of(context).colorScheme.titleColor, - valueColor: Theme.of(context).colorScheme.valueColor, + titleColor: titleColor, + valueColor: valueColor, showVertically: showVertically, ), CredentialField( padding: const EdgeInsets.only(top: 10), title: l10n.type, value: type, - titleColor: Theme.of(context).colorScheme.titleColor, - valueColor: Theme.of(context).colorScheme.valueColor, + titleColor: titleColor, + valueColor: valueColor, showVertically: showVertically, ), + if (uri != null) ...[ + CredentialField( + padding: const EdgeInsets.only(top: 10), + title: l10n.statusList, + value: uri.toString(), + titleColor: titleColor, + valueColor: valueColor, + showVertically: false, + ), + ], + if (idx != null) ...[ + CredentialField( + padding: const EdgeInsets.only(top: 10), + title: l10n.statusListIndex, + value: idx.toString(), + titleColor: titleColor, + valueColor: valueColor, + showVertically: false, + ), + ], ], ); } diff --git a/lib/dashboard/home/tab_bar/credentials/widgets/credential_widget/wallet_credential_widget.dart b/lib/dashboard/home/tab_bar/credentials/widgets/credential_widget/wallet_credential_widget.dart index 035534653..6d902fde1 100644 --- a/lib/dashboard/home/tab_bar/credentials/widgets/credential_widget/wallet_credential_widget.dart +++ b/lib/dashboard/home/tab_bar/credentials/widgets/credential_widget/wallet_credential_widget.dart @@ -4,7 +4,6 @@ import 'package:altme/l10n/l10n.dart'; import 'package:altme/theme/theme.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:jwt_decode/jwt_decode.dart'; class WalletCredentialWidget extends StatelessWidget { const WalletCredentialWidget({ @@ -50,23 +49,6 @@ class WalletCredentialetailsWidget extends StatelessWidget { final walletCredential = credentialModel .credentialPreview.credentialSubjectModel as WalletCredentialModel; - final walletAttestationData = credentialModel.jwt; - - dynamic uri; - dynamic idx; - - if (isDeveloperMode && walletAttestationData != null) { - final payload = JWTDecode().parseJwt(walletAttestationData); - final status = payload['status']; - if (status != null && status is Map) { - final statusList = status['status_list']; - if (statusList != null && statusList is Map) { - uri = statusList['uri']; - idx = statusList['idx']; - } - } - } - return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -107,28 +89,6 @@ class WalletCredentialetailsWidget extends StatelessWidget { valueColor: valueColor, showVertically: false, ), - if (context.read().state.model.isDeveloperMode) ...[ - if (uri != null) ...[ - CredentialField( - padding: const EdgeInsets.only(top: 10), - title: l10n.statusList, - value: uri.toString(), - titleColor: titleColor, - valueColor: valueColor, - showVertically: false, - ), - ], - if (idx != null) ...[ - CredentialField( - padding: const EdgeInsets.only(top: 10), - title: l10n.statusListIndex, - value: idx.toString(), - titleColor: titleColor, - valueColor: valueColor, - showVertically: false, - ), - ], - ], ], ); }