From 1432cb02094ec4f28fc7bbf33b2ceda59f1b60d4 Mon Sep 17 00:00:00 2001 From: dab246 Date: Mon, 18 Oct 2021 15:21:31 +0700 Subject: [PATCH] TF-191 Fix keyboard to email input type when input for Url, Email, To, Cc, Bcc --- core/lib/presentation/views/text/text_field_builder.dart | 6 ++++++ .../widgets/email_address_composer_widget_builder.dart | 1 + lib/features/login/presentation/login_view.dart | 2 ++ 3 files changed, 9 insertions(+) diff --git a/core/lib/presentation/views/text/text_field_builder.dart b/core/lib/presentation/views/text/text_field_builder.dart index 28a3f15b3..a9009cf05 100644 --- a/core/lib/presentation/views/text/text_field_builder.dart +++ b/core/lib/presentation/views/text/text_field_builder.dart @@ -10,6 +10,7 @@ class TextFieldBuilder { bool? _obscureText; int? _maxLines = 1; TextEditingController? _textController; + TextInputType? _keyboardType; void key(Key key) { _key = key; @@ -47,6 +48,10 @@ class TextFieldBuilder { _maxLines = value; } + void keyboardType(TextInputType? value) { + _keyboardType = value; + } + TextField build() { return TextField( key: _key ?? Key('TextFieldBuilder'), @@ -60,6 +65,7 @@ class TextFieldBuilder { keyboardAppearance: Brightness.light, style: _textStyle ?? TextStyle(color: AppColor.textFieldTextColor), obscureText: _obscureText ?? false, + keyboardType: _keyboardType, ); } } \ No newline at end of file diff --git a/lib/features/composer/presentation/widgets/email_address_composer_widget_builder.dart b/lib/features/composer/presentation/widgets/email_address_composer_widget_builder.dart index 63daa4e18..d3774c4d5 100644 --- a/lib/features/composer/presentation/widgets/email_address_composer_widget_builder.dart +++ b/lib/features/composer/presentation/widgets/email_address_composer_widget_builder.dart @@ -123,6 +123,7 @@ class EmailAddressComposerWidgetBuilder { autofocus: prefixEmailAddress == PrefixEmailAddress.to ? true : false, textStyle: TextStyle(color: AppColor.nameUserColor, fontSize: 14, fontWeight: FontWeight.w500), cursorColor: AppColor.primaryColor, + inputType: TextInputType.emailAddress, decoration: InputDecoration( border: InputBorder.none, hintText: AppLocalizations.of(_context).hint_text_email_address, diff --git a/lib/features/login/presentation/login_view.dart b/lib/features/login/presentation/login_view.dart index 9cab84be4..4bebc819e 100644 --- a/lib/features/login/presentation/login_view.dart +++ b/lib/features/login/presentation/login_view.dart @@ -95,6 +95,7 @@ class LoginView extends GetWidget { ..key(Key('login_url_input')) ..onChange((value) => loginController.setUrlText(value)) ..textInputAction(TextInputAction.next) + ..keyboardType(TextInputType.emailAddress) ..textDecoration(LoginInputDecorationBuilder() .setLabelText(AppLocalizations.of(context).prefix_https) .setPrefixText(AppLocalizations.of(context).prefix_https) @@ -111,6 +112,7 @@ class LoginView extends GetWidget { ..key(Key('login_username_input')) ..onChange((value) => loginController.setUserNameText(value)) ..textInputAction(TextInputAction.next) + ..keyboardType(TextInputType.emailAddress) ..textDecoration(LoginInputDecorationBuilder() .setLabelText(AppLocalizations.of(context).username) .setHintText(AppLocalizations.of(context).username)