TF-1074 Handle go to path /identity_creator
This commit is contained in:
@@ -16,4 +16,8 @@ class IdentityCreatorBindings extends Bindings {
|
||||
Get.find<GetAllIdentitiesInteractor>(),
|
||||
));
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
Get.delete<IdentityCreatorController>();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:enough_html_editor/enough_html_editor.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:html_editor_enhanced/html_editor.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
@@ -10,9 +10,12 @@ import 'package:jmap_dart_client/jmap/core/id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:model/extensions/email_address_extension.dart';
|
||||
import 'package:model/extensions/identity_extension.dart';
|
||||
import 'package:model/user/user_profile.dart';
|
||||
import 'package:rich_text_composer/richtext_controller.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/model/signature_type.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/email_address_validator.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/empty_name_validator.dart';
|
||||
@@ -23,17 +26,19 @@ import 'package:tmail_ui_user/features/manage_account/domain/model/create_new_id
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/model/edit_identity_request.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_identities_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_identities_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/identity_action_type.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/identities_controller.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
typedef OnCreatedIdentityCallback = Function(dynamic arguments);
|
||||
|
||||
class IdentityCreatorController extends BaseController {
|
||||
|
||||
final VerifyNameInteractor _verifyNameInteractor;
|
||||
final GetAllIdentitiesInteractor _getAllIdentitiesInteractor;
|
||||
|
||||
final _uuid = Get.find<Uuid>();
|
||||
|
||||
final noneEmailAddress = EmailAddress(null, 'None');
|
||||
final signatureType = SignatureType.plainText.obs;
|
||||
final listEmailAddressDefault = <EmailAddress>[].obs;
|
||||
@@ -43,29 +48,26 @@ class IdentityCreatorController extends BaseController {
|
||||
final emailOfIdentity = Rxn<EmailAddress>();
|
||||
final replyToOfIdentity = Rxn<EmailAddress>();
|
||||
final bccOfIdentity = Rxn<EmailAddress>();
|
||||
final _uuid = Get.find<Uuid>();
|
||||
final _identitiesController = Get.find<IdentitiesController>();
|
||||
final _accountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||
final actionType = IdentityActionType.create.obs;
|
||||
|
||||
final RichTextController keyboardRichTextController = RichTextController();
|
||||
|
||||
final HtmlEditorController signatureHtmlEditorController = HtmlEditorController(processNewLineAsBr: true);
|
||||
final TextEditingController signaturePlainEditorController = TextEditingController();
|
||||
final TextEditingController inputNameIdentityController = TextEditingController();
|
||||
final TextEditingController inputBccIdentityController = TextEditingController();
|
||||
final FocusNode inputNameIdentityFocusNode = FocusNode();
|
||||
|
||||
late Worker identityCreatorIsActiveWorker;
|
||||
late RichTextController keyboardRichTextController;
|
||||
late HtmlEditorController signatureHtmlEditorController;
|
||||
TextEditingController? signaturePlainEditorController;
|
||||
TextEditingController? inputNameIdentityController;
|
||||
TextEditingController? inputBccIdentityController;
|
||||
FocusNode? inputNameIdentityFocusNode;
|
||||
|
||||
HtmlEditorApi? signatureHtmlEditorMobileController;
|
||||
AccountId? get accountId => _identitiesController.identityCreatorArguments.value!.accountId;
|
||||
UserProfile? get userProfile => _identitiesController.identityCreatorArguments.value!.userProfile;
|
||||
Identity? get identity => _identitiesController.identityCreatorArguments.value!.identity;
|
||||
IdentityActionType get actionType => _identitiesController.identityCreatorArguments.value!.actionType;
|
||||
String? _nameIdentity;
|
||||
String? _contentHtmlEditor;
|
||||
AccountId? accountId;
|
||||
UserProfile? userProfile;
|
||||
Identity? identity;
|
||||
IdentityCreatorArguments? arguments;
|
||||
OnCreatedIdentityCallback? onCreatedIdentityCallback;
|
||||
VoidCallback? onDismissIdentityCreator;
|
||||
ScrollController? scrollController;
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
final GlobalKey htmlKey = GlobalKey();
|
||||
|
||||
void updateNameIdentity(BuildContext context, String? value) {
|
||||
@@ -83,33 +85,34 @@ class IdentityCreatorController extends BaseController {
|
||||
);
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
_setUpValueFromIdentity();
|
||||
_getAllIdentities();
|
||||
_initWorker();
|
||||
super.onReady();
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
keyboardRichTextController = RichTextController();
|
||||
signatureHtmlEditorController = HtmlEditorController(processNewLineAsBr: true);
|
||||
signaturePlainEditorController = TextEditingController();
|
||||
inputNameIdentityController = TextEditingController();
|
||||
inputBccIdentityController = TextEditingController();
|
||||
inputNameIdentityFocusNode = FocusNode();
|
||||
scrollController = ScrollController();
|
||||
}
|
||||
|
||||
void _initWorker() {
|
||||
identityCreatorIsActiveWorker = ever(_accountDashBoardController.identityCreatorIsActive, (identityCreatorIsActive) {
|
||||
if (identityCreatorIsActive == true) {
|
||||
if (actionType == IdentityActionType.edit && identity != null) {
|
||||
_setUpValueFromIdentity();
|
||||
_setUpAllFieldEmailAddress();
|
||||
}
|
||||
}
|
||||
});
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
if (arguments != null) {
|
||||
accountId = arguments!.accountId;
|
||||
userProfile = arguments!.userProfile;
|
||||
identity = arguments!.identity;
|
||||
actionType.value = arguments!.actionType;
|
||||
_setUpValueFromIdentity();
|
||||
_getAllIdentities();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
signaturePlainEditorController.dispose();
|
||||
inputNameIdentityFocusNode.dispose();
|
||||
inputNameIdentityController.dispose();
|
||||
inputBccIdentityController.dispose();
|
||||
identityCreatorIsActiveWorker.dispose();
|
||||
keyboardRichTextController.dispose();
|
||||
scrollController.dispose();
|
||||
_disposeWidget();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@@ -134,10 +137,10 @@ class IdentityCreatorController extends BaseController {
|
||||
|
||||
void _setUpValueFromIdentity() {
|
||||
_nameIdentity = identity?.name ?? '';
|
||||
inputNameIdentityController.text = identity?.name ?? '';
|
||||
inputNameIdentityController?.text = identity?.name ?? '';
|
||||
|
||||
if (identity?.textSignature?.value.isNotEmpty == true) {
|
||||
signaturePlainEditorController.text = identity?.textSignature?.value ?? '';
|
||||
signaturePlainEditorController?.text = identity?.textSignature?.value ?? '';
|
||||
}
|
||||
|
||||
if (identity?.htmlSignature?.value.isNotEmpty == true) {
|
||||
@@ -147,6 +150,7 @@ class IdentityCreatorController extends BaseController {
|
||||
}
|
||||
|
||||
void _getAllIdentities() {
|
||||
log('IdentityCreatorController::_getAllIdentities() ');
|
||||
if (accountId != null) {
|
||||
consumeState(_getAllIdentitiesInteractor.execute(
|
||||
accountId!,
|
||||
@@ -164,8 +168,6 @@ class IdentityCreatorController extends BaseController {
|
||||
listEmailAddressOfReplyTo.add(noneEmailAddress);
|
||||
listEmailAddressOfReplyTo.addAll(listEmailAddressDefault);
|
||||
|
||||
log('IdentityCreatorController::_getALlIdentitiesSuccess(): listEmailAddressOfReplyTo: ${listEmailAddressOfReplyTo.toJson()}');
|
||||
|
||||
_setUpAllFieldEmailAddress();
|
||||
} else {
|
||||
_setDefaultEmailAddressList();
|
||||
@@ -189,7 +191,10 @@ class IdentityCreatorController extends BaseController {
|
||||
}
|
||||
|
||||
void _setUpAllFieldEmailAddress() {
|
||||
if (actionType == IdentityActionType.edit && identity != null) {
|
||||
listEmailAddressOfReplyTo.value = listEmailAddressOfReplyTo.toSet().toList();
|
||||
listEmailAddressDefault.value = listEmailAddressDefault.toSet().toList();
|
||||
|
||||
if (actionType.value == IdentityActionType.edit && identity != null) {
|
||||
if (identity?.replyTo?.isNotEmpty == true) {
|
||||
try {
|
||||
replyToOfIdentity.value = listEmailAddressOfReplyTo
|
||||
@@ -200,17 +205,14 @@ class IdentityCreatorController extends BaseController {
|
||||
} else {
|
||||
replyToOfIdentity.value = noneEmailAddress;
|
||||
}
|
||||
log('IdentityCreatorController::_setUpAllFieldEmailAddress(): replyToOfIdentity: ${replyToOfIdentity.value}');
|
||||
|
||||
if (identity?.bcc?.isNotEmpty == true) {
|
||||
bccOfIdentity.value = identity?.bcc!.first;
|
||||
inputBccIdentityController.text = identity?.bcc!.first.emailAddress ?? '';
|
||||
inputBccIdentityController?.text = identity?.bcc!.first.emailAddress ?? '';
|
||||
} else {
|
||||
bccOfIdentity.value = null;
|
||||
}
|
||||
|
||||
log('IdentityCreatorController::_setUpAllFieldEmailAddress(): bccOfIdentity: ${bccOfIdentity.value}');
|
||||
|
||||
if (identity?.email?.isNotEmpty == true) {
|
||||
try {
|
||||
emailOfIdentity.value = listEmailAddressDefault
|
||||
@@ -235,7 +237,6 @@ class IdentityCreatorController extends BaseController {
|
||||
void selectSignatureType(BuildContext context, SignatureType newSignatureType) async {
|
||||
if (newSignatureType == SignatureType.plainText && !BuildUtils.isWeb) {
|
||||
final signatureText = await _getSignatureHtmlText();
|
||||
log('IdentityCreatorController::selectSignatureType(): signatureText: $signatureText');
|
||||
updateContentHtmlEditor(signatureText);
|
||||
}
|
||||
clearFocusEditor(context);
|
||||
@@ -267,19 +268,17 @@ class IdentityCreatorController extends BaseController {
|
||||
|
||||
final error = _getErrorInputNameString(context);
|
||||
if (error?.isNotEmpty == true) {
|
||||
log('IdentityCreatorController::createNewIdentity(): error: $error');
|
||||
errorNameIdentity.value = error;
|
||||
return;
|
||||
}
|
||||
|
||||
final errorBcc = _getErrorInputAddressString(context);
|
||||
if (errorBcc?.isNotEmpty == true) {
|
||||
log('IdentityCreatorController::createNewIdentity(): errorBcc: $errorBcc');
|
||||
errorBccIdentity.value = errorBcc;
|
||||
return;
|
||||
}
|
||||
|
||||
final signaturePlainText = signaturePlainEditorController.text;
|
||||
final signaturePlainText = signaturePlainEditorController?.text ?? '';
|
||||
final signatureHtmlText = BuildUtils.isWeb
|
||||
? contentHtmlEditor
|
||||
: await _getSignatureHtmlText();
|
||||
@@ -290,11 +289,6 @@ class IdentityCreatorController extends BaseController {
|
||||
? {replyToOfIdentity.value!}
|
||||
: <EmailAddress>{};
|
||||
|
||||
log('IdentityCreatorController::createNewIdentity(): bccAddress: $bccAddress');
|
||||
log('IdentityCreatorController::createNewIdentity(): replyToAddress: $replyToAddress');
|
||||
log('IdentityCreatorController::createNewIdentity(): signaturePlainText: $signaturePlainText');
|
||||
log('IdentityCreatorController::createNewIdentity(): signatureHtmlText: $signatureHtmlText');
|
||||
|
||||
final newIdentity = Identity(
|
||||
name: _nameIdentity,
|
||||
email: emailOfIdentity.value?.email,
|
||||
@@ -303,29 +297,29 @@ class IdentityCreatorController extends BaseController {
|
||||
textSignature: Signature(signaturePlainText),
|
||||
htmlSignature: Signature(signatureHtmlText ?? ''));
|
||||
|
||||
log('IdentityCreatorController::createNewIdentity(): $newIdentity');
|
||||
|
||||
final generateCreateId = Id(_uuid.v1());
|
||||
|
||||
if(actionType == IdentityActionType.create) {
|
||||
_identitiesController.createNewIdentityAction(
|
||||
accountId!,
|
||||
CreateNewIdentityRequest(generateCreateId, newIdentity),
|
||||
);
|
||||
} else {
|
||||
_identitiesController.editIdentityAction(
|
||||
accountId!,
|
||||
EditIdentityRequest(
|
||||
identityId: identity!.id!,
|
||||
identityRequest: newIdentity.toIdentityRequest(),
|
||||
)
|
||||
);
|
||||
}
|
||||
if (actionType.value == IdentityActionType.create) {
|
||||
final identityRequest = CreateNewIdentityRequest(generateCreateId, newIdentity);
|
||||
|
||||
if (BuildUtils.isWeb) {
|
||||
_disposeWidget();
|
||||
onCreatedIdentityCallback?.call(identityRequest);
|
||||
} else {
|
||||
popBack(result: identityRequest);
|
||||
}
|
||||
|
||||
if(kIsWeb) {
|
||||
_accountDashBoardController.identityCreatorIsActive.toggle();
|
||||
} else {
|
||||
popBack();
|
||||
final identityRequest = EditIdentityRequest(
|
||||
identityId: identity!.id!,
|
||||
identityRequest: newIdentity.toIdentityRequest());
|
||||
|
||||
if (BuildUtils.isWeb) {
|
||||
_disposeWidget();
|
||||
onCreatedIdentityCallback?.call(identityRequest);
|
||||
} else {
|
||||
popBack(result: identityRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +340,7 @@ class IdentityCreatorController extends BaseController {
|
||||
}
|
||||
|
||||
String? _getErrorInputAddressString(BuildContext context, {String? value}) {
|
||||
final emailAddress = value ?? inputBccIdentityController.text;
|
||||
final emailAddress = value ?? inputBccIdentityController?.text ?? '';
|
||||
if (emailAddress.trim().isEmpty) {
|
||||
return null;
|
||||
}
|
||||
@@ -374,9 +368,9 @@ class IdentityCreatorController extends BaseController {
|
||||
}
|
||||
|
||||
void _clearAll() {
|
||||
signaturePlainEditorController.clear();
|
||||
inputNameIdentityController.clear();
|
||||
inputBccIdentityController.clear();
|
||||
signaturePlainEditorController?.clear();
|
||||
inputNameIdentityController?.clear();
|
||||
inputBccIdentityController?.clear();
|
||||
}
|
||||
|
||||
List<EmailAddress> getSuggestionEmailAddress(String? pattern) {
|
||||
@@ -398,28 +392,46 @@ class IdentityCreatorController extends BaseController {
|
||||
void closeView(BuildContext context) {
|
||||
_clearAll();
|
||||
clearFocusEditor(context);
|
||||
if(kIsWeb) {
|
||||
_accountDashBoardController.identityCreatorIsActive.toggle();
|
||||
|
||||
if (BuildUtils.isWeb) {
|
||||
_disposeWidget();
|
||||
onDismissIdentityCreator?.call();
|
||||
} else {
|
||||
popBack();
|
||||
}
|
||||
}
|
||||
|
||||
void _disposeWidget() {
|
||||
signaturePlainEditorController?.dispose();
|
||||
signaturePlainEditorController = null;
|
||||
inputNameIdentityFocusNode?.dispose();
|
||||
inputNameIdentityFocusNode = null;
|
||||
inputNameIdentityController?.dispose();
|
||||
inputNameIdentityController = null;
|
||||
inputBccIdentityController?.dispose();
|
||||
inputBccIdentityController = null;
|
||||
scrollController?.dispose();
|
||||
scrollController = null;
|
||||
}
|
||||
|
||||
void onFocusHTMLEditor() async {
|
||||
await Scrollable.ensureVisible(htmlKey.currentContext!);
|
||||
await Future.delayed(const Duration(milliseconds: 500), () {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.pixels + defaultKeyboardToolbarHeight,
|
||||
duration: const Duration(milliseconds: 1),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
if (scrollController != null) {
|
||||
scrollController!.animateTo(
|
||||
scrollController!.position.pixels + defaultKeyboardToolbarHeight,
|
||||
duration: const Duration(milliseconds: 1),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void onEnterKeyDown() {
|
||||
if(scrollController.position.pixels < scrollController.position.maxScrollExtent) {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.pixels + 20,
|
||||
if(scrollController != null &&
|
||||
scrollController!.position.pixels < scrollController!.position.maxScrollExtent) {
|
||||
scrollController!.animateTo(
|
||||
scrollController!.position.pixels + 20,
|
||||
duration: const Duration(milliseconds: 1),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||
import 'package:rich_text_composer/views/keyboard_richtext.dart';
|
||||
import 'package:rich_text_composer/views/widgets/rich_text_keyboard_toolbar.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/identity_creator_controller.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/model/identity_creator_arguments.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/model/signature_type.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/widgets/identity_drop_list_field_builder.dart';
|
||||
import 'package:tmail_ui_user/features/identity_creator/presentation/widgets/identity_field_no_editable_builder.dart';
|
||||
@@ -21,7 +22,23 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
IdentityCreatorView({Key? key}) : super(key: key);
|
||||
@override
|
||||
final controller = Get.find<IdentityCreatorController>();
|
||||
|
||||
IdentityCreatorView({Key? key}) : super(key: key) {
|
||||
controller.arguments = Get.arguments;
|
||||
}
|
||||
|
||||
IdentityCreatorView.fromArguments(
|
||||
IdentityCreatorArguments arguments, {
|
||||
Key? key,
|
||||
OnCreatedIdentityCallback? onCreatedIdentityCallback,
|
||||
VoidCallback? onDismissCallback
|
||||
}) : super(key: key) {
|
||||
controller.arguments = arguments;
|
||||
controller.onCreatedIdentityCallback = onCreatedIdentityCallback;
|
||||
controller.onDismissIdentityCreator = onDismissCallback;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -52,7 +69,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
)
|
||||
),
|
||||
tablet: Scaffold(
|
||||
backgroundColor: Colors.black38,
|
||||
backgroundColor: Colors.black.withAlpha(24),
|
||||
body: GestureDetector(
|
||||
onTap: () => controller.clearFocusEditor(context),
|
||||
child: KeyboardRichText(
|
||||
@@ -66,7 +83,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
titleFormatBottomSheet: AppLocalizations.of(context).titleFormat,
|
||||
titleBack: AppLocalizations.of(context).format,
|
||||
),
|
||||
child: Align(alignment: Alignment.center, child: Card(
|
||||
child: Center(child: Card(
|
||||
color: Colors.transparent,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
child: Container(
|
||||
@@ -85,7 +102,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
),
|
||||
),
|
||||
tabletLarge: Scaffold(
|
||||
backgroundColor: Colors.black38,
|
||||
backgroundColor: Colors.black.withAlpha(24),
|
||||
body: GestureDetector(
|
||||
onTap: () => controller.clearFocusEditor(context),
|
||||
child: KeyboardRichText(
|
||||
@@ -99,7 +116,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
titleFormatBottomSheet: AppLocalizations.of(context).titleFormat,
|
||||
titleBack: AppLocalizations.of(context).format,
|
||||
),
|
||||
child: Align(alignment: Alignment.center, child: Card(
|
||||
child: Center(child: Card(
|
||||
color: Colors.transparent,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
child: Container(
|
||||
@@ -118,10 +135,10 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
)
|
||||
),
|
||||
desktop: Scaffold(
|
||||
backgroundColor: Colors.black38,
|
||||
backgroundColor: Colors.black.withAlpha(24),
|
||||
body: GestureDetector(
|
||||
onTap: () => controller.clearFocusEditor(context),
|
||||
child: Align(alignment: Alignment.center, child: Card(
|
||||
child: Center(child: Card(
|
||||
color: Colors.transparent,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(16))),
|
||||
child: Container(
|
||||
@@ -135,8 +152,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
child: _buildBodyDesktop(context)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
)),
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -148,7 +164,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 24, top: 24),
|
||||
child: Obx(() => Text(controller.actionType == IdentityActionType.create
|
||||
child: Obx(() => Text(controller.actionType.value == IdentityActionType.create
|
||||
? AppLocalizations.of(context).new_identity.inCaps
|
||||
: AppLocalizations.of(context).edit_identity.inCaps,
|
||||
style: const TextStyle(
|
||||
@@ -173,7 +189,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
.build())),
|
||||
const SizedBox(width: 24),
|
||||
Expanded(child: Obx(() {
|
||||
if (controller.actionType == IdentityActionType.create) {
|
||||
if (controller.actionType.value == IdentityActionType.create) {
|
||||
return (IdentityDropListFieldBuilder(
|
||||
_imagePaths,
|
||||
AppLocalizations.of(context).email.inCaps,
|
||||
@@ -206,7 +222,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
controller.errorBccIdentity.value,
|
||||
controller.inputBccIdentityController)
|
||||
..addOnSelectedSuggestionAction((newEmailAddress) {
|
||||
controller.inputBccIdentityController.text = newEmailAddress?.email ?? '';
|
||||
controller.inputBccIdentityController?.text = newEmailAddress?.email ?? '';
|
||||
controller.updateBccOfIdentity(newEmailAddress);
|
||||
})
|
||||
..addOnChangeInputSuggestionAction((pattern) {
|
||||
@@ -273,7 +289,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
onTap: () => controller.closeView(context)),
|
||||
const SizedBox(width: 12),
|
||||
Obx(() => buildTextButton(
|
||||
controller.actionType == IdentityActionType.create
|
||||
controller.actionType.value == IdentityActionType.create
|
||||
? AppLocalizations.of(context).create
|
||||
: AppLocalizations.of(context).save,
|
||||
width: 128,
|
||||
@@ -299,7 +315,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
Column(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 16),
|
||||
child: Text(controller.actionType == IdentityActionType.create
|
||||
child: Text(controller.actionType.value == IdentityActionType.create
|
||||
? AppLocalizations.of(context).new_identity.inCaps
|
||||
: AppLocalizations.of(context).edit_identity.inCaps,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 21, color: Colors.black))),
|
||||
@@ -321,7 +337,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
.build()),
|
||||
const SizedBox(height: 24),
|
||||
Obx(() {
|
||||
if (controller.actionType == IdentityActionType.create) {
|
||||
if (controller.actionType.value == IdentityActionType.create) {
|
||||
return (IdentityDropListFieldBuilder(
|
||||
_imagePaths,
|
||||
AppLocalizations.of(context).email.inCaps,
|
||||
@@ -352,7 +368,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
controller.errorBccIdentity.value,
|
||||
controller.inputBccIdentityController)
|
||||
..addOnSelectedSuggestionAction((newEmailAddress) {
|
||||
controller.inputBccIdentityController.text = newEmailAddress?.email ?? '';
|
||||
controller.inputBccIdentityController?.text = newEmailAddress?.email ?? '';
|
||||
controller.updateBccOfIdentity(newEmailAddress);
|
||||
})
|
||||
..addOnChangeInputSuggestionAction((pattern) {
|
||||
@@ -422,7 +438,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Obx(() => buildTextButton(
|
||||
controller.actionType == IdentityActionType.create
|
||||
controller.actionType.value == IdentityActionType.create
|
||||
? AppLocalizations.of(context).create
|
||||
: AppLocalizations.of(context).save,
|
||||
width: 128,
|
||||
@@ -459,7 +475,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
}
|
||||
|
||||
Widget _buildSignatureButton(BuildContext context, SignatureType signatureType) {
|
||||
return buildTextButton(
|
||||
return buildButtonWrapText(
|
||||
signatureType.getTitle(context),
|
||||
textStyle: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -467,10 +483,9 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
color: controller.signatureType.value == signatureType
|
||||
? AppColor.colorContentEmail
|
||||
: AppColor.colorHintSearchBar),
|
||||
backgroundColor: controller.signatureType.value == signatureType
|
||||
bgColor: controller.signatureType.value == signatureType
|
||||
? AppColor.emailAddressChipColor
|
||||
: Colors.transparent,
|
||||
width: signatureType == SignatureType.plainText ? 85 : 110,
|
||||
height: 30,
|
||||
radius: 10,
|
||||
onTap: () => controller.selectSignatureType(context, signatureType));
|
||||
|
||||
+4
-2
@@ -43,7 +43,8 @@ class IdentityDropListFieldBuilder {
|
||||
_emailAddressSelected?.email ?? '',
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
||||
maxLines: 1,
|
||||
overflow: BuildUtils.isWeb ? null : TextOverflow.ellipsis,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
)),
|
||||
],
|
||||
),
|
||||
@@ -53,7 +54,8 @@ class IdentityDropListFieldBuilder {
|
||||
item.email ?? '',
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
||||
maxLines: 1,
|
||||
overflow: BuildUtils.isWeb ? null : TextOverflow.ellipsis,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
),
|
||||
)).toList(),
|
||||
value: _emailAddressSelected,
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ class IdentityInputWithDropListFieldBuilder {
|
||||
|
||||
final String _label;
|
||||
final String? _error;
|
||||
final TextEditingController editingController;
|
||||
final TextEditingController? editingController;
|
||||
|
||||
OnSelectedSuggestionAction? _onSelectedSuggestionAction;
|
||||
OnSuggestionCallbackAction? _onSuggestionCallbackAction;
|
||||
|
||||
Reference in New Issue
Block a user