TF-3952 Clear recipient input focus after perform any actions
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import 'package:core/presentation/state/failure.dart';
|
import 'package:core/presentation/state/failure.dart';
|
||||||
import 'package:core/presentation/state/success.dart';
|
import 'package:core/presentation/state/success.dart';
|
||||||
import 'package:core/presentation/utils/keyboard_utils.dart';
|
|
||||||
import 'package:core/utils/app_logger.dart';
|
import 'package:core/utils/app_logger.dart';
|
||||||
|
import 'package:core/utils/platform_info.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:forward/forward/tmail_forward.dart';
|
import 'package:forward/forward/tmail_forward.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -119,6 +119,8 @@ class ForwardController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void deleteRecipients(BuildContext context, String emailAddress) {
|
void deleteRecipients(BuildContext context, String emailAddress) {
|
||||||
|
clearInputFocus();
|
||||||
|
|
||||||
showConfirmDialogAction(
|
showConfirmDialogAction(
|
||||||
context,
|
context,
|
||||||
title: AppLocalizations.of(context).deleteRecipient,
|
title: AppLocalizations.of(context).deleteRecipient,
|
||||||
@@ -180,6 +182,8 @@ class ForwardController extends BaseController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
void selectRecipientForward(RecipientForward recipientForward) {
|
void selectRecipientForward(RecipientForward recipientForward) {
|
||||||
|
clearInputFocus();
|
||||||
|
|
||||||
if (selectionMode.value == SelectMode.INACTIVE) {
|
if (selectionMode.value == SelectMode.INACTIVE) {
|
||||||
selectionMode.value = SelectMode.ACTIVE;
|
selectionMode.value = SelectMode.ACTIVE;
|
||||||
}
|
}
|
||||||
@@ -204,6 +208,8 @@ class ForwardController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void deleteMultipleRecipients(BuildContext context, Set<String> listEmailAddress) {
|
void deleteMultipleRecipients(BuildContext context, Set<String> listEmailAddress) {
|
||||||
|
clearInputFocus();
|
||||||
|
|
||||||
showConfirmDialogAction(
|
showConfirmDialogAction(
|
||||||
context,
|
context,
|
||||||
title: AppLocalizations.of(context).deleteRecipient,
|
title: AppLocalizations.of(context).deleteRecipient,
|
||||||
@@ -228,7 +234,7 @@ class ForwardController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addRecipientAction(BuildContext context, List<EmailAddress> listRecipientsSelected) {
|
void addRecipientAction(BuildContext context, List<EmailAddress> listRecipientsSelected) {
|
||||||
KeyboardUtils.hideKeyboard(context);
|
clearInputFocus();
|
||||||
|
|
||||||
final accountId = accountDashBoardController.accountId.value;
|
final accountId = accountDashBoardController.accountId.value;
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
@@ -263,6 +269,8 @@ class ForwardController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleEditLocalCopy() {
|
void handleEditLocalCopy() {
|
||||||
|
clearInputFocus();
|
||||||
|
|
||||||
final accountId = accountDashBoardController.accountId.value;
|
final accountId = accountDashBoardController.accountId.value;
|
||||||
if (accountId != null &&
|
if (accountId != null &&
|
||||||
currentForward.value != null &&
|
currentForward.value != null &&
|
||||||
@@ -320,4 +328,10 @@ class ForwardController extends BaseController {
|
|||||||
: BannerState.disabled;
|
: BannerState.disabled;
|
||||||
log('ForwardController::_updateForwardWarningBannerState: forwardWarningBannerState = ${forwardWarningBannerState.value}');
|
log('ForwardController::_updateForwardWarningBannerState: forwardWarningBannerState = ${forwardWarningBannerState.value}');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearInputFocus() {
|
||||||
|
if (PlatformInfo.isMobile) {
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:core/presentation/state/success.dart';
|
import 'package:core/presentation/state/success.dart';
|
||||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||||
import 'package:core/presentation/utils/theme_utils.dart';
|
import 'package:core/presentation/utils/theme_utils.dart';
|
||||||
|
import 'package:core/utils/platform_info.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.dart';
|
import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.dart';
|
||||||
@@ -26,7 +27,7 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isWebDesktop = controller.responsiveUtils.isWebDesktop(context);
|
final isWebDesktop = controller.responsiveUtils.isWebDesktop(context);
|
||||||
|
|
||||||
return Column(
|
final bodyWidget = Column(
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
if (controller.forwardWarningBannerState.value == BannerState.enabled) {
|
if (controller.forwardWarningBannerState.value == BannerState.enabled) {
|
||||||
@@ -128,6 +129,15 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (PlatformInfo.isMobile) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: controller.clearInputFocus,
|
||||||
|
child: bodyWidget,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return bodyWidget;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EdgeInsetsGeometry _getScrollViewPadding(
|
EdgeInsetsGeometry _getScrollViewPadding(
|
||||||
@@ -147,7 +157,10 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
|||||||
return Obx(() => controller.viewState.value.fold(
|
return Obx(() => controller.viewState.value.fold(
|
||||||
(failure) => const SizedBox.shrink(),
|
(failure) => const SizedBox.shrink(),
|
||||||
(success) => success is LoadingState
|
(success) => success is LoadingState
|
||||||
? loadingWidget
|
? Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
|
child: loadingWidget,
|
||||||
|
)
|
||||||
: const SizedBox.shrink()
|
: const SizedBox.shrink()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user