Add toggle button to show or hide password in MapSurveyView Settings page

This commit is contained in:
torok.istvan 2025-09-11 08:56:17 +02:00
parent a3b2deec21
commit 057f4a4809
2 changed files with 52 additions and 17 deletions

View File

@ -108,7 +108,8 @@ class MapSurveyController extends GetxController {
Rx<bool> pointMeasuringDirectionForward = true.obs;
Rx<bool> isShowPassword = true.obs;
Rx<bool> isShowPassword = false.obs;
final passwordFieldFocusNode = FocusNode();
List<PointWithDescription> 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;
}
}

View File

@ -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)