diff --git a/lib/pages/map_survey/presentations/controllers/map_survey_controller.dart b/lib/pages/map_survey/presentations/controllers/map_survey_controller.dart index 5b17809..9edae89 100644 --- a/lib/pages/map_survey/presentations/controllers/map_survey_controller.dart +++ b/lib/pages/map_survey/presentations/controllers/map_survey_controller.dart @@ -108,7 +108,8 @@ class MapSurveyController extends GetxController { Rx pointMeasuringDirectionForward = true.obs; - Rx isShowPassword = true.obs; + Rx isShowPassword = false.obs; + final passwordFieldFocusNode = FocusNode(); List pointWithDescriptionList = []; late Directory? directory; @@ -843,4 +844,10 @@ class MapSurveyController extends GetxController { } void updatePointStatus(int pointId) {} + + void toggleShowPassword() { + isShowPassword.value = !isShowPassword.value; + if (passwordFieldFocusNode.hasPrimaryFocus) return; + passwordFieldFocusNode.canRequestFocus = false; + } } diff --git a/lib/pages/map_survey/presentations/views/settings_dialog.dart b/lib/pages/map_survey/presentations/views/settings_dialog.dart index c461eb3..5754750 100644 --- a/lib/pages/map_survey/presentations/views/settings_dialog.dart +++ b/lib/pages/map_survey/presentations/views/settings_dialog.dart @@ -330,26 +330,54 @@ class SettingsDialog extends StatelessWidget { height: 40, child: TextField( controller: controller.ntripUsernameController, - decoration: const InputDecoration( - border: OutlineInputBorder(), + enableSuggestions: false, + autocorrect: false, + decoration: InputDecoration( + floatingLabelBehavior: FloatingLabelBehavior.never, + isDense: true, + filled: true, + fillColor: Colors.grey.shade300, + border: OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.circular(12)), labelText: 'Felhasználónév', - icon: Icon(Icons.account_circle_rounded)), + prefixIcon: Icon(Icons.account_circle_rounded)), ), ), const SizedBox(height: 10), - SizedBox( - height: 40, - child: TextField( - obscureText: true, - enableSuggestions: false, - autocorrect: false, - controller: controller.ntripPasswordController, - decoration: const InputDecoration( - border: OutlineInputBorder(), - labelText: 'Jelszó', - icon: Icon( - Icons.lock, - )), + Obx( + () => SizedBox( + height: 40, + child: TextField( + keyboardType: TextInputType.visiblePassword, + obscureText: controller.isShowPassword.value, + focusNode: controller.passwordFieldFocusNode, + enableSuggestions: false, + autocorrect: false, + controller: controller.ntripPasswordController, + decoration: InputDecoration( + floatingLabelBehavior: FloatingLabelBehavior.never, + isDense: true, + filled: true, + fillColor: Colors.grey.shade300, + border: OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.circular(12)), + labelText: 'Jelszó', + prefixIcon: Icon( + Icons.lock_rounded, + size: 24, + ), + suffixIcon: Padding( + padding: const EdgeInsets.fromLTRB(0, 0, 4, 0), + child: GestureDetector( + onTap: controller.toggleShowPassword, + child: Icon( + controller.isShowPassword.value + ? Icons.visibility_rounded + : Icons.visibility_off_rounded, + size: 24)))), + ), ), ), const SizedBox(height: 20)