forked from eatvio/eatvio_app
feat(registration): hide/show password
This commit is contained in:
@@ -21,6 +21,8 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
|
||||
final passwordConfirmationController = TextEditingController();
|
||||
|
||||
bool hidePassword = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -55,10 +57,21 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
Text(s.password),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
obscureText: true,
|
||||
obscureText: hidePassword,
|
||||
controller: passwordController,
|
||||
hintText: 'Введите пароль',
|
||||
textInputAction: TextInputAction.next,
|
||||
suffix: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
hidePassword = !hidePassword;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
hidePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
onChanged: (newValue) {
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(password: newValue));
|
||||
@@ -68,10 +81,21 @@ class _CredentialsScreenState extends State<CredentialsScreen> {
|
||||
Text(s.password_confirmation),
|
||||
SizedBox(height: 4),
|
||||
CustomTextFormField(
|
||||
obscureText: true,
|
||||
obscureText: hidePassword,
|
||||
controller: passwordConfirmationController,
|
||||
textInputAction: TextInputAction.done,
|
||||
hintText: 'Подтвердите пароль',
|
||||
suffix: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
hidePassword = !hidePassword;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
hidePassword ? Icons.visibility_outlined : Icons.visibility_off_outlined,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
onChanged: (newValue) {
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(passwordConfirmation: newValue));
|
||||
|
||||
Reference in New Issue
Block a user