diff --git a/lib/app_sources/github.dart b/lib/app_sources/github.dart index 82af377..910eb61 100644 --- a/lib/app_sources/github.dart +++ b/lib/app_sources/github.dart @@ -15,6 +15,7 @@ class GitHub extends AppSource { additionalSourceSpecificSettingFormItems = [ GeneratedFormTextField('github-creds', label: tr('githubPATLabel'), + password: true, required: false, additionalValidators: [ (value) { diff --git a/lib/components/generated_form.dart b/lib/components/generated_form.dart index 7698dd0..6a74181 100644 --- a/lib/components/generated_form.dart +++ b/lib/components/generated_form.dart @@ -3,7 +3,6 @@ import 'dart:math'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:obtainium/components/generated_form_modal.dart'; -import 'package:obtainium/providers/settings_provider.dart'; abstract class GeneratedFormItem { late String key; @@ -24,6 +23,7 @@ class GeneratedFormTextField extends GeneratedFormItem { late bool required; late int max; late String? hint; + late bool password; GeneratedFormTextField(String key, {String label = 'Input', @@ -32,7 +32,8 @@ class GeneratedFormTextField extends GeneratedFormItem { List additionalValidators = const [], this.required = true, this.max = 1, - this.hint}) + this.hint, + this.password = false}) : super(key, label: label, belowWidgets: belowWidgets, @@ -188,6 +189,9 @@ class _GeneratedFormState extends State { if (formItem is GeneratedFormTextField) { final formFieldKey = GlobalKey(); return TextFormField( + obscureText: formItem.password, + autocorrect: !formItem.password, + enableSuggestions: !formItem.password, key: formFieldKey, initialValue: values[formItem.key], autovalidateMode: AutovalidateMode.onUserInteraction,