TF-1679: Fix button close is hide

(cherry picked from commit 428f7fe45574b650465c8ea453014571496754a3)
This commit is contained in:
HuyNguyen
2023-04-05 02:19:12 +07:00
committed by Dat Vu
parent 3d788632c3
commit b19a85ac36
2 changed files with 25 additions and 2 deletions
@@ -53,6 +53,7 @@ class IdentitiesController extends BaseController {
final identitySelected = Rxn<Identity>();
final signatureSelected = Rxn<String>();
final _htmlSignature = Rxn<bool>();
final listAllIdentities = <Identity>[].obs;
IdentitiesController(
@@ -162,10 +163,15 @@ class IdentitiesController extends BaseController {
}
});
} else {
_hideHtmlSignature();
final newIdentityArguments = await push(
AppRoutes.identityCreator,
arguments: arguments);
if(newIdentityArguments == true) {
_showHtmlSignature();
}
if (newIdentityArguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, newIdentityArguments);
} else if (newIdentityArguments is EditIdentityRequest) {
@@ -181,7 +187,7 @@ class IdentitiesController extends BaseController {
CreateNewIdentityRequest identityRequest
) async {
if (identityRequest.isDefaultIdentity) {
consumeState(_createNewDefaultIdentityInteractor.execute(session, accountId, identityRequest));
consumeState(_createNewDefaultIdentityInteractor.execute(session, accountId, identityRequest));
} else {
consumeState(_createNewIdentityInteractor.execute(session, accountId, identityRequest));
}
@@ -193,6 +199,7 @@ class IdentitiesController extends BaseController {
currentOverlayContext!,
AppLocalizations.of(currentContext!).you_have_created_a_new_identity);
}
_showHtmlSignature();
_refreshAllIdentities();
}
@@ -203,6 +210,7 @@ class IdentitiesController extends BaseController {
currentOverlayContext!,
AppLocalizations.of(currentContext!).you_have_created_a_new_default_identity);
}
_showHtmlSignature();
_refreshAllIdentities();
}
@@ -287,10 +295,15 @@ class IdentitiesController extends BaseController {
}
});
} else {
_hideHtmlSignature();
final newIdentityArguments = await push(
AppRoutes.identityCreator,
arguments: arguments);
if(newIdentityArguments == true) {
_showHtmlSignature();
}
if (newIdentityArguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, newIdentityArguments);
} else if (newIdentityArguments is EditIdentityRequest) {
@@ -318,6 +331,7 @@ class IdentitiesController extends BaseController {
currentOverlayContext!,
AppLocalizations.of(currentContext!).you_are_changed_your_identity_successfully);
}
_showHtmlSignature();
_refreshAllIdentities();
}
@@ -325,4 +339,13 @@ class IdentitiesController extends BaseController {
ImagePaths get imagePaths => _imagePaths;
bool get isSignatureShow => identitySelected.value != null;
bool get isShowHtmlSignature => _htmlSignature.value ?? true;
void _hideHtmlSignature() async {
await Future.delayed(const Duration(milliseconds: 100));
_htmlSignature.value = false;
}
void _showHtmlSignature() => _htmlSignature.value = true;
}
@@ -49,7 +49,7 @@ class IdentitiesRadioListBuilder extends StatelessWidget {
_buildListIdentityView(context),
Container(height: 1, color: AppColor.attachmentFileBorderColor),
Obx(() {
if (controller.signatureSelected.value != null) {
if (controller.isShowHtmlSignature) {
return SignatureBuilder(controller.signatureSelected.value!);
} else {
return _buildLoadingView();