2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 13:36:50 +00:00

Adds ability to show / hide password in profile widget

This commit is contained in:
Oliver Walters 2022-05-10 23:42:27 +10:00
parent 6d764e32a0
commit 23a27fde67

View File

@ -240,6 +240,8 @@ class _ProfileEditState extends State<ProfileEditWidget> {
String username = ""; String username = "";
String password = ""; String password = "";
bool _obscured = true;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -379,10 +381,18 @@ class _ProfileEditState extends State<ProfileEditWidget> {
labelText: L10().password, labelText: L10().password,
labelStyle: TextStyle(fontWeight: FontWeight.bold), labelStyle: TextStyle(fontWeight: FontWeight.bold),
hintText: L10().enterPassword, hintText: L10().enterPassword,
suffixIcon: IconButton(
icon: _obscured ? FaIcon(FontAwesomeIcons.eye) : FaIcon(FontAwesomeIcons.solidEyeSlash),
onPressed: () {
setState(() {
_obscured = !_obscured;
});
},
),
), ),
initialValue: profile?.password ?? "", initialValue: profile?.password ?? "",
keyboardType: TextInputType.visiblePassword, keyboardType: TextInputType.visiblePassword,
obscureText: true, obscureText: _obscured,
onSaved: (value) { onSaved: (value) {
password = value ?? ""; password = value ?? "";
}, },