TF-2666 Edit one recipient in To/Cc/Bcc on web
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -37,6 +37,12 @@ typedef OnFocusEmailAddressChangeAction = void Function(PrefixEmailAddress prefi
|
||||
typedef OnRemoveDraggableEmailAddressAction = void Function(DraggableEmailAddress draggableEmailAddress);
|
||||
typedef OnDeleteTagAction = void Function(EmailAddress emailAddress);
|
||||
typedef OnEnableAllRecipientsInputAction = void Function(bool isEnabled);
|
||||
typedef OnEditRecipientAction = void Function(
|
||||
BuildContext context,
|
||||
PrefixEmailAddress prefix,
|
||||
EmailAddress emailAddress,
|
||||
RelativeRect position,
|
||||
);
|
||||
|
||||
class RecipientComposerWidget extends StatefulWidget {
|
||||
|
||||
@@ -62,6 +68,7 @@ class RecipientComposerWidget extends StatefulWidget {
|
||||
final OnShowFullListEmailAddressAction? onShowFullListEmailAddressAction;
|
||||
final OnFocusEmailAddressChangeAction? onFocusEmailAddressChangeAction;
|
||||
final OnRemoveDraggableEmailAddressAction? onRemoveDraggableEmailAddressAction;
|
||||
final OnEditRecipientAction? onEditRecipientAction;
|
||||
final VoidCallback? onFocusNextAddressAction;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
final EdgeInsetsGeometry? margin;
|
||||
@@ -101,6 +108,7 @@ class RecipientComposerWidget extends StatefulWidget {
|
||||
this.onRemoveDraggableEmailAddressAction,
|
||||
this.onEnableAllRecipientsInputAction,
|
||||
this.focusNodeKeyboard,
|
||||
this.onEditRecipientAction,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -217,6 +225,7 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
maxWidth: widget.maxWidth,
|
||||
onDeleteTagAction: (emailAddress) => _handleDeleteTagAction.call(emailAddress, stateSetter),
|
||||
onShowFullAction: widget.onShowFullListEmailAddressAction,
|
||||
onEditRecipientAction: widget.onEditRecipientAction,
|
||||
);
|
||||
},
|
||||
onTagChanged: (value) => _handleOnTagChangeAction.call(value, stateSetter),
|
||||
@@ -309,6 +318,7 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
maxWidth: widget.maxWidth,
|
||||
onDeleteTagAction: (emailAddress) => _handleDeleteTagAction.call(emailAddress, stateSetter),
|
||||
onShowFullAction: widget.onShowFullListEmailAddressAction,
|
||||
onEditRecipientAction: widget.onEditRecipientAction,
|
||||
);
|
||||
},
|
||||
onTagChanged: (value) => _handleOnTagChangeAction.call(value, stateSetter),
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||
import 'package:model/email/prefix_email_address.dart';
|
||||
import 'package:model/extensions/email_address_extension.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/smart_interaction_widget.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/model/draggable_email_address.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/styles/recipient_tag_item_widget_style.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/widgets/draggable_recipient_tag_widget.dart';
|
||||
@@ -30,6 +31,7 @@ class RecipientTagItemWidget extends StatelessWidget {
|
||||
final List<EmailAddress> collapsedListEmailAddress;
|
||||
final OnShowFullListEmailAddressAction? onShowFullAction;
|
||||
final OnDeleteTagAction? onDeleteTagAction;
|
||||
final OnEditRecipientAction? onEditRecipientAction;
|
||||
final bool isTestingForWeb;
|
||||
final String? composerId;
|
||||
|
||||
@@ -47,6 +49,7 @@ class RecipientTagItemWidget extends StatelessWidget {
|
||||
this.isLatestEmail = false,
|
||||
this.onShowFullAction,
|
||||
this.onDeleteTagAction,
|
||||
this.onEditRecipientAction,
|
||||
this.maxWidth,
|
||||
this.composerId,
|
||||
});
|
||||
@@ -100,7 +103,17 @@ class RecipientTagItemWidget extends StatelessWidget {
|
||||
childWhenDragging: DraggableRecipientTagWidget(emailAddress: currentEmailAddress),
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.grab,
|
||||
child: tagWidget,
|
||||
child: SmartInteractionWidget(
|
||||
onRightMouseClickAction: (position) => _onEditRecipientAction(
|
||||
context,
|
||||
position,
|
||||
),
|
||||
onDoubleClickAction: (position) => _onEditRecipientAction(
|
||||
context,
|
||||
position,
|
||||
),
|
||||
child: tagWidget,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -171,4 +184,13 @@ class RecipientTagItemWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _onEditRecipientAction(BuildContext context, RelativeRect position) {
|
||||
onEditRecipientAction?.call(
|
||||
context,
|
||||
prefix,
|
||||
currentEmailAddress,
|
||||
position,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user