Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
medapp_eksad
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qorri_di
medapp_eksad
Commits
297a0bd5
Commit
297a0bd5
authored
Sep 05, 2022
by
qorri_di
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing login
- delete variabel yang tidak digunain.
parent
163106e3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
23 deletions
+19
-23
login.dart
lib/login.dart
+18
-22
main.dart
lib/main.dart
+1
-1
No files found.
lib/login.dart
View file @
297a0bd5
...
@@ -8,21 +8,19 @@ void setPageTitle(String title, BuildContext context) {
...
@@ -8,21 +8,19 @@ void setPageTitle(String title, BuildContext context) {
));
));
}
}
class
logi
n
extends
StatefulWidget
{
class
SignI
n
extends
StatefulWidget
{
const
logi
n
({
Key
?
key
})
:
super
(
key:
key
);
const
SignI
n
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
State
<
login
>
createState
()
=>
_logi
nState
();
State
<
SignIn
>
createState
()
=>
_SignI
nState
();
}
}
class
_
loginState
extends
State
<
logi
n
>
{
class
_
SignInState
extends
State
<
SignI
n
>
{
bool
_isObscure
=
true
;
bool
_isObscure
=
true
;
final
formKey
=
GlobalKey
<
FormState
>();
final
formKey
=
GlobalKey
<
FormState
>();
String
_usmail
=
''
;
final
TextEditingController
_usernamecontroller
=
TextEditingController
();
String
_uspswd
=
''
;
final
TextEditingController
_passwordcontroller
=
TextEditingController
();
final
TextEditingController
_editingController
=
TextEditingController
();
final
TextEditingController
_editingController2
=
TextEditingController
();
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
@@ -123,7 +121,7 @@ class _loginState extends State<login> {
...
@@ -123,7 +121,7 @@ class _loginState extends State<login> {
height:
40
,
height:
40
,
width:
screenSize
.
width
*
0.2
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
child:
TextFormField
(
controller:
_
editingC
ontroller
,
controller:
_
usernamec
ontroller
,
textAlign:
TextAlign
.
start
,
textAlign:
TextAlign
.
start
,
decoration:
InputDecoration
(
decoration:
InputDecoration
(
labelText:
"Enter Your Email"
,
labelText:
"Enter Your Email"
,
...
@@ -134,7 +132,7 @@ class _loginState extends State<login> {
...
@@ -134,7 +132,7 @@ class _loginState extends State<login> {
),
),
validator:
(
value
)
{
validator:
(
value
)
{
if
(
value
==
null
||
value
.
trim
().
isEmpty
)
{
if
(
value
==
null
||
value
.
trim
().
isEmpty
)
{
_
editingC
ontroller
.
clear
();
_
usernamec
ontroller
.
clear
();
return
"please enter your email address"
;
return
"please enter your email address"
;
}
else
if
(!
RegExp
(
r'\S+@\S+\.\S+'
)
}
else
if
(!
RegExp
(
r'\S+@\S+\.\S+'
)
.
hasMatch
(
value
))
{
.
hasMatch
(
value
))
{
...
@@ -143,7 +141,6 @@ class _loginState extends State<login> {
...
@@ -143,7 +141,6 @@ class _loginState extends State<login> {
return
null
;
return
null
;
}
}
},
},
onChanged:
(
value
)
=>
_usmail
=
value
,
),
),
),
),
const
Spacer
(
const
Spacer
(
...
@@ -169,7 +166,7 @@ class _loginState extends State<login> {
...
@@ -169,7 +166,7 @@ class _loginState extends State<login> {
height:
40
,
height:
40
,
width:
screenSize
.
width
*
0.2
,
width:
screenSize
.
width
*
0.2
,
child:
TextFormField
(
child:
TextFormField
(
controller:
_
editingController2
,
controller:
_
passwordcontroller
,
textAlign:
TextAlign
.
start
,
textAlign:
TextAlign
.
start
,
obscureText:
_isObscure
,
obscureText:
_isObscure
,
decoration:
InputDecoration
(
decoration:
InputDecoration
(
...
@@ -192,14 +189,13 @@ class _loginState extends State<login> {
...
@@ -192,14 +189,13 @@ class _loginState extends State<login> {
),
),
validator:
(
value
)
{
validator:
(
value
)
{
if
(
value
==
null
||
value
.
trim
().
isEmpty
)
{
if
(
value
==
null
||
value
.
trim
().
isEmpty
)
{
_
editingController2
.
clear
();
_
passwordcontroller
.
clear
();
return
'This field is required'
;
return
'This field is required'
;
}
else
if
(
value
.
trim
().
length
<
8
)
{
}
else
if
(
value
.
trim
().
length
<
8
)
{
return
'Password must be at least 8 characters in length'
;
return
'Password must be at least 8 characters in length'
;
}
}
return
null
;
return
null
;
},
},
onChanged:
(
value
)
=>
_uspswd
=
value
,
),
),
),
),
const
Spacer
(
const
Spacer
(
...
@@ -225,8 +221,8 @@ class _loginState extends State<login> {
...
@@ -225,8 +221,8 @@ class _loginState extends State<login> {
width:
screenSize
.
width
*
0.08
,
width:
screenSize
.
width
*
0.08
,
child:
ElevatedButton
(
child:
ElevatedButton
(
onPressed:
()
{
onPressed:
()
{
if
(
_us
mail
==
'admin@admin.com'
&&
if
(
_us
ernamecontroller
.
value
.
text
==
'admin@admin.com'
&&
_
uspswd
!=
'administrator'
)
{
_
passwordcontroller
.
value
.
text
!=
'administrator'
)
{
showDialog
<
String
>(
showDialog
<
String
>(
context:
context
,
context:
context
,
builder:
(
BuildContext
context
)
=>
builder:
(
BuildContext
context
)
=>
...
@@ -243,8 +239,8 @@ class _loginState extends State<login> {
...
@@ -243,8 +239,8 @@ class _loginState extends State<login> {
],
],
),
),
);
);
}
else
if
(
_us
mail
==
'client@client.com'
&&
}
else
if
(
_us
ernamecontroller
.
value
.
text
==
'client@client.com'
&&
_
uspswd
!=
'clientpage'
)
{
_
passwordcontroller
.
value
.
text
!=
'clientpage'
)
{
showDialog
<
String
>(
showDialog
<
String
>(
context:
context
,
context:
context
,
builder:
(
BuildContext
context
)
=>
builder:
(
BuildContext
context
)
=>
...
@@ -261,11 +257,11 @@ class _loginState extends State<login> {
...
@@ -261,11 +257,11 @@ class _loginState extends State<login> {
],
],
),
),
);
);
}
else
if
(
_us
mail
==
'admin@admin.com'
&&
}
else
if
(
_us
ernamecontroller
.
value
.
text
==
'admin@admin.com'
&&
_
uspswd
==
'administrator'
)
{
_
passwordcontroller
.
value
.
text
==
'administrator'
)
{
Navigator
.
pushNamed
(
context
,
'/admin'
);
Navigator
.
pushNamed
(
context
,
'/admin'
);
}
else
if
(
_us
mail
==
'client@client.com'
&&
}
else
if
(
_us
ernamecontroller
.
value
.
text
==
'client@client.com'
&&
_
uspswd
==
'clientpage'
)
{
_
passwordcontroller
.
value
.
text
==
'clientpage'
)
{
Navigator
.
pushNamed
(
context
,
'/client'
);
Navigator
.
pushNamed
(
context
,
'/client'
);
}
else
{
}
else
{
showDialog
<
String
>(
showDialog
<
String
>(
...
...
lib/main.dart
View file @
297a0bd5
...
@@ -25,7 +25,7 @@ class MyApp extends StatelessWidget {
...
@@ -25,7 +25,7 @@ class MyApp extends StatelessWidget {
'/about'
:
(
context
)
=>
const
HomePage
(),
'/about'
:
(
context
)
=>
const
HomePage
(),
'/solutions'
:
(
context
)
=>
const
Solutions
(),
'/solutions'
:
(
context
)
=>
const
Solutions
(),
'/contact'
:
(
context
)
=>
const
ContactUs
(),
'/contact'
:
(
context
)
=>
const
ContactUs
(),
'/login'
:
(
context
)
=>
const
logi
n
(),
'/login'
:
(
context
)
=>
const
SignI
n
(),
'/register'
:
(
context
)
=>
const
Register
(),
'/register'
:
(
context
)
=>
const
Register
(),
'/dashboard'
:
(
context
)
=>
const
DashboardAdmin
(),
'/dashboard'
:
(
context
)
=>
const
DashboardAdmin
(),
'/reset_password'
:
(
context
)
=>
const
ForgotPassword
(),
'/reset_password'
:
(
context
)
=>
const
ForgotPassword
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment