diff --git a/lib/features/base/key_values/composer_key_values.dart b/lib/features/base/key_values/composer_key_values.dart new file mode 100644 index 0000000000..6484e5c7bd --- /dev/null +++ b/lib/features/base/key_values/composer_key_values.dart @@ -0,0 +1,8 @@ +class ComposerKeyValues { + static const String openComposerButton = 'tmail_open_composer_button'; + static const String composerView = 'tmail_composer_view'; + static const String composerToField = 'tmail_composer_to_field'; + static const String composerSubjectField = 'tmail_composer_subject_field'; + static const String composerContentField = 'tmail_composer_content_field'; + static const String composerSendButton = 'tmail_composer_send_button'; +} \ No newline at end of file diff --git a/lib/features/base/key_values/login_key_values.dart b/lib/features/base/key_values/login_key_values.dart new file mode 100644 index 0000000000..4a6cc3dcc1 --- /dev/null +++ b/lib/features/base/key_values/login_key_values.dart @@ -0,0 +1,6 @@ +class LoginKeyValues { + static const String loginView = 'tmail_login_view'; + static const String loginEmailField = 'tmail_login_email_field'; + static const String loginHostUrlField = 'tmail_login_host_url_field'; + static const String loginNextButton = 'tmail_login_next_button'; +} \ No newline at end of file diff --git a/lib/features/composer/presentation/composer_view.dart b/lib/features/composer/presentation/composer_view.dart index 8954bd68fc..1a79389a9a 100644 --- a/lib/features/composer/presentation/composer_view.dart +++ b/lib/features/composer/presentation/composer_view.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; import 'package:model/email/prefix_email_address.dart'; +import 'package:tmail_ui_user/features/base/key_values/composer_key_values.dart'; import 'package:tmail_ui_user/features/base/widget/popup_item_widget.dart'; import 'package:tmail_ui_user/features/composer/presentation/composer_controller.dart'; import 'package:tmail_ui_user/features/composer/presentation/model/prefix_recipient_state.dart'; @@ -48,6 +49,7 @@ class ComposerView extends GetWidget { children: [ if (controller.responsiveUtils.isLandscapeMobile(context)) Obx(() => LandscapeAppBarComposerWidget( + key: const ValueKey(ComposerKeyValues.composerSendButton), isSendButtonEnabled: controller.isEnableEmailSendButton.value, onCloseViewAction: () => controller.handleClickCloseComposer(context), sendMessageAction: () => controller.handleClickSendButton(context), @@ -73,6 +75,7 @@ class ComposerView extends GetWidget { )) else Obx(() => AppBarComposerWidget( + key: const ValueKey(ComposerKeyValues.composerSendButton), isSendButtonEnabled: controller.isEnableEmailSendButton.value, onCloseViewAction: () => controller.handleClickCloseComposer(context), sendMessageAction: () => controller.handleClickSendButton(context), @@ -120,6 +123,7 @@ class ComposerView extends GetWidget { } }), Obx(() => RecipientComposerWidget( + key: const ValueKey(ComposerKeyValues.composerToField), prefix: PrefixEmailAddress.to, listEmailAddress: controller.listToEmailAddress, imagePaths: controller.imagePaths, @@ -196,6 +200,7 @@ class ComposerView extends GetWidget { } }), SubjectComposerWidget( + key: const ValueKey(ComposerKeyValues.composerSubjectField), focusNode: controller.subjectEmailInputFocusNode, textController: controller.subjectEmailInputController, onTextChange: controller.setSubjectEmail, @@ -222,6 +227,7 @@ class ComposerView extends GetWidget { Obx(() => Padding( padding: ComposerStyle.mobileEditorPadding, child: MobileEditorView( + key: const ValueKey(ComposerKeyValues.composerContentField), arguments: controller.composerArguments.value, contentViewState: controller.emailContentsViewState.value, onCreatedEditorAction: controller.onCreatedMobileEditorAction, @@ -276,6 +282,7 @@ class ComposerView extends GetWidget { onChangeIdentity: controller.onChangeIdentity, ), RecipientComposerWidget( + key: const ValueKey(ComposerKeyValues.composerToField), prefix: PrefixEmailAddress.to, listEmailAddress: controller.listToEmailAddress, imagePaths: controller.imagePaths, @@ -344,6 +351,7 @@ class ComposerView extends GetWidget { ], )), SubjectComposerWidget( + key: const ValueKey(ComposerKeyValues.composerSubjectField), focusNode: controller.subjectEmailInputFocusNode, textController: controller.subjectEmailInputController, onTextChange: controller.setSubjectEmail, @@ -370,6 +378,7 @@ class ComposerView extends GetWidget { Obx(() => Padding( padding: ComposerStyle.mobileEditorPadding, child: MobileEditorView( + key: const ValueKey(ComposerKeyValues.composerContentField), arguments: controller.composerArguments.value, contentViewState: controller.emailContentsViewState.value, onCreatedEditorAction: controller.onCreatedMobileEditorAction, @@ -382,6 +391,7 @@ class ComposerView extends GetWidget { ) ), Obx(() => TabletBottomBarComposerWidget( + key: const ValueKey(ComposerKeyValues.composerSendButton), hasReadReceipt: controller.hasRequestReadReceipt.value, deleteComposerAction: () => controller.handleClickDeleteComposer(context), saveToDraftAction: () => controller.handleClickSaveAsDraftsButton(context), diff --git a/lib/features/login/presentation/login_view.dart b/lib/features/login/presentation/login_view.dart index 5e028d818d..8e64c7d9fb 100644 --- a/lib/features/login/presentation/login_view.dart +++ b/lib/features/login/presentation/login_view.dart @@ -4,6 +4,7 @@ import 'package:core/presentation/utils/theme_utils.dart'; import 'package:core/presentation/views/text/type_ahead_form_field_builder.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:tmail_ui_user/features/base/key_values/login_key_values.dart'; import 'package:tmail_ui_user/features/base/widget/recent_item_tile_widget.dart'; import 'package:tmail_ui_user/features/login/domain/model/recent_login_url.dart'; import 'package:tmail_ui_user/features/login/presentation/base_login_view.dart'; @@ -89,6 +90,7 @@ class LoginView extends BaseLoginView { switch (controller.loginFormType.value) { case LoginFormType.dnsLookupForm: return DNSLookupInputForm( + key: const ValueKey(LoginKeyValues.loginEmailField), textEditingController: controller.usernameInputController, onTextChange: controller.onUsernameChange, onTextSubmitted: (_) => controller.invokeDNSLookupToGetJmapUrl(), @@ -126,6 +128,7 @@ class LoginView extends BaseLoginView { return Padding( padding: const EdgeInsets.only(right: 24, left: 24, bottom: 24), child: TypeAheadFormFieldBuilder( + key: const ValueKey(LoginKeyValues.loginHostUrlField), controller: controller.urlInputController, textInputAction: TextInputAction.next, keyboardType: TextInputType.url, @@ -161,7 +164,7 @@ class LoginView extends BaseLoginView { margin: const EdgeInsets.only(bottom: 16, left: 24, right: 24), width: controller.responsiveUtils.getDeviceWidth(context),height: 48, child: ElevatedButton( - key: const Key('nextToCredentialForm'), + key: const ValueKey(LoginKeyValues.loginNextButton), style: ElevatedButton.styleFrom( foregroundColor: Colors.white, backgroundColor: AppColor.primaryColor, diff --git a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart index ee67136e8e..59599150af 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart @@ -27,6 +27,7 @@ import 'package:model/model.dart'; import 'package:pointer_interceptor/pointer_interceptor.dart'; import 'package:rxdart/transformers.dart'; import 'package:tmail_ui_user/features/base/action/ui_action.dart'; +import 'package:tmail_ui_user/features/base/key_values/composer_key_values.dart'; import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart'; import 'package:tmail_ui_user/features/base/state/button_state.dart'; import 'package:tmail_ui_user/features/composer/domain/exceptions/set_method_exception.dart'; @@ -1430,7 +1431,7 @@ class MailboxDashBoardController extends ReloadableController with UserSettingPo } result = await Get.to( - () => const ComposerView(), + () => const ComposerView(key: ValueKey(ComposerKeyValues.composerView)), binding: ComposerBindings(), opaque: false, arguments: argumentsWithIdentity); diff --git a/lib/features/thread/presentation/thread_view.dart b/lib/features/thread/presentation/thread_view.dart index b6a172794b..318e47ea8c 100644 --- a/lib/features/thread/presentation/thread_view.dart +++ b/lib/features/thread/presentation/thread_view.dart @@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:get/get.dart'; import 'package:jmap_dart_client/jmap/mail/email/email.dart'; import 'package:model/model.dart'; +import 'package:tmail_ui_user/features/base/key_values/composer_key_values.dart'; import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.dart'; import 'package:tmail_ui_user/features/base/mixin/popup_menu_widget_mixin.dart'; import 'package:tmail_ui_user/features/base/widget/compose_floating_button.dart'; @@ -281,6 +282,7 @@ class ThreadView extends GetWidget ? EdgeInsets.only(bottom: controller.responsiveUtils.isTabletLarge(context) ? 85 : 70) : EdgeInsets.zero, child: ComposeFloatingButton( + key: const ValueKey(ComposerKeyValues.openComposerButton), scrollController: controller.listEmailController, onTap: () => controller.mailboxDashBoardController.goToComposer(ComposerArguments()) ), diff --git a/lib/main.dart b/lib/main.dart index 9856c400d5..511e74ea98 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,5 @@ import 'package:core/presentation/utils/theme_utils.dart'; import 'package:core/utils/app_logger.dart'; -import 'package:core/utils/platform_info.dart'; import 'package:flutter/material.dart'; import 'package:flutter/semantics.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -19,9 +18,7 @@ import 'package:worker_manager/worker_manager.dart'; void main() async { initLogger(() async { WidgetsFlutterBinding.ensureInitialized(); - if (PlatformInfo.isWeb) { - SemanticsBinding.instance.ensureSemantics(); - } + SemanticsBinding.instance.ensureSemantics(); ThemeUtils.setSystemLightUIStyle(); await Future.wait([ diff --git a/lib/main/pages/app_pages.dart b/lib/main/pages/app_pages.dart index 83e23838f0..5cd2c01ca1 100644 --- a/lib/main/pages/app_pages.dart +++ b/lib/main/pages/app_pages.dart @@ -1,8 +1,11 @@ import 'dart:io'; import 'package:core/core.dart'; +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:get/get_navigation/src/routes/get_route.dart'; +import 'package:tmail_ui_user/features/base/key_values/composer_key_values.dart'; +import 'package:tmail_ui_user/features/base/key_values/login_key_values.dart'; import 'package:tmail_ui_user/features/composer/presentation/composer_bindings.dart'; import 'package:tmail_ui_user/features/composer/presentation/composer_view.dart' deferred as composer; import 'package:tmail_ui_user/features/contact/presentation/contact_bindings.dart'; @@ -43,7 +46,9 @@ class AppPages { binding: HomeBindings()), GetPage( name: AppRoutes.login, - page: () => DeferredWidget(login.loadLibrary, () => login.LoginView()), + page: () => DeferredWidget(login.loadLibrary, () => login.LoginView( + key: const ValueKey(LoginKeyValues.loginView), + )), binding: LoginBindings()), GetPage( name: AppRoutes.dashboard, @@ -87,7 +92,7 @@ class AppPages { name: AppRoutes.composer, page: () => DeferredWidget( composer.loadLibrary, - () => composer.ComposerView()), + () => composer.ComposerView(key: const ValueKey(ComposerKeyValues.composerView))), binding: ComposerBindings()), GetPage( name: AppRoutes.destinationPicker,