-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use default card for polygonId credential #1740
- Loading branch information
Showing
10 changed files
with
174 additions
and
59 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
lib/dashboard/home/tab_bar/credentials/widgets/credential_widget/default_polygonid_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import 'package:altme/app/app.dart'; | ||
import 'package:altme/dashboard/dashboard.dart'; | ||
import 'package:credential_manifest/credential_manifest.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class DefaultPolygonIdCardWidget extends StatelessWidget { | ||
const DefaultPolygonIdCardWidget({ | ||
super.key, | ||
required this.credentialModel, | ||
}); | ||
|
||
final CredentialModel credentialModel; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final DisplayMapping? titleDisplayMapping = credentialModel | ||
.credentialManifest!.outputDescriptors?.first.display?.title; | ||
|
||
var title = ''; | ||
|
||
if (titleDisplayMapping is DisplayMappingText) { | ||
title = titleDisplayMapping.text; | ||
} | ||
|
||
if (titleDisplayMapping is DisplayMappingPath) { | ||
title = titleDisplayMapping.fallback ?? ''; | ||
} | ||
|
||
final DisplayMapping? subTitleDisplayMapping = credentialModel | ||
.credentialManifest!.outputDescriptors?.first.display?.subtitle; | ||
|
||
var subTitle = ''; | ||
|
||
if (subTitleDisplayMapping is DisplayMappingText) { | ||
subTitle = subTitleDisplayMapping.text; | ||
} | ||
|
||
if (subTitleDisplayMapping is DisplayMappingPath) { | ||
subTitle = subTitleDisplayMapping.fallback ?? ''; | ||
} | ||
|
||
return CredentialBaseWidget( | ||
title: title, | ||
cardBackgroundImagePath: ImageStrings.defaultPolygonCard, | ||
issuerName: 'ALTME', | ||
value: subTitle, | ||
issuanceDate: UiDate.formatDateForCredentialCard( | ||
credentialModel.credentialPreview.issuanceDate, | ||
), | ||
expirationDate: credentialModel.expirationDate == null | ||
? '--' | ||
: UiDate.formatDateForCredentialCard(credentialModel.expirationDate!), | ||
); | ||
} | ||
} |