TF-537 Add presentation layer for delete a identity
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<svg width="65" height="64" viewBox="0 0 65 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0.5" width="64" height="64" rx="16" fill="#FF3B30" fill-opacity="0.12"/>
|
||||
<path d="M32.4888 43.4927C34.076 43.4927 35.5697 43.1895 36.9697 42.583C38.3698 41.984 39.6051 41.1493 40.6758 40.0786C41.7464 39.008 42.585 37.7726 43.1914 36.3726C43.7979 34.9725 44.1011 33.4788 44.1011 31.8916C44.1011 30.3044 43.7979 28.8107 43.1914 27.4106C42.585 26.0106 41.7464 24.779 40.6758 23.7158C39.6051 22.6452 38.3698 21.8066 36.9697 21.2002C35.5697 20.5938 34.0723 20.2905 32.4775 20.2905C30.8903 20.2905 29.3966 20.5938 27.9966 21.2002C26.604 21.8066 25.3724 22.6452 24.3018 23.7158C23.2386 24.779 22.4038 26.0106 21.7974 27.4106C21.1909 28.8107 20.8877 30.3044 20.8877 31.8916C20.8877 33.4788 21.1909 34.9725 21.7974 36.3726C22.4038 37.7726 23.2386 39.008 24.3018 40.0786C25.3724 41.1493 26.6077 41.984 28.0078 42.583C29.4079 43.1895 30.9015 43.4927 32.4888 43.4927ZM32.4888 41.2017C31.201 41.2017 29.9919 40.9621 28.8613 40.4829C27.7383 40.0037 26.75 39.3374 25.8965 38.4839C25.0505 37.6304 24.3879 36.6421 23.9087 35.519C23.4295 34.396 23.1899 33.1868 23.1899 31.8916C23.1899 30.6038 23.4295 29.3984 23.9087 28.2754C24.3879 27.1449 25.0505 26.1528 25.8965 25.2993C26.7425 24.4458 27.7271 23.7795 28.8501 23.3003C29.9806 22.8211 31.1898 22.5815 32.4775 22.5815C33.7728 22.5815 34.9819 22.8211 36.105 23.3003C37.228 23.7795 38.2163 24.4458 39.0698 25.2993C39.9308 26.1528 40.6009 27.1449 41.0801 28.2754C41.5592 29.3984 41.7988 30.6038 41.7988 31.8916C41.7988 33.1868 41.5592 34.396 41.0801 35.519C40.6009 36.6421 39.9346 37.6304 39.0811 38.4839C38.235 39.3374 37.2467 40.0037 36.1162 40.4829C34.9932 40.9621 33.784 41.2017 32.4888 41.2017ZM29.2095 37.0352C29.4341 37.0352 29.6138 36.9902 29.7485 36.9004C29.8908 36.8105 30.048 36.6458 30.2202 36.4062L32.4214 33.2168H32.4775L34.6787 36.4062C34.8359 36.6383 34.9857 36.8031 35.1279 36.9004C35.2702 36.9902 35.4461 37.0352 35.6558 37.0352C35.9552 37.0352 36.1986 36.9491 36.3857 36.7769C36.5804 36.5972 36.6777 36.3688 36.6777 36.0918C36.6777 35.8447 36.5879 35.6051 36.4082 35.373L33.7803 31.8018L36.4307 28.2192C36.6104 27.9797 36.7002 27.7401 36.7002 27.5005C36.7002 27.2384 36.6066 27.0213 36.4194 26.8491C36.2323 26.6694 35.9964 26.5796 35.7119 26.5796C35.5023 26.5796 35.3226 26.6283 35.1729 26.7256C35.0306 26.8154 34.8883 26.9727 34.7461 27.1973L32.6123 30.3867H32.5449L30.3662 27.1973C30.209 26.9652 30.0555 26.8042 29.9058 26.7144C29.7635 26.6245 29.5838 26.5796 29.3667 26.5796C29.0822 26.5796 28.8426 26.6732 28.6479 26.8604C28.4533 27.0475 28.356 27.2721 28.356 27.5342C28.356 27.7887 28.4495 28.0433 28.6367 28.2979L31.1636 31.7568L28.502 35.418C28.3372 35.6501 28.2549 35.8859 28.2549 36.1255C28.2549 36.3875 28.3447 36.6047 28.5244 36.7769C28.7116 36.9491 28.9399 37.0352 29.2095 37.0352Z" fill="#FF3B30"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg width="65" height="64" viewBox="0 0 65 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0.5" width="64" height="64" rx="16" fill="#FFE9DB"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M29.4445 27.5015C28.8931 27.5322 28.4709 28.004 28.5015 28.5555L29.0015 37.5555C29.0322 38.1069 29.504 38.5291 30.0555 38.4985C30.6069 38.4678 31.0291 37.996 30.9985 37.4445L30.4985 28.4445C30.4678 27.8931 29.996 27.4709 29.4445 27.5015Z" fill="#E64646"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M35.5555 27.5015C36.1069 27.5322 36.5291 28.004 36.4985 28.5555L35.9985 37.5555C35.9678 38.1069 35.496 38.5291 34.9445 38.4985C34.3931 38.4678 33.9709 37.996 34.0015 37.4445L34.5015 28.4445C34.5322 27.8931 35.004 27.4709 35.5555 27.5015Z" fill="#E64646"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 23C21.4477 23 21 23.4477 21 24C21 24.5523 21.4477 25 22 25H23.0961L24.3936 37.8226C24.4674 38.5523 24.5286 39.157 24.6175 39.6489C24.7102 40.1618 24.845 40.629 25.1061 41.0628C25.5134 41.7394 26.1117 42.2803 26.8259 42.6173C27.2837 42.8334 27.7622 42.9205 28.2817 42.9611C28.7802 43 29.3879 43 30.1214 43H34.8786C35.6121 43 36.2198 43 36.7183 42.9611C37.2378 42.9205 37.7163 42.8334 38.1741 42.6173C38.8883 42.2803 39.4866 41.7394 39.8939 41.0628C40.155 40.629 40.2898 40.1618 40.3825 39.6489C40.4714 39.157 40.5326 38.5523 40.6064 37.8226L41.9039 25H43C43.5523 25 44 24.5523 44 24C44 23.4477 43.5523 23 43 23H36.8885C36.4338 20.996 34.6416 19.5 32.5 19.5C30.3584 19.5 28.5662 20.996 28.1115 23H22ZM26.3795 37.5826C26.4583 38.3607 26.5123 38.8873 26.5856 39.2932C26.6568 39.687 26.734 39.8891 26.8196 40.0314C27.0233 40.3697 27.3225 40.6401 27.6795 40.8087C27.8297 40.8796 28.0385 40.936 28.4375 40.9672C28.8488 40.9993 29.3781 41 30.1602 41H34.8398C35.6219 41 36.1512 40.9993 36.5625 40.9672C36.9615 40.936 37.1703 40.8796 37.3205 40.8087C37.6775 40.6401 37.9767 40.3697 38.1804 40.0314C38.266 39.8891 38.3432 39.687 38.4144 39.2932C38.4877 38.8873 38.5417 38.3607 38.6205 37.5826L39.8937 25H25.1063L26.3795 37.5826ZM32.5 21.5C31.4748 21.5 30.5938 22.117 30.208 23H34.792C34.4062 22.117 33.5252 21.5 32.5 21.5Z" fill="#E64646"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
@@ -112,6 +112,7 @@ extension AppColor on Color {
|
||||
static const colorLoading = Color(0x2999A2AD);
|
||||
static const colorActionButtonHover = Color(0xFFA2AAB3);
|
||||
static const colorBgMenuItemDropDownSelected = Color(0x80DEE2E7);
|
||||
static const colorButtonCancelDialog = Color(0x0D000000);
|
||||
|
||||
static const mapGradientColor = [
|
||||
[Color(0xFF21D4FD), Color(0xFFB721FF)],
|
||||
|
||||
@@ -101,6 +101,8 @@ class ImagePaths {
|
||||
String get icEmail => _getImagePath('ic_email.svg');
|
||||
String get icReplyTo => _getImagePath('ic_reply_to.svg');
|
||||
String get icEditIdentity => _getImagePath('ic_edit_identity.svg');
|
||||
String get icDeleteDialogIdentity => _getImagePath('ic_delete_dialog_identity.svg');
|
||||
String get icDeleteDialogFailed => _getImagePath('ic_delete_dialog_failed.svg');
|
||||
|
||||
String _getImagePath(String imageName) {
|
||||
return AssetsPaths.images + imageName;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
mixin PopupMenuWidgetMixin {
|
||||
|
||||
Widget popupItem(String iconAction, String nameAction, {
|
||||
Color? colorIcon,
|
||||
TextStyle? styleName,
|
||||
Function? onCallbackAction
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: () => onCallbackAction?.call(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
|
||||
child: SizedBox(
|
||||
child: Row(children: [
|
||||
SvgPicture.asset(iconAction, width: 20, height: 20, fit: BoxFit.fill, color: colorIcon),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Text(nameAction,
|
||||
style: styleName ?? const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black))),
|
||||
])
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -6,6 +6,7 @@ import 'package:tmail_ui_user/features/manage_account/data/datasource_impl/manag
|
||||
import 'package:tmail_ui_user/features/manage_account/data/network/manage_account_api.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/repository/manage_account_repository_impl.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/delete_identity_interactor.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/profiles/identities/identities_controller.dart';
|
||||
|
||||
@@ -19,7 +20,10 @@ class IdentitiesBindings extends BaseBindings {
|
||||
|
||||
@override
|
||||
void bindingsController() {
|
||||
Get.lazyPut(() => IdentitiesController(Get.find<GetAllIdentitiesInteractor>()));
|
||||
Get.lazyPut(() => IdentitiesController(
|
||||
Get.find<GetAllIdentitiesInteractor>(),
|
||||
Get.find<DeleteIdentityInteractor>(),
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -35,6 +39,7 @@ class IdentitiesBindings extends BaseBindings {
|
||||
@override
|
||||
void bindingsInteractor() {
|
||||
Get.lazyPut(() => GetAllIdentitiesInteractor(Get.find<ManageAccountRepository>()));
|
||||
Get.lazyPut(() => DeleteIdentityInteractor(Get.find<ManageAccountRepository>()));
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
+116
-2
@@ -1,23 +1,36 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/delete_identity_state.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/delete_identity_interactor.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/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
|
||||
class IdentitiesController extends BaseController {
|
||||
|
||||
final _accountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _appToast = Get.find<AppToast>();
|
||||
|
||||
final GetAllIdentitiesInteractor _getAllIdentitiesInteractor;
|
||||
final DeleteIdentityInteractor _deleteIdentityInteractor;
|
||||
|
||||
final identitySelected = Rxn<Identity>();
|
||||
final listIdentities = <Identity>[].obs;
|
||||
|
||||
IdentitiesController(this._getAllIdentitiesInteractor);
|
||||
IdentitiesController(
|
||||
this._getAllIdentitiesInteractor,
|
||||
this._deleteIdentityInteractor,
|
||||
);
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -28,13 +41,19 @@ class IdentitiesController extends BaseController {
|
||||
@override
|
||||
void onDone() {
|
||||
viewState.value.fold(
|
||||
(failure) {},
|
||||
(failure) {
|
||||
if (failure is DeleteIdentityFailure) {
|
||||
_deleteIdentityFailure(failure);
|
||||
}
|
||||
},
|
||||
(success) {
|
||||
if (success is GetAllIdentitiesSuccess) {
|
||||
if (success.identities?.isNotEmpty == true) {
|
||||
listIdentities.value = success.identities ?? [];
|
||||
setIdentityDefault();
|
||||
}
|
||||
} else if (success is DeleteIdentitySuccess) {
|
||||
_deleteIdentitySuccess(success);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -69,4 +88,99 @@ class IdentitiesController extends BaseController {
|
||||
void selectIdentity(Identity? newIdentity) {
|
||||
identitySelected.value = newIdentity;
|
||||
}
|
||||
|
||||
void openConfirmationDialogDeleteIdentityAction(BuildContext context, Identity identity) {
|
||||
popBack();
|
||||
|
||||
if (_responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
(ConfirmationDialogActionSheetBuilder(context)
|
||||
..messageText(AppLocalizations.of(context).message_confirmation_dialog_delete_identity)
|
||||
..onCancelAction(AppLocalizations.of(context).cancel, () =>
|
||||
popBack())
|
||||
..onConfirmAction(AppLocalizations.of(context).delete, () =>
|
||||
_deleteIdentityAction(identity)))
|
||||
.show();
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
builder: (BuildContext context) => (ConfirmDialogBuilder(_imagePaths)
|
||||
..key(const Key('confirm_dialog_delete_identity'))
|
||||
..title(AppLocalizations.of(context).delete_identity.capitalizeFirstEach)
|
||||
..content(AppLocalizations.of(context).message_confirmation_dialog_delete_identity)
|
||||
..addIcon(SvgPicture.asset(_imagePaths.icDeleteDialogIdentity, fit: BoxFit.fill))
|
||||
..marginIcon(EdgeInsets.zero)
|
||||
..styleTitle(const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColor.colorActionDeleteConfirmDialog))
|
||||
..styleContent(const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: AppColor.colorContentEmail))
|
||||
..colorCancelButton(AppColor.colorButtonCancelDialog)
|
||||
..colorConfirmButton(AppColor.colorActionDeleteConfirmDialog)
|
||||
..styleTextConfirmButton(const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white))
|
||||
..styleTextCancelButton(const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.colorTextButton))
|
||||
..onCloseButtonAction(() => popBack())
|
||||
..onConfirmButtonAction(AppLocalizations.of(context).delete, () =>
|
||||
_deleteIdentityAction(identity))
|
||||
..onCancelButtonAction(AppLocalizations.of(context).cancel, () =>
|
||||
popBack()))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
void _deleteIdentityAction(Identity identity) {
|
||||
popBack();
|
||||
|
||||
final accountId = _accountDashBoardController.accountId.value;
|
||||
if (accountId != null && identity.id != null) {
|
||||
consumeState(_deleteIdentityInteractor.execute(accountId, identity.id!));
|
||||
}
|
||||
}
|
||||
|
||||
void _deleteIdentitySuccess(DeleteIdentitySuccess success) {
|
||||
if (currentOverlayContext != null && currentContext != null) {
|
||||
_appToast.showToastWithIcon(
|
||||
currentOverlayContext!,
|
||||
message: AppLocalizations.of(currentContext!).identity_has_been_deleted,
|
||||
icon: _imagePaths.icDeleteToast);
|
||||
}
|
||||
|
||||
final accountId = _accountDashBoardController.accountId.value;
|
||||
if (accountId != null) {
|
||||
_getAllIdentities(accountId);
|
||||
}
|
||||
}
|
||||
|
||||
void _deleteIdentityFailure(DeleteIdentityFailure failure) {
|
||||
if (currentContext != null) {
|
||||
showDialog(
|
||||
context: currentContext!,
|
||||
barrierColor: AppColor.colorDefaultCupertinoActionSheet,
|
||||
builder: (BuildContext context) => (ConfirmDialogBuilder(_imagePaths)
|
||||
..key(const Key('dialog_message_delete_identity_failed'))
|
||||
..title(AppLocalizations.of(context).delete_failed)
|
||||
..addIcon(SvgPicture.asset(_imagePaths.icDeleteDialogFailed, fit: BoxFit.fill))
|
||||
..marginIcon(EdgeInsets.zero)
|
||||
..styleTitle(const TextStyle(fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black))
|
||||
..colorConfirmButton(AppColor.colorTextButton)
|
||||
..paddingTitle(const EdgeInsets.symmetric(vertical: 12))
|
||||
..styleTextConfirmButton(const TextStyle(fontSize: 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white))
|
||||
..onCloseButtonAction(() => popBack())
|
||||
..onConfirmButtonAction('${AppLocalizations.of(context).got_it}!', () => popBack()))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:tmail_ui_user/features/base/mixin/popup_menu_widget_mixin.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/identities_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/widgets/identity_bottom_sheet_action_tile_builder.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/widgets/identity_info_tile_builder.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class IdentitiesView extends GetWidget<IdentitiesController> {
|
||||
class IdentitiesView extends GetWidget<IdentitiesController> with PopupMenuWidgetMixin {
|
||||
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
@@ -87,9 +89,10 @@ class IdentitiesView extends GetWidget<IdentitiesController> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
buttonSelectIdentity,
|
||||
Obx(() => IdentityInfoTileBuilder(context,
|
||||
_imagePaths,
|
||||
controller.identitySelected.value)),
|
||||
Obx(() => IdentityInfoTileBuilder(_imagePaths, _responsiveUtils,
|
||||
controller.identitySelected.value,
|
||||
onMenuItemIdentityAction: (identity, position) =>
|
||||
_openIdentityMenuAction(context, identity, position))),
|
||||
]
|
||||
))
|
||||
),
|
||||
@@ -108,13 +111,63 @@ class IdentitiesView extends GetWidget<IdentitiesController> {
|
||||
SizedBox(
|
||||
width: constraints.maxWidth / 2,
|
||||
child: buttonSelectIdentity),
|
||||
Obx(() => IdentityInfoTileBuilder(context,
|
||||
_imagePaths,
|
||||
Obx(() => IdentityInfoTileBuilder(_imagePaths, _responsiveUtils,
|
||||
controller.identitySelected.value,
|
||||
maxWidth: constraints.maxWidth / 2)),
|
||||
maxWidth: constraints.maxWidth / 2,
|
||||
onMenuItemIdentityAction: (identity, position) =>
|
||||
_openIdentityMenuAction(context, identity, position))),
|
||||
]
|
||||
))
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
void _openIdentityMenuAction(BuildContext context, Identity identity,
|
||||
RelativeRect? position) {
|
||||
if (_responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
controller.openContextMenuAction(context, _bottomSheetIdentityActionTiles(context, identity));
|
||||
} else {
|
||||
controller.openPopupMenuAction(context, position, _popupMenuIdentityActionTiles(context, identity));
|
||||
}
|
||||
}
|
||||
|
||||
List<PopupMenuEntry> _popupMenuIdentityActionTiles(BuildContext context, Identity identity) {
|
||||
return [
|
||||
if (identity.mayDelete == true)
|
||||
PopupMenuItem(
|
||||
padding: EdgeInsets.zero,
|
||||
child: popupItem(_imagePaths.icDeleteComposer,
|
||||
AppLocalizations.of(context).delete_identity,
|
||||
colorIcon: AppColor.colorActionDeleteConfirmDialog,
|
||||
styleName: const TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 17,
|
||||
color: AppColor.colorActionDeleteConfirmDialog),
|
||||
onCallbackAction: () => controller.openConfirmationDialogDeleteIdentityAction(context, identity))),
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> _bottomSheetIdentityActionTiles(BuildContext context, Identity identity) {
|
||||
return <Widget>[
|
||||
if (identity.mayDelete == true)
|
||||
_deleteIdentityActionTile(context, identity),
|
||||
];
|
||||
}
|
||||
|
||||
Widget _deleteIdentityActionTile(BuildContext context, Identity identity) {
|
||||
return (IdentityBottomSheetActionTileBuilder(
|
||||
const Key('delete_identity_action'),
|
||||
SvgPicture.asset(_imagePaths.icDeleteComposer,
|
||||
color: AppColor.colorActionDeleteConfirmDialog),
|
||||
AppLocalizations.of(context).delete_identity,
|
||||
identity,
|
||||
iconLeftPadding: _responsiveUtils.isMobile(context)
|
||||
? const EdgeInsets.only(left: 12, right: 16)
|
||||
: const EdgeInsets.only(right: 12),
|
||||
iconRightPadding: _responsiveUtils.isMobile(context)
|
||||
? const EdgeInsets.only(right: 12)
|
||||
: EdgeInsets.zero)
|
||||
..onActionClick((identity) => controller.openConfirmationDialogDeleteIdentityAction(context, identity)))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
|
||||
class IdentityBottomSheetActionTileBuilder extends CupertinoActionSheetActionBuilder<Identity> {
|
||||
|
||||
final Identity identity;
|
||||
final SvgPicture? actionSelected;
|
||||
final Color? bgColor;
|
||||
final EdgeInsets? iconLeftPadding;
|
||||
final EdgeInsets? iconRightPadding;
|
||||
|
||||
IdentityBottomSheetActionTileBuilder(
|
||||
Key key,
|
||||
SvgPicture actionIcon,
|
||||
String actionName,
|
||||
this.identity,
|
||||
{
|
||||
this.actionSelected,
|
||||
this.bgColor,
|
||||
this.iconLeftPadding,
|
||||
this.iconRightPadding,
|
||||
}
|
||||
) : super(key, actionIcon, actionName);
|
||||
|
||||
@override
|
||||
Widget build() {
|
||||
return Container(
|
||||
color: bgColor ?? Colors.white,
|
||||
child: CupertinoActionSheetAction(
|
||||
key: key,
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Padding(
|
||||
padding: iconLeftPadding ?? const EdgeInsets.only(left: 12, right: 16),
|
||||
child: actionIcon),
|
||||
Expanded(child: Text(actionName, textAlign: TextAlign.left, style: actionTextStyle())),
|
||||
]),
|
||||
onPressed: () {
|
||||
if (onCupertinoActionSheetActionClick != null) {
|
||||
onCupertinoActionSheetActionClick!(identity);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
+23
-24
@@ -5,18 +5,25 @@ import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
typedef OnMenuItemIdentityAction = Function(Identity identity, RelativeRect? positon);
|
||||
|
||||
class IdentityInfoTileBuilder extends StatelessWidget {
|
||||
|
||||
final BuildContext _context;
|
||||
final ImagePaths _imagePaths;
|
||||
final ResponsiveUtils _responsiveUtils;
|
||||
final Identity? _identity;
|
||||
final double? maxWidth;
|
||||
final OnMenuItemIdentityAction? onMenuItemIdentityAction;
|
||||
|
||||
const IdentityInfoTileBuilder(
|
||||
this._context,
|
||||
this._imagePaths,
|
||||
this._responsiveUtils,
|
||||
this._identity,
|
||||
{Key? key, this.maxWidth}
|
||||
{
|
||||
Key? key,
|
||||
this.maxWidth,
|
||||
this.onMenuItemIdentityAction,
|
||||
}
|
||||
) : super(key: key);
|
||||
|
||||
@override
|
||||
@@ -40,9 +47,19 @@ class IdentityInfoTileBuilder extends StatelessWidget {
|
||||
child: Row(children: [
|
||||
Expanded(child: Text(_identity?.name ?? '',
|
||||
style: const TextStyle(fontWeight: FontWeight.w500, fontSize: 17, color: Colors.black))),
|
||||
buildIconWeb(
|
||||
buildIconWebHasPosition(
|
||||
context,
|
||||
icon: SvgPicture.asset(_imagePaths.icMoreVertical, fit: BoxFit.fill),
|
||||
onTap: () => {})
|
||||
onTap: () {
|
||||
if (_responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
onMenuItemIdentityAction?.call(_identity!, null);
|
||||
}
|
||||
},
|
||||
onTapDown: (position) {
|
||||
if (!_responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
onMenuItemIdentityAction?.call(_identity!, position);
|
||||
}
|
||||
})
|
||||
])),
|
||||
const SizedBox(height: 10),
|
||||
const Divider(color: AppColor.colorDividerMailbox, height: 0.5, thickness: 0.2),
|
||||
@@ -75,24 +92,6 @@ class IdentityInfoTileBuilder extends StatelessWidget {
|
||||
Expanded(child: Text(_identity?.replyTo?.listEmailAddressToString(isFullEmailAddress: true) ?? '',
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: AppColor.colorHintSearchBar)))
|
||||
])),
|
||||
if (_identity?.cc != null && _identity?.cc?.isNotEmpty == true) const SizedBox(height: 6),
|
||||
if (_identity?.cc != null && _identity?.cc?.isNotEmpty == true)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Row(children: [
|
||||
Container(
|
||||
width: 40,
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Text(AppLocalizations.of(_context).cc_email_address_prefix,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
decoration: TextDecoration.underline,
|
||||
color: AppColor.colorTextButton))),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(child: Text(_identity?.cc?.listEmailAddressToString(isFullEmailAddress: true) ?? '',
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: AppColor.colorHintSearchBar)))
|
||||
])),
|
||||
if (_identity?.bcc != null && _identity?.bcc?.isNotEmpty == true) const SizedBox(height: 6),
|
||||
if (_identity?.bcc != null && _identity?.bcc?.isNotEmpty == true)
|
||||
Padding(
|
||||
@@ -101,7 +100,7 @@ class IdentityInfoTileBuilder extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.only(left: 6),
|
||||
width: 40,
|
||||
child: Text(AppLocalizations.of(_context).bcc_email_address_prefix,
|
||||
child: Text(AppLocalizations.of(context).bcc_email_address_prefix,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"@@last_modified": "2022-04-26T09:31:06.288489",
|
||||
"@@last_modified": "2022-05-05T15:05:07.334710",
|
||||
"initializing_data": "Initializing data...",
|
||||
"@initializing_data": {
|
||||
"type": "text",
|
||||
@@ -1125,5 +1125,29 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"delete_identity": "Delete identity",
|
||||
"@delete_identity": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"message_confirmation_dialog_delete_identity": "Are you sure you want to delete this identity?",
|
||||
"@message_confirmation_dialog_delete_identity": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"identity_has_been_deleted": "Identity has been deleted",
|
||||
"@identity_has_been_deleted": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"delete_failed": "Delete Failed",
|
||||
"@delete_failed": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -1178,4 +1178,24 @@ class AppLocalizations {
|
||||
return Intl.message('New Identity',
|
||||
name: 'new_identity');
|
||||
}
|
||||
|
||||
String get delete_identity {
|
||||
return Intl.message('Delete identity',
|
||||
name: 'delete_identity');
|
||||
}
|
||||
|
||||
String get message_confirmation_dialog_delete_identity {
|
||||
return Intl.message('Are you sure you want to delete this identity?',
|
||||
name: 'message_confirmation_dialog_delete_identity');
|
||||
}
|
||||
|
||||
String get identity_has_been_deleted {
|
||||
return Intl.message('Identity has been deleted',
|
||||
name: 'identity_has_been_deleted');
|
||||
}
|
||||
|
||||
String get delete_failed {
|
||||
return Intl.message('Delete Failed',
|
||||
name: 'delete_failed');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user