Skip to content

Commit

Permalink
inverted visibility icons in login signup as they are logically corre…
Browse files Browse the repository at this point in the history
…ct , added color theme for icons, relevant variable names, back button to login page from signup page
  • Loading branch information
Atharv-Joshi committed Nov 9, 2021
1 parent 17bd6ef commit cc460ec
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
12 changes: 6 additions & 6 deletions lib/views/auth/login_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LoginScreenState extends State<LoginScreen> {

String? _email, _password;
FocusNode? _emailFocusNode, _passwordFocusNode, _loginFocusNode;
bool _loading = false, _showPassword = true;
bool _loading = false, _isPasswordHidden = true;

@override
void initState() {
Expand Down Expand Up @@ -124,19 +124,19 @@ class LoginScreenState extends State<LoginScreen> {
child: TextFormField(
focusNode: _passwordFocusNode,
keyboardType: TextInputType.visiblePassword,
obscureText: _showPassword,
obscureText: _isPasswordHidden,
enabled: true,
textInputAction: TextInputAction.done,
decoration: textFieldDecoration(
hintText: 'Password',
suffixIcon: IconButton(
icon: _showPassword
? const Icon(Icons.visibility)
: const Icon(Icons.visibility_off),
icon: _isPasswordHidden
? const Icon(Icons.visibility_off, color: RelicColors.backgroundColor,)
: const Icon(Icons.visibility, color: RelicColors.warningColor,),
onPressed: () {
setState(
() {
_showPassword = !_showPassword;
_isPasswordHidden = !_isPasswordHidden;
},
);
}, //for show and hide password
Expand Down
34 changes: 23 additions & 11 deletions lib/views/auth/signup_view.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart';
import 'package:relic_bazaar/helpers/constants.dart';
import 'package:relic_bazaar/helpers/input_validators.dart';
import 'package:relic_bazaar/widgets/retro_button.dart';
import 'package:relic_bazaar/services/auth_service.dart';
Expand All @@ -16,7 +17,7 @@ class SignUpScreen extends StatefulWidget {
class SignUpScreenState extends State<SignUpScreen> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();

bool showPassword = true, showConfirmPassword = true, _loading = false;
bool isPasswordHidden = true, isConfirmPasswordHidden = true, _loading = false;
String? _email, _password, _confirmPassword;
FocusNode? _emailFocusNode,
_passwordFocusNode,
Expand Down Expand Up @@ -127,18 +128,18 @@ class SignUpScreenState extends State<SignUpScreen> {
child: TextFormField(
focusNode: _passwordFocusNode,
keyboardType: TextInputType.visiblePassword,
obscureText: showPassword,
obscureText: isPasswordHidden,
enabled: true,
textInputAction: TextInputAction.next,
decoration: textFieldDecoration(
hintText: 'Password',
suffixIcon: IconButton(
icon: showPassword
? const Icon(Icons.visibility)
: const Icon(Icons.visibility_off),
icon: isPasswordHidden
? const Icon(Icons.visibility_off, color: RelicColors.backgroundColor,)
: const Icon(Icons.visibility, color: RelicColors.warningColor,),
onPressed: () {
setState(() {
showPassword = !showPassword;
isPasswordHidden = !isPasswordHidden;
});
}, //for show and hide password
),
Expand Down Expand Up @@ -166,18 +167,18 @@ class SignUpScreenState extends State<SignUpScreen> {
child: TextFormField(
focusNode: _confirmPasswordFocusNode,
keyboardType: TextInputType.visiblePassword,
obscureText: showConfirmPassword,
obscureText: isConfirmPasswordHidden,
enabled: true,
textInputAction: TextInputAction.done,
decoration: textFieldDecoration(
hintText: 'Confirm Password',
suffixIcon: IconButton(
icon: showConfirmPassword
? const Icon(Icons.visibility)
: const Icon(Icons.visibility_off),
icon: isConfirmPasswordHidden
? const Icon(Icons.visibility_off, color: RelicColors.backgroundColor,)
: const Icon(Icons.visibility, color: RelicColors.warningColor,),
onPressed: () {
setState(() {
showConfirmPassword = !showConfirmPassword;
isConfirmPasswordHidden = !isConfirmPasswordHidden;
});
}, //for show and hide password
),
Expand Down Expand Up @@ -270,6 +271,17 @@ class SignUpScreenState extends State<SignUpScreen> {
),
),
),
Center(
child: TextButton(
onPressed: () => Navigator.pop(context),
child: const Text(
'Login',
style: TextStyle(
color: Colors.white,
),
),
),
),
],
),
),
Expand Down
8 changes: 5 additions & 3 deletions lib/views/get_user_details_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,11 @@ class _GetUserDetailsViewState extends State<GetUserDetailsView> {
context: context,
);
}
setState(() {
_isLoading = false;
});
if(mounted){
setState(() {
_isLoading = false;
});
}
});
}
}
Expand Down

0 comments on commit cc460ec

Please sign in to comment.