forked from yaso_meth/mih-project
update passowrd field to have toggle
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -12,15 +12,17 @@ class MyAppBar extends StatelessWidget {
|
||||
backgroundColor: Colors.blueAccent,
|
||||
elevation: 8,
|
||||
shadowColor: Colors.black,
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
client.auth.signOut();
|
||||
Navigator.of(context).pushNamed('/');
|
||||
},
|
||||
icon: const Icon(Icons.logout),
|
||||
iconSize: 35,
|
||||
color: Colors.black,
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
client.auth.signOut();
|
||||
Navigator.of(context).pushNamed('/');
|
||||
},
|
||||
icon: const Icon(Icons.logout),
|
||||
iconSize: 35,
|
||||
color: Colors.black,
|
||||
),
|
||||
],
|
||||
title: Text(
|
||||
barTitle,
|
||||
style: const TextStyle(
|
||||
|
||||
69
Frontend/patient_manager/lib/components/myPassInput.dart
Normal file
69
Frontend/patient_manager/lib/components/myPassInput.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MyPassField extends StatefulWidget {
|
||||
final controller;
|
||||
final String hintText;
|
||||
|
||||
const MyPassField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.hintText,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MyPassField> createState() => _MyPassFieldState();
|
||||
}
|
||||
|
||||
class _MyPassFieldState extends State<MyPassField> {
|
||||
final textFieldFocusNode = FocusNode();
|
||||
bool _obscured = true;
|
||||
|
||||
void _toggleObscured() {
|
||||
setState(() {
|
||||
_obscured = !_obscured;
|
||||
if (textFieldFocusNode.hasPrimaryFocus)
|
||||
return; // If focus is on text field, dont unfocus
|
||||
textFieldFocusNode.canRequestFocus =
|
||||
false; // Prevents focus if tap on eye
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 25.0),
|
||||
child: TextField(
|
||||
controller: widget.controller,
|
||||
obscureText: _obscured,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: true,
|
||||
hintText: widget.hintText,
|
||||
hintStyle: TextStyle(color: Colors.blueGrey[400]),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.blueAccent,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.blue),
|
||||
),
|
||||
suffixIcon: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 0, 4, 0),
|
||||
child: GestureDetector(
|
||||
onTap: _toggleObscured,
|
||||
child: Icon(
|
||||
_obscured
|
||||
? Icons.visibility_rounded
|
||||
: Icons.visibility_off_rounded,
|
||||
size: 24,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,11 @@ import 'package:flutter/material.dart';
|
||||
class MyTextField extends StatelessWidget {
|
||||
final controller;
|
||||
final String hintText;
|
||||
final bool obscureText;
|
||||
|
||||
const MyTextField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.hintText,
|
||||
required this.obscureText,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -18,17 +16,18 @@ class MyTextField extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 25.0),
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
obscureText: obscureText,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: true,
|
||||
hintText: hintText,
|
||||
hintStyle: TextStyle(color: Colors.blueGrey[400]),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.blueAccent,
|
||||
width: 2.0,
|
||||
)),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.blueAccent,
|
||||
width: 2.0,
|
||||
),
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.blue),
|
||||
),
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/myTextField.dart';
|
||||
import 'package:patient_manager/components/myPassInput.dart';
|
||||
import 'package:patient_manager/components/myTextInput.dart';
|
||||
import 'package:patient_manager/components/mybutton.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
|
||||
@@ -15,11 +16,12 @@ class Register extends StatefulWidget {
|
||||
class _RegisterState extends State<Register> {
|
||||
final emailController = TextEditingController();
|
||||
final passwordController = TextEditingController();
|
||||
|
||||
final confirmPasswordController = TextEditingController();
|
||||
bool _obscureText = true;
|
||||
//sign user in
|
||||
Future<void> signUserIn() async {
|
||||
Future<void> signUserUp() async {
|
||||
try {
|
||||
final response = await client.auth.signInWithPassword(
|
||||
final response = await client.auth.signUp(
|
||||
email: emailController.text,
|
||||
password: passwordController.text,
|
||||
);
|
||||
@@ -44,6 +46,12 @@ class _RegisterState extends State<Register> {
|
||||
);
|
||||
}
|
||||
|
||||
void toggle() {
|
||||
setState(() {
|
||||
_obscureText = !_obscureText;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -80,7 +88,6 @@ class _RegisterState extends State<Register> {
|
||||
child: MyTextField(
|
||||
controller: emailController,
|
||||
hintText: 'Email',
|
||||
obscureText: false,
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
@@ -88,10 +95,19 @@ class _RegisterState extends State<Register> {
|
||||
//password input
|
||||
SizedBox(
|
||||
width: 500.0,
|
||||
child: MyTextField(
|
||||
child: MyPassField(
|
||||
controller: passwordController,
|
||||
hintText: 'Password',
|
||||
obscureText: true,
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 25),
|
||||
//password input
|
||||
SizedBox(
|
||||
width: 500.0,
|
||||
child: MyPassField(
|
||||
controller: confirmPasswordController,
|
||||
hintText: 'Confirm Password',
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
@@ -113,11 +129,11 @@ class _RegisterState extends State<Register> {
|
||||
),
|
||||
//spacer
|
||||
const SizedBox(height: 50),
|
||||
// sign in button
|
||||
// sign up button
|
||||
SizedBox(
|
||||
width: 500.0,
|
||||
child: MyButton(
|
||||
onTap: signUserIn,
|
||||
onTap: signUserUp,
|
||||
buttonText: "Sign Up",
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:patient_manager/components/myTextField.dart';
|
||||
import 'package:patient_manager/components/myPassInput.dart';
|
||||
import 'package:patient_manager/components/myTextInput.dart';
|
||||
import 'package:patient_manager/components/mybutton.dart';
|
||||
import 'package:patient_manager/main.dart';
|
||||
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
|
||||
@@ -15,6 +16,7 @@ class SignIn extends StatefulWidget {
|
||||
class _SignInState extends State<SignIn> {
|
||||
final emailController = TextEditingController();
|
||||
final passwordController = TextEditingController();
|
||||
//bool _obscureText = true;
|
||||
|
||||
//sign user in
|
||||
Future<void> signUserIn() async {
|
||||
@@ -80,7 +82,6 @@ class _SignInState extends State<SignIn> {
|
||||
child: MyTextField(
|
||||
controller: emailController,
|
||||
hintText: 'Email',
|
||||
obscureText: false,
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
@@ -88,10 +89,9 @@ class _SignInState extends State<SignIn> {
|
||||
//password input
|
||||
SizedBox(
|
||||
width: 500.0,
|
||||
child: MyTextField(
|
||||
child: MyPassField(
|
||||
controller: passwordController,
|
||||
hintText: 'Password',
|
||||
obscureText: true,
|
||||
),
|
||||
),
|
||||
//spacer
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
database/binlog.000004
Normal file
BIN
database/binlog.000004
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
4294967294,471
|
||||
4294967278,288
|
||||
4294967294,472
|
||||
4294967278,293
|
||||
4294967293,131
|
||||
4294967293,130
|
||||
4294967293,129
|
||||
@@ -141,117 +141,110 @@
|
||||
4243767282,0
|
||||
4243767281,0
|
||||
4294967293,0
|
||||
4294967279,142
|
||||
4294967279,143
|
||||
4294967279,30
|
||||
4294967279,144
|
||||
4294967279,145
|
||||
4294967279,30
|
||||
4294967279,31
|
||||
4294967279,146
|
||||
4294967279,32
|
||||
4294967279,33
|
||||
4294967279,146
|
||||
4294967279,147
|
||||
4294967279,34
|
||||
4294967279,148
|
||||
4294967279,149
|
||||
4294967279,34
|
||||
4294967279,35
|
||||
4294967279,150
|
||||
4294967279,36
|
||||
4294967279,37
|
||||
4294967279,150
|
||||
4294967279,151
|
||||
4294967279,38
|
||||
4294967279,152
|
||||
4294967279,153
|
||||
4294967279,38
|
||||
4294967279,39
|
||||
4294967279,40
|
||||
4294967279,41
|
||||
4294967279,154
|
||||
4294967279,155
|
||||
4294967279,156
|
||||
4294967279,40
|
||||
4294967279,158
|
||||
4294967279,41
|
||||
4294967279,42
|
||||
4294967279,156
|
||||
4294967279,155
|
||||
4294967279,157
|
||||
4294967279,43
|
||||
4294967279,44
|
||||
4294967279,157
|
||||
4294967279,45
|
||||
4294967279,159
|
||||
4294967279,162
|
||||
4294967279,160
|
||||
4294967279,161
|
||||
4294967279,45
|
||||
4294967279,46
|
||||
4294967279,163
|
||||
4294967279,47
|
||||
4294967279,48
|
||||
4294967279,162
|
||||
4294967279,163
|
||||
4294967279,164
|
||||
4294967279,165
|
||||
4294967279,49
|
||||
4294967279,50
|
||||
4294967279,51
|
||||
4294967279,52
|
||||
4294967279,164
|
||||
4294967279,165
|
||||
4294967279,166
|
||||
4294967279,167
|
||||
4294967279,168
|
||||
4294967279,169
|
||||
4294967279,51
|
||||
4294967279,52
|
||||
4294967279,53
|
||||
4294967279,54
|
||||
4294967279,168
|
||||
4294967279,170
|
||||
4294967279,169
|
||||
4294967279,171
|
||||
4294967279,55
|
||||
4294967279,56
|
||||
4294967279,170
|
||||
4294967279,171
|
||||
4294967279,172
|
||||
4294967279,173
|
||||
4294967279,57
|
||||
4294967279,172
|
||||
4294967279,58
|
||||
4294967279,59
|
||||
4294967279,60
|
||||
4294967279,173
|
||||
4294967279,175
|
||||
4294967279,176
|
||||
4294967279,177
|
||||
4294967279,178
|
||||
4294967279,60
|
||||
4294967279,61
|
||||
4294967279,177
|
||||
4294967279,62
|
||||
4294967279,178
|
||||
4294967279,63
|
||||
4294967279,64
|
||||
4294967279,179
|
||||
4294967279,64
|
||||
4294967279,180
|
||||
4294967279,181
|
||||
4294967279,182
|
||||
4294967279,65
|
||||
4294967279,182
|
||||
4294967279,66
|
||||
4294967279,67
|
||||
4294967279,68
|
||||
4294967279,183
|
||||
4294967279,184
|
||||
4294967279,68
|
||||
4294967279,185
|
||||
4294967279,186
|
||||
4294967279,69
|
||||
4294967279,70
|
||||
4294967279,186
|
||||
4294967279,71
|
||||
4294967279,72
|
||||
4294967279,187
|
||||
4294967279,188
|
||||
4294967279,72
|
||||
4294967279,189
|
||||
4294967279,190
|
||||
4294967279,73
|
||||
4294967279,74
|
||||
4294967279,190
|
||||
4294967279,75
|
||||
4294967279,76
|
||||
4294967279,191
|
||||
4294967279,192
|
||||
4294967279,191
|
||||
4294967279,76
|
||||
4294967279,193
|
||||
4294967279,194
|
||||
4294967279,77
|
||||
4294967279,78
|
||||
4294967279,194
|
||||
4294967279,79
|
||||
4294967279,80
|
||||
4294967279,195
|
||||
4294967279,196
|
||||
4294967279,197
|
||||
4294967279,198
|
||||
4294967279,80
|
||||
4294967279,81
|
||||
4294967279,197
|
||||
4294967279,82
|
||||
4294967279,83
|
||||
4294967279,84
|
||||
4294967279,199
|
||||
4294967279,200
|
||||
4294967279,201
|
||||
|
||||
BIN
database/ibdata1
BIN
database/ibdata1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user