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 identitySelected = Rxn<Identity>();
final signatureSelected = Rxn<String>(); final signatureSelected = Rxn<String>();
final _htmlSignature = Rxn<bool>();
final listAllIdentities = <Identity>[].obs; final listAllIdentities = <Identity>[].obs;
IdentitiesController( IdentitiesController(
@@ -162,10 +163,15 @@ class IdentitiesController extends BaseController {
} }
}); });
} else { } else {
_hideHtmlSignature();
final newIdentityArguments = await push( final newIdentityArguments = await push(
AppRoutes.identityCreator, AppRoutes.identityCreator,
arguments: arguments); arguments: arguments);
if(newIdentityArguments == true) {
_showHtmlSignature();
}
if (newIdentityArguments is CreateNewIdentityRequest) { if (newIdentityArguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, newIdentityArguments); _createNewIdentityAction(session, accountId, newIdentityArguments);
} else if (newIdentityArguments is EditIdentityRequest) { } else if (newIdentityArguments is EditIdentityRequest) {
@@ -181,7 +187,7 @@ class IdentitiesController extends BaseController {
CreateNewIdentityRequest identityRequest CreateNewIdentityRequest identityRequest
) async { ) async {
if (identityRequest.isDefaultIdentity) { if (identityRequest.isDefaultIdentity) {
consumeState(_createNewDefaultIdentityInteractor.execute(session, accountId, identityRequest)); consumeState(_createNewDefaultIdentityInteractor.execute(session, accountId, identityRequest));
} else { } else {
consumeState(_createNewIdentityInteractor.execute(session, accountId, identityRequest)); consumeState(_createNewIdentityInteractor.execute(session, accountId, identityRequest));
} }
@@ -193,6 +199,7 @@ class IdentitiesController extends BaseController {
currentOverlayContext!, currentOverlayContext!,
AppLocalizations.of(currentContext!).you_have_created_a_new_identity); AppLocalizations.of(currentContext!).you_have_created_a_new_identity);
} }
_showHtmlSignature();
_refreshAllIdentities(); _refreshAllIdentities();
} }
@@ -203,6 +210,7 @@ class IdentitiesController extends BaseController {
currentOverlayContext!, currentOverlayContext!,
AppLocalizations.of(currentContext!).you_have_created_a_new_default_identity); AppLocalizations.of(currentContext!).you_have_created_a_new_default_identity);
} }
_showHtmlSignature();
_refreshAllIdentities(); _refreshAllIdentities();
} }
@@ -287,10 +295,15 @@ class IdentitiesController extends BaseController {
} }
}); });
} else { } else {
_hideHtmlSignature();
final newIdentityArguments = await push( final newIdentityArguments = await push(
AppRoutes.identityCreator, AppRoutes.identityCreator,
arguments: arguments); arguments: arguments);
if(newIdentityArguments == true) {
_showHtmlSignature();
}
if (newIdentityArguments is CreateNewIdentityRequest) { if (newIdentityArguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, newIdentityArguments); _createNewIdentityAction(session, accountId, newIdentityArguments);
} else if (newIdentityArguments is EditIdentityRequest) { } else if (newIdentityArguments is EditIdentityRequest) {
@@ -318,6 +331,7 @@ class IdentitiesController extends BaseController {
currentOverlayContext!, currentOverlayContext!,
AppLocalizations.of(currentContext!).you_are_changed_your_identity_successfully); AppLocalizations.of(currentContext!).you_are_changed_your_identity_successfully);
} }
_showHtmlSignature();
_refreshAllIdentities(); _refreshAllIdentities();
} }
@@ -325,4 +339,13 @@ class IdentitiesController extends BaseController {
ImagePaths get imagePaths => _imagePaths; ImagePaths get imagePaths => _imagePaths;
bool get isSignatureShow => identitySelected.value != null; 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), _buildListIdentityView(context),
Container(height: 1, color: AppColor.attachmentFileBorderColor), Container(height: 1, color: AppColor.attachmentFileBorderColor),
Obx(() { Obx(() {
if (controller.signatureSelected.value != null) { if (controller.isShowHtmlSignature) {
return SignatureBuilder(controller.signatureSelected.value!); return SignatureBuilder(controller.signatureSelected.value!);
} else { } else {
return _buildLoadingView(); return _buildLoadingView();