TF-1118 Clear input data when back to setting menu
This commit is contained in:
+47
-37
@@ -6,6 +6,8 @@ import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/button/button_builder.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart';
|
||||
@@ -14,6 +16,7 @@ import 'package:super_tag_editor/tag_editor.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/widgets/suggestion_email_address.dart';
|
||||
import 'package:tmail_ui_user/features/contact/presentation/widgets/contact_input_tag_item.dart';
|
||||
import 'package:tmail_ui_user/features/contact/presentation/widgets/contact_suggestion_box_item.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
typedef OnSuggestionContactCallbackAction = Future<List<EmailAddress>> Function(String query);
|
||||
@@ -48,21 +51,18 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
late List<EmailAddress> listEmailAddress;
|
||||
late Timer _gapBetweenTagChangedAndFindSuggestion;
|
||||
|
||||
Timer? _gapBetweenTagChangedAndFindSuggestion;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
listEmailAddress = widget.listEmailAddress;
|
||||
_gapBetweenTagChangedAndFindSuggestion = Timer(
|
||||
const Duration(microseconds: 500),
|
||||
() {}
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_gapBetweenTagChangedAndFindSuggestion.cancel();
|
||||
_gapBetweenTagChangedAndFindSuggestion?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
textInputAction: TextInputAction.done,
|
||||
hasAddButton: false,
|
||||
tagSpacing: 12,
|
||||
tagSpacing: BuildUtils.isWeb ? 12 : 8,
|
||||
delimiters: const [' '],
|
||||
autofocus: false,
|
||||
minTextFieldWidth: 20,
|
||||
@@ -99,7 +99,15 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500),
|
||||
inputDecoration: const InputDecoration(border: InputBorder.none),
|
||||
inputDecoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
hintText: AppLocalizations.of(context).hintInputAutocompleteContact,
|
||||
hintStyle: const TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.colorSettingExplanation,
|
||||
fontSize: 16
|
||||
)
|
||||
),
|
||||
tagBuilder: (context, index) => ContactInputTagItem(
|
||||
listEmailAddress[index],
|
||||
deleteContactCallbackAction: (contact) {
|
||||
@@ -110,6 +118,10 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
if (!_isDuplicatedRecipient(value)) {
|
||||
setState(() => listEmailAddress.add(EmailAddress(null, value)));
|
||||
}
|
||||
_gapBetweenTagChangedAndFindSuggestion = Timer(
|
||||
const Duration(seconds: 1),
|
||||
_handleGapBetweenTagChangedAndFindSuggestion
|
||||
);
|
||||
},
|
||||
findSuggestions: _findSuggestions,
|
||||
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress) {
|
||||
@@ -129,34 +141,28 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
);
|
||||
|
||||
if (widget.hasAddContactButton == true) {
|
||||
if (_responsiveUtils.isScreenWithShortestSide(context)) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
itemTagEditor,
|
||||
const SizedBox(height: 16),
|
||||
_buildAddRecipientButton(context, maxWidth: double.infinity)
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(child: itemTagEditor),
|
||||
const SizedBox(width: 12),
|
||||
_buildAddRecipientButton(context)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
width: double.infinity,
|
||||
padding: SettingsUtils.getPaddingInputRecipientForwarding(context, _responsiveUtils),
|
||||
child: _responsiveUtils.isScreenWithShortestSide(context)
|
||||
? Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
itemTagEditor,
|
||||
const SizedBox(height: 16),
|
||||
_buildAddRecipientButton(context, maxWidth: double.infinity)
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: itemTagEditor),
|
||||
const SizedBox(width: 12),
|
||||
_buildAddRecipientButton(context)
|
||||
],
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return itemTagEditor;
|
||||
}
|
||||
@@ -173,7 +179,7 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
}
|
||||
|
||||
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query) async {
|
||||
if (_gapBetweenTagChangedAndFindSuggestion.isActive) {
|
||||
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -217,6 +223,10 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
.map((emailAddress) => SuggestionEmailAddress(emailAddress, state: SuggestionEmailState.duplicated));
|
||||
}
|
||||
|
||||
void _handleGapBetweenTagChangedAndFindSuggestion() {
|
||||
log('_AutocompleteContactTextFieldWithTagsState::_handleGapBetweenTagChangedAndFindSuggestion(): Timeout');
|
||||
}
|
||||
|
||||
bool _isValidAllEmailAddress(List<EmailAddress> addedEmailAddress) {
|
||||
return addedEmailAddress.every((addedMail) => addedMail.emailAddress.isEmail);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/style_utils.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -29,6 +30,7 @@ class ContactInputTagItem extends StatelessWidget {
|
||||
final imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
final itemChild = Chip(
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
avatar: contact.displayName.isNotEmpty
|
||||
? GradientColorAvatarIcon(
|
||||
contact.avatarColors,
|
||||
@@ -72,10 +74,17 @@ class ContactInputTagItem extends StatelessWidget {
|
||||
onDeleted: () => deleteContactCallbackAction?.call(contact),
|
||||
);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: itemChild
|
||||
);
|
||||
if (BuildUtils.isWeb) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: itemChild
|
||||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: itemChild
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool _isValidEmailAddress(String value) => value.isEmail;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
import 'package:tmail_ui_user/features/base/action/ui_action.dart';
|
||||
|
||||
class DashBoardSettingAction extends UIAction {
|
||||
static final idle = DashBoardSettingAction();
|
||||
|
||||
DashBoardSettingAction() : super();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class ClearAllInputForwarding extends DashBoardSettingAction {
|
||||
|
||||
ClearAllInputForwarding();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import 'package:tmail_ui_user/features/manage_account/domain/usecases/add_recipi
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/delete_recipient_in_forwarding_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/edit_local_copy_in_forwarding_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_forward_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/action/dashboard_setting_action.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/tmail_forward_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/controller/forward_recipient_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
@@ -47,6 +48,7 @@ class ForwardController extends BaseController {
|
||||
bool get currentForwardLocalCopyState => currentForward.value?.localCopy ?? false;
|
||||
|
||||
late ForwardRecipientController recipientController;
|
||||
late Worker dashboardActionWorker;
|
||||
|
||||
ForwardController() {
|
||||
recipientController = ForwardRecipientController(
|
||||
@@ -57,6 +59,7 @@ class ForwardController extends BaseController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
registerListenerWorker();
|
||||
try {
|
||||
_getForwardInteractor = Get.find<GetForwardInteractor>();
|
||||
_deleteRecipientInForwardingInteractor = Get.find<DeleteRecipientInForwardingInteractor>();
|
||||
@@ -70,6 +73,7 @@ class ForwardController extends BaseController {
|
||||
@override
|
||||
void onClose() {
|
||||
recipientController.onClose();
|
||||
unregisterListenerWorker();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
@@ -176,7 +180,6 @@ class ForwardController extends BaseController {
|
||||
}
|
||||
|
||||
final matchedRecipientForward = listRecipientForward.indexOf(recipientForward);
|
||||
log('ForwardController::selectRecipientForward(): matchedRecipientForward: $matchedRecipientForward');
|
||||
if (matchedRecipientForward >= 0) {
|
||||
final newRecipientForward = recipientForward.toggleSelection();
|
||||
listRecipientForward[matchedRecipientForward] = newRecipientForward;
|
||||
@@ -231,7 +234,6 @@ class ForwardController extends BaseController {
|
||||
}
|
||||
|
||||
void addRecipientAction(BuildContext context, List<EmailAddress> listRecipientsSelected) {
|
||||
log('ForwardController::addRecipientAction():listRecipientsSelected: $listRecipientsSelected');
|
||||
FocusScope.of(context).unfocus();
|
||||
|
||||
final accountId = accountDashBoardController.accountId.value;
|
||||
@@ -293,4 +295,20 @@ class ForwardController extends BaseController {
|
||||
currentForward.value = success.forward;
|
||||
listRecipientForward.value = currentForward.value!.listRecipientForward;
|
||||
}
|
||||
|
||||
void registerListenerWorker() {
|
||||
dashboardActionWorker = ever(
|
||||
accountDashBoardController.dashboardSettingAction,
|
||||
(action) {
|
||||
if (action is ClearAllInputForwarding) {
|
||||
cancelSelectionMode();
|
||||
recipientController.clearAll();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void unregisterListenerWorker() {
|
||||
dashboardActionWorker.dispose();
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
height: double.infinity,
|
||||
color: SettingsUtils.getContentBackgroundColor(context, _responsiveUtils),
|
||||
decoration: SettingsUtils.getBoxDecorationForContent(context, _responsiveUtils),
|
||||
margin: SettingsUtils.getMarginViewForSettingDetails(context, _responsiveUtils),
|
||||
margin: SettingsUtils.getMarginViewForForwardSettingDetails(context, _responsiveUtils),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -45,15 +45,12 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
if (!_responsiveUtils.isWebDesktop(context))
|
||||
_buildTitleHeader(context),
|
||||
_buildKeepLocalSwitchButton(context),
|
||||
_buildAddRecipientsFormWidget(context),
|
||||
_buildLoadingView(),
|
||||
Obx(() {
|
||||
if (controller.currentForward.value != null) {
|
||||
return Column(children: [
|
||||
_buildKeepLocalSwitchButton(context),
|
||||
_buildAddRecipientsFormWidget(context),
|
||||
if (controller.listRecipientForward.isNotEmpty)
|
||||
ListEmailForwardsWidget()
|
||||
]);
|
||||
if (controller.listRecipientForward.isNotEmpty) {
|
||||
return ListEmailForwardsWidget();
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
@@ -68,9 +65,8 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
|
||||
Widget _buildTitleHeader(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
color: Colors.transparent,
|
||||
width: double.infinity,
|
||||
margin: SettingsUtils.getMarginTitleHeaderForwarding(context, _responsiveUtils),
|
||||
padding: SettingsUtils.getPaddingTitleHeaderForwarding(context, _responsiveUtils),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).forwardingSettingExplanation,
|
||||
@@ -86,7 +82,7 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
Widget _buildKeepLocalSwitchButton(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
padding: const EdgeInsets.only(left: 24, top: 24, right: 24, bottom: 11),
|
||||
padding: SettingsUtils.getPaddingKeepLocalSwitchButtonForwarding(context, _responsiveUtils),
|
||||
child: Row(children: [
|
||||
Obx(() {
|
||||
return InkWell(
|
||||
|
||||
+11
-6
@@ -4,6 +4,7 @@ import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/style_utils.dart';
|
||||
import 'package:core/presentation/views/button/icon_button_web.dart';
|
||||
import 'package:core/presentation/views/image/avatar_builder.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -37,17 +38,21 @@ class EmailForwardItemWidget extends StatelessWidget {
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
onLongPress: () {
|
||||
if (!BuildUtils.isWeb) {
|
||||
onSelectRecipientCallback?.call(recipientForward);
|
||||
}
|
||||
},
|
||||
customBorder: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.only(left: 12, bottom: 12, top: 12),
|
||||
decoration: BoxDecoration(
|
||||
color: _getBackgroundColor(),
|
||||
borderRadius: BorderRadius.all(Radius.circular(
|
||||
recipientForward.selectMode == SelectMode.ACTIVE ? 12 : 0))
|
||||
),
|
||||
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
|
||||
child: Row(children: [
|
||||
_buildAvatarIcon(_imagePaths),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Column(
|
||||
@@ -85,11 +90,11 @@ class EmailForwardItemWidget extends StatelessWidget {
|
||||
const SizedBox(width: 12),
|
||||
if (selectionMode == SelectMode.INACTIVE)
|
||||
buildIconWeb(
|
||||
iconSize: 34,
|
||||
splashRadius: 25,
|
||||
iconSize: 30,
|
||||
splashRadius: 20,
|
||||
icon: SvgPicture.asset(_imagePaths.icDeleteRecipient),
|
||||
onTap: () => onDeleteRecipientCallback?.call(recipientForward)
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
||||
+24
-18
@@ -23,29 +23,35 @@ class ListEmailForwardsWidget extends GetWidget<ForwardController> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
margin: SettingsUtils.getPaddingListRecipientForwarding(context, _responsiveUtils),
|
||||
color: Colors.transparent,
|
||||
padding: SettingsUtils.getPaddingListRecipientForwarding(context, _responsiveUtils),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildTitleHeader(context),
|
||||
Obx(() {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
primary: false,
|
||||
itemCount: controller.listRecipientForward.length,
|
||||
itemBuilder: (context, index) {
|
||||
return EmailForwardItemWidget(
|
||||
controller.listRecipientForward[index],
|
||||
selectionMode: controller.selectionMode.value,
|
||||
onSelectRecipientCallback: controller.selectRecipientForward,
|
||||
onDeleteRecipientCallback: (recipientForward) {
|
||||
controller.deleteRecipients(context, recipientForward.emailAddress.emailAddress);
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
if (controller.listRecipientForward.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
primary: false,
|
||||
itemCount: controller.listRecipientForward.length,
|
||||
padding: EdgeInsets.zero,
|
||||
itemExtent: 75,
|
||||
itemBuilder: (context, index) {
|
||||
return EmailForwardItemWidget(
|
||||
controller.listRecipientForward[index],
|
||||
selectionMode: controller.selectionMode.value,
|
||||
onSelectRecipientCallback: controller.selectRecipientForward,
|
||||
onDeleteRecipientCallback: (recipientForward) {
|
||||
controller.deleteRecipients(context, recipientForward.emailAddress.emailAddress);
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}),
|
||||
]
|
||||
),
|
||||
@@ -127,7 +133,7 @@ class ListEmailForwardsWidget extends GetWidget<ForwardController> {
|
||||
child: InkWell(
|
||||
customBorder: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 6),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).remove,
|
||||
style: const TextStyle(
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:jmap_dart_client/jmap/mail/vacation/vacation_response.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:rule_filter/rule_filter/capability_rule_filter.dart';
|
||||
import 'package:tmail_ui_user/features/base/action/ui_action.dart';
|
||||
import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/usecases/delete_authority_oidc_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/usecases/get_authenticated_account_interactor.dart';
|
||||
@@ -20,6 +21,7 @@ import 'package:tmail_ui_user/features/manage_account/domain/state/update_vacati
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_vacation_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oidc_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/update_vacation_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/action/dashboard_setting_action.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/bindings/forward_bindings.dart';
|
||||
@@ -50,6 +52,7 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
final settingsPageLevel = SettingsPageLevel.universal.obs;
|
||||
final sessionCurrent = Rxn<Session>();
|
||||
final vacationResponse = Rxn<VacationResponse>();
|
||||
final dashboardSettingAction = Rxn<UIAction>();
|
||||
|
||||
ManageAccountDashBoardController(
|
||||
LogoutOidcInteractor logoutOidcInteractor,
|
||||
@@ -169,6 +172,7 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
bool get isMenuDrawerOpen => menuDrawerKey.currentState?.isDrawerOpen == true;
|
||||
|
||||
void selectAccountMenuItem(AccountMenuItem newAccountMenuItem) {
|
||||
clearInputFormView();
|
||||
if(newAccountMenuItem == AccountMenuItem.emailRules) {
|
||||
EmailRulesBindings().dependencies();
|
||||
}
|
||||
@@ -180,7 +184,17 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
closeMenuDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void clearInputFormView() {
|
||||
switch(accountMenuItemSelected.value) {
|
||||
case AccountMenuItem.forward:
|
||||
dispatchAction(ClearAllInputForwarding());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void _goToSettingMenuCurrent(AccountMenuItem accountMenuItem) {
|
||||
if(accountMenuItem == AccountMenuItem.emailRules) {
|
||||
EmailRulesBindings().dependencies();
|
||||
@@ -267,4 +281,15 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
bool inVacationSettings() {
|
||||
return accountMenuItemSelected.value == AccountMenuItem.vacation;
|
||||
}
|
||||
|
||||
void dispatchAction(UIAction newAction) {
|
||||
log('ManageAccountDashBoardController::dispatchAction(): ${newAction.runtimeType}');
|
||||
final previousAction = dashboardSettingAction.value;
|
||||
if (newAction == previousAction) {
|
||||
dashboardSettingAction.value = newAction;
|
||||
dashboardSettingAction.refresh();
|
||||
} else {
|
||||
dashboardSettingAction.value = newAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ class SettingsController extends GetxController {
|
||||
|
||||
void backToUniversalSettings() {
|
||||
log('SettingsController::backToUniversalSettings()');
|
||||
manageAccountDashboardController.clearInputFormView();
|
||||
manageAccountDashboardController.selectAccountMenuItem(AccountMenuItem.none);
|
||||
manageAccountDashboardController.settingsPageLevel.value = SettingsPageLevel.universal;
|
||||
}
|
||||
|
||||
@@ -32,18 +32,34 @@ class SettingsView extends GetWidget<SettingsController> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox.fromSize(
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SafeArea(
|
||||
bottom: false,
|
||||
child: SizedBox.fromSize(
|
||||
size: const Size.fromHeight(52),
|
||||
child: Padding(
|
||||
padding: SettingsUtils.getPaddingAppBar(context, _responsiveUtils),
|
||||
child: _buildAppbar(context))),
|
||||
const Divider(color: AppColor.colorDividerComposer, height: 1),
|
||||
Obx(() {
|
||||
),
|
||||
const Divider(color: AppColor.colorDividerComposer, height: 1),
|
||||
SafeArea(
|
||||
bottom: false,
|
||||
top: false,
|
||||
child: Obx(() {
|
||||
if (controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsValid == true) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(
|
||||
left: BuildUtils.isWeb ? 24 : 16,
|
||||
right: BuildUtils.isWeb ? 24 : 16,
|
||||
top: 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
|
||||
actionEndNow: () => controller.manageAccountDashboardController.disableVacationResponder());
|
||||
} else if ((controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsWaiting == true
|
||||
|| controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsStopped == true)
|
||||
&& controller.manageAccountDashboardController.inVacationSettings()) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(
|
||||
left: BuildUtils.isWeb ? 24 : 16,
|
||||
@@ -51,29 +67,22 @@ class SettingsView extends GetWidget<SettingsController> {
|
||||
top: 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
|
||||
actionEndNow: () => controller.manageAccountDashboardController.disableVacationResponder());
|
||||
} else if ((controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsWaiting == true
|
||||
|| controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsStopped == true)
|
||||
&& controller.manageAccountDashboardController.inVacationSettings()) {
|
||||
return VacationNotificationMessageWidget(
|
||||
margin: const EdgeInsets.only(
|
||||
left: BuildUtils.isWeb ? 24 : 16,
|
||||
right: BuildUtils.isWeb ? 24 : 16,
|
||||
top: 16),
|
||||
fromAccountDashBoard: true,
|
||||
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
leadingIcon: const Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: Icon(Icons.timer, size: 20),
|
||||
));
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
leadingIcon: const Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: Icon(Icons.timer, size: 20),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Expanded(child: _bodySettingsScreen())
|
||||
]
|
||||
)
|
||||
})
|
||||
),
|
||||
Expanded(child: SafeArea(
|
||||
top: false,
|
||||
child: _bodySettingsScreen()
|
||||
))
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -110,16 +119,14 @@ class SettingsView extends GetWidget<SettingsController> {
|
||||
|
||||
Widget _buildSettingLevel1AppBar(BuildContext context) {
|
||||
return Stack(children: [
|
||||
if (_responsiveUtils.isPortraitMobile(context))
|
||||
_buildBackButton(context)
|
||||
else
|
||||
Align(
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: controller.backToUniversalSettings,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
customBorder: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(15))),
|
||||
child: Tooltip(
|
||||
message: AppLocalizations.of(context).back,
|
||||
child: Container(
|
||||
@@ -160,21 +167,6 @@ class SettingsView extends GetWidget<SettingsController> {
|
||||
]);
|
||||
}
|
||||
|
||||
Widget _buildBackButton(BuildContext context) {
|
||||
return Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: buildIconWeb(
|
||||
icon: SvgPicture.asset(_imagePaths.icBack,
|
||||
width: 18,
|
||||
height: 18,
|
||||
color: AppColor.colorTextButton,
|
||||
fit: BoxFit.fill),
|
||||
tooltip: AppLocalizations.of(context).back,
|
||||
onTap: controller.backToUniversalSettings
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCloseSettingButton(BuildContext context) {
|
||||
return buildIconWeb(
|
||||
icon: SvgPicture.asset(_imagePaths.icClose, width: 28, height: 28, fit: BoxFit.fill),
|
||||
|
||||
@@ -21,8 +21,10 @@ class SettingsUtils {
|
||||
}
|
||||
|
||||
static EdgeInsets getPaddingAppBar(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
if (responsiveUtils.isMobile(context)) {
|
||||
if (responsiveUtils.isPortraitMobile(context)) {
|
||||
return const EdgeInsets.symmetric(horizontal: 16);
|
||||
} else if (responsiveUtils.isLandscapeMobile(context)) {
|
||||
return const EdgeInsets.symmetric(horizontal: 12);
|
||||
} else {
|
||||
return const EdgeInsets.symmetric(horizontal: 32);
|
||||
}
|
||||
@@ -80,9 +82,11 @@ class SettingsUtils {
|
||||
|
||||
static EdgeInsets getPaddingListRecipientForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
if (responsiveUtils.isPortraitMobile(context)) {
|
||||
return const EdgeInsets.only(left: 12, right: 12, bottom: 12);
|
||||
return const EdgeInsets.symmetric(horizontal: 16);
|
||||
} if (responsiveUtils.isLandscapeMobile(context)) {
|
||||
return const EdgeInsets.all(12);
|
||||
} else {
|
||||
return const EdgeInsets.only(left: 24, right: 24, bottom: 24);
|
||||
return const EdgeInsets.symmetric(horizontal: 32, vertical: 12);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,19 +97,49 @@ class SettingsUtils {
|
||||
color: Colors.white);
|
||||
}
|
||||
|
||||
static EdgeInsets getMarginTitleHeaderForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
static EdgeInsets getPaddingTitleHeaderForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
if (responsiveUtils.isPortraitMobile(context)) {
|
||||
return EdgeInsets.zero;
|
||||
return const EdgeInsets.symmetric(horizontal: 16, vertical: 12);
|
||||
} if (responsiveUtils.isLandscapeMobile(context)) {
|
||||
return const EdgeInsets.all(12);
|
||||
} else {
|
||||
return const EdgeInsets.symmetric(horizontal: 20);
|
||||
return const EdgeInsets.symmetric(horizontal: 32, vertical: 12);
|
||||
}
|
||||
}
|
||||
|
||||
static EdgeInsets getPaddingTitleHeaderForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
static EdgeInsets getPaddingHeaderWidgetForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
if (responsiveUtils.isPortraitMobile(context)) {
|
||||
return const EdgeInsets.only(left: 16, right: 16);
|
||||
} else {
|
||||
return const EdgeInsets.all(12);
|
||||
}
|
||||
}
|
||||
|
||||
static EdgeInsets getPaddingKeepLocalSwitchButtonForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
if (responsiveUtils.isPortraitMobile(context)) {
|
||||
return const EdgeInsets.symmetric(horizontal: 18, vertical: 14);
|
||||
} if (responsiveUtils.isLandscapeMobile(context)) {
|
||||
return const EdgeInsets.all(14);
|
||||
} else {
|
||||
return const EdgeInsets.symmetric(horizontal: 34, vertical: 14);
|
||||
}
|
||||
}
|
||||
|
||||
static EdgeInsets getPaddingInputRecipientForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
if (responsiveUtils.isPortraitMobile(context)) {
|
||||
return const EdgeInsets.symmetric(horizontal: 16, vertical: 12);
|
||||
} if (responsiveUtils.isLandscapeMobile(context)) {
|
||||
return const EdgeInsets.all(12);
|
||||
} else {
|
||||
return const EdgeInsets.symmetric(horizontal: 32, vertical: 12);
|
||||
}
|
||||
}
|
||||
|
||||
static EdgeInsets getMarginViewForForwardSettingDetails(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
if (responsiveUtils.isWebDesktop(context)) {
|
||||
return const EdgeInsets.all(16);
|
||||
} else {
|
||||
return EdgeInsets.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"@@last_modified": "2022-11-04T00:32:44.924510",
|
||||
"@@last_modified": "2022-11-08T16:55:51.988372",
|
||||
"initializing_data": "Initializing data...",
|
||||
"@initializing_data": {
|
||||
"type": "text",
|
||||
@@ -2046,8 +2046,8 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"recipientsLabel": "Enter name or email address",
|
||||
"@recipientsLabel": {
|
||||
"hintInputAutocompleteContact": "Enter name or email address",
|
||||
"@hintInputAutocompleteContact": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
@@ -2441,5 +2441,15 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"totalEmailSelected": "Deselect all ({count})",
|
||||
"@totalEmailSelected": {
|
||||
"type": "text",
|
||||
"placeholders_order": [
|
||||
"count"
|
||||
],
|
||||
"placeholders": {
|
||||
"count": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2110,7 +2110,7 @@ class AppLocalizations {
|
||||
String get hintInputAutocompleteContact {
|
||||
return Intl.message(
|
||||
'Enter name or email address',
|
||||
name: 'recipientsLabel',
|
||||
name: 'hintInputAutocompleteContact',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user