TF-1194 edit default identity: update presentation layer
This commit is contained in:
@@ -252,14 +252,22 @@ class IdentityCreatorController extends BaseController {
|
|||||||
.getSmallestOrderedIdentity(identities)
|
.getSmallestOrderedIdentity(identities)
|
||||||
?.map((identity) => identity.id!);
|
?.map((identity) => identity.id!);
|
||||||
|
|
||||||
// if all identities have same sortOrder, it means it don't have default identity
|
if (haveDefaultIdentities(identities, listDefaultIdentityIds) &&
|
||||||
if (listDefaultIdentityIds?.length == identities?.length) {
|
listDefaultIdentityIds?.contains(identity?.id) == true
|
||||||
isDefaultIdentity.value = false;
|
) {
|
||||||
|
isDefaultIdentity.value = true;
|
||||||
} else {
|
} else {
|
||||||
isDefaultIdentity.value = listDefaultIdentityIds?.contains(identity?.id) ?? false;
|
isDefaultIdentity.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool haveDefaultIdentities(
|
||||||
|
Iterable<Identity>? allIdentities,
|
||||||
|
Iterable<IdentityId>? defaultIdentityIds
|
||||||
|
) {
|
||||||
|
return defaultIdentityIds?.length != allIdentities?.length;
|
||||||
|
}
|
||||||
|
|
||||||
void selectSignatureType(BuildContext context, SignatureType newSignatureType) async {
|
void selectSignatureType(BuildContext context, SignatureType newSignatureType) async {
|
||||||
if (newSignatureType == SignatureType.plainText && !BuildUtils.isWeb) {
|
if (newSignatureType == SignatureType.plainText && !BuildUtils.isWeb) {
|
||||||
final signatureText = await _getSignatureHtmlText();
|
final signatureText = await _getSignatureHtmlText();
|
||||||
|
|||||||
@@ -205,10 +205,12 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
|||||||
Column(children: [
|
Column(children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 14),
|
padding: const EdgeInsets.only(top: 14),
|
||||||
child: Text(controller.actionType.value == IdentityActionType.create
|
child: Obx(() {
|
||||||
|
return Text(controller.actionType.value == IdentityActionType.create
|
||||||
? AppLocalizations.of(context).createNewIdentity.inCaps
|
? AppLocalizations.of(context).createNewIdentity.inCaps
|
||||||
: AppLocalizations.of(context).edit_identity.inCaps,
|
: AppLocalizations.of(context).edit_identity.inCaps,
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: Colors.black))),
|
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: Colors.black));
|
||||||
|
})),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: KeyboardRichText(
|
child: KeyboardRichText(
|
||||||
|
|||||||
Reference in New Issue
Block a user