Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add feature to show password #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand Down
12 changes: 5 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
delete rootProject.buildDir
}
}
16 changes: 15 additions & 1 deletion lib/screens/loginScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class _LoginScreenState extends State<LoginScreen> {
String _username;
String _password;
bool _wrongCredentials = false;
bool _isObscure = true;

Future<void> _showDialogbox(String message) async {
_logger.i('Showing dialog');
Expand Down Expand Up @@ -95,9 +96,22 @@ class _LoginScreenState extends State<LoginScreen> {

// Password
TextFormField(
obscureText: true,
obscureText: _isObscure,
decoration: inputDecoration.copyWith(
labelText: 'Password',
suffixIcon: IconButton(
icon: Icon(
_isObscure
? Icons.visibility_off_outlined
: Icons.visibility_outlined,
color: Colors.white,
),
onPressed: () {
setState(() {
_isObscure = !_isObscure;
});
},
),
),
// validator: (value) {
// return validator.validatePassword(value);
Expand Down
31 changes: 29 additions & 2 deletions lib/screens/registerScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
bool _acceptedTerms = false;
bool _acceptedPrivacy = false;
bool _showError = false;
bool _isObscure = true;

Future<void> _showDialogbox(String message) async {
_logger.i('Showing dialog');
Expand Down Expand Up @@ -113,9 +114,22 @@ class _RegisterScreenState extends State<RegisterScreen> {

// Password
TextFormField(
obscureText: true,
obscureText: _isObscure,
decoration: inputDecoration.copyWith(
labelText: 'Password',
suffixIcon: IconButton(
icon: Icon(
_isObscure
? Icons.visibility_off_outlined
: Icons.visibility_outlined,
color: Colors.white,
),
onPressed: () {
setState(() {
_isObscure = !_isObscure;
});
},
),
),
// validator: (value) {
// return validator.validatePassword(value);
Expand All @@ -131,9 +145,22 @@ class _RegisterScreenState extends State<RegisterScreen> {

// Confirm Password
TextFormField(
obscureText: true,
obscureText: _isObscure,
decoration: inputDecoration.copyWith(
labelText: 'Password',
suffixIcon: IconButton(
icon: Icon(
_isObscure
? Icons.visibility_off_outlined
: Icons.visibility_outlined,
color: Colors.white,
),
onPressed: () {
setState(() {
_isObscure = !_isObscure;
});
},
),
),
validator: (value) {
if (_confirmPassword.compareTo(_password) != 0) {
Expand Down
Loading