From bf206dc309fda20097ef0335c3563812296a5553 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Tue, 16 Jun 2026 11:36:37 +0800 Subject: [PATCH] fixing https://github.com/rustdesk/rustdesk/issues/15293 --- flutter/lib/mobile/widgets/dialog.dart | 49 ++++++++++++++++++++------ 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/flutter/lib/mobile/widgets/dialog.dart b/flutter/lib/mobile/widgets/dialog.dart index 8b645bb88..f1ff8550f 100644 --- a/flutter/lib/mobile/widgets/dialog.dart +++ b/flutter/lib/mobile/widgets/dialog.dart @@ -117,13 +117,13 @@ void showServerSettingsWithValue( ), SizedBox(width: 8), Expanded( - child: TextFormField( + child: serverSettingsTextFormField( + label: label, controller: controller, - decoration: InputDecoration( - errorText: errorMsg.isEmpty ? null : errorMsg, - contentPadding: - EdgeInsets.symmetric(horizontal: 8, vertical: 12), - ), + errorMsg: errorMsg, + contentPadding: + EdgeInsets.symmetric(horizontal: 8, vertical: 12), + showLabelText: false, validator: validator, autofocus: autofocus, ).workaroundFreezeLinuxMint(), @@ -132,12 +132,10 @@ void showServerSettingsWithValue( ); } - return TextFormField( + return serverSettingsTextFormField( + label: label, controller: controller, - decoration: InputDecoration( - labelText: label, - errorText: errorMsg.isEmpty ? null : errorMsg, - ), + errorMsg: errorMsg, validator: validator, ).workaroundFreezeLinuxMint(); } @@ -209,6 +207,35 @@ void showServerSettingsWithValue( }); } +TextFormField serverSettingsTextFormField({ + required String label, + required TextEditingController controller, + required String errorMsg, + String? Function(String?)? validator, + bool autofocus = false, + bool showLabelText = true, + EdgeInsetsGeometry? contentPadding, +}) { + return TextFormField( + controller: controller, + decoration: InputDecoration( + labelText: showLabelText ? label : null, + errorText: errorMsg.isEmpty ? null : errorMsg, + contentPadding: contentPadding, + ), + validator: validator, + autofocus: autofocus, + keyboardType: TextInputType.visiblePassword, + textCapitalization: TextCapitalization.none, + autocorrect: false, + enableSuggestions: false, + smartDashesType: SmartDashesType.disabled, + smartQuotesType: SmartQuotesType.disabled, + enableIMEPersonalizedLearning: false, + spellCheckConfiguration: const SpellCheckConfiguration.disabled(), + ); +} + void setPrivacyModeDialog( OverlayDialogManager dialogManager, List privacyModeList,