Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 21
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 21
22_23-J 21
Commits
9f8e68bc
Commit
9f8e68bc
authored
May 09, 2023
by
Hirunika R.A.S.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added forget password screen
parent
548c1598
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
FrontEnd/lib/screens/forget_password.dart
FrontEnd/lib/screens/forget_password.dart
+93
-0
No files found.
FrontEnd/lib/screens/forget_password.dart
0 → 100644
View file @
9f8e68bc
import
'package:flutter/material.dart'
;
import
'package:govimithura/providers/authentication_provider.dart'
;
import
'package:govimithura/screens/login.dart'
;
import
'package:govimithura/utils/loading_overlay.dart'
;
import
'package:govimithura/utils/utils.dart'
;
import
'package:govimithura/widgets/utils/common_widget.dart'
;
import
'package:provider/provider.dart'
;
import
'../widgets/utils/buttons/custom_elevated_button.dart'
;
import
'../widgets/utils/text_fields/primary_textfield.dart'
;
class
ForgetPasswordScreen
extends
StatefulWidget
{
const
ForgetPasswordScreen
({
super
.
key
});
@override
State
<
ForgetPasswordScreen
>
createState
()
=>
_ForgetPasswordScreenState
();
}
class
_ForgetPasswordScreenState
extends
State
<
ForgetPasswordScreen
>
{
final
GlobalKey
<
FormState
>
_key
=
GlobalKey
<
FormState
>();
late
AuthenticationProvider
pAuthentication
;
@override
void
initState
()
{
super
.
initState
();
pAuthentication
=
Provider
.
of
<
AuthenticationProvider
>(
context
,
listen:
false
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
"Forget Password"
,
),
),
body:
Padding
(
padding:
const
EdgeInsets
.
all
(
10.0
),
child:
Form
(
key:
_key
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
const
LogoText
(),
spacingWidget
(
30
,
SpaceDirection
.
vertical
),
const
Text
(
"Please enter your email address to recieve reset password link"
,
style:
TextStyle
(
fontSize:
16
),
textAlign:
TextAlign
.
center
,
),
spacingWidget
(
20
,
SpaceDirection
.
vertical
),
PrimaryTextField
(
onChanged:
(
value
)
{
pAuthentication
.
setEmail
(
value
);
},
label:
"Email Address"
,
validator:
(
value
)
{
if
(
value
==
null
||
value
.
isEmpty
)
{
return
'Required'
;
}
else
if
(!(
value
.
contains
(
"@"
)
&&
value
.
contains
(
"."
)))
{
return
'Enter valid Email Address'
;
}
return
null
;
},
),
spacingWidget
(
20
,
SpaceDirection
.
vertical
),
CustomElevatedButton
(
text:
"Send reset password link"
,
onPressed:
()
async
{
if
(
_key
.
currentState
!.
validate
())
{
Navigator
.
pushAndRemoveUntil
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
const
LoginScreen
()),
(
route
)
=>
false
);
bool
isSent
=
await
LoadingOverlay
.
of
(
context
)
.
during
(
pAuthentication
.
forgetPassword
(
context
));
if
(
mounted
&&
isSent
)
{
Utils
.
showDialogBox
(
context
,
"Link sent to
${pAuthentication.authModel.email}
please check your email inbox"
);
}
}
},
)
],
),
),
),
);
}
}
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