feat: Implement loading state in ForgotPasswordScreen during password reset process
This commit is contained in:
parent
18987aa97a
commit
8c2d258848
@ -24,6 +24,19 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen>
|
||||
Get.put(ForgotPasswordController());
|
||||
|
||||
bool get _isBetaEnvironment => ApiEndpoints.baseUrl.contains("stage");
|
||||
bool _isLoading = false;
|
||||
|
||||
void _handleForgotPassword() async {
|
||||
setState(() {
|
||||
_isLoading = true;
|
||||
});
|
||||
|
||||
await controller.onForgotPassword();
|
||||
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -96,16 +109,26 @@ class _ForgotPasswordScreenState extends State<ForgotPasswordScreen>
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
MyButton.rounded(
|
||||
onPressed: controller.onForgotPassword,
|
||||
onPressed:
|
||||
_isLoading ? null : _handleForgotPassword,
|
||||
elevation: 2,
|
||||
padding: MySpacing.xy(80, 16),
|
||||
borderRadiusAll: 10,
|
||||
backgroundColor: contentTheme.brandRed,
|
||||
child: MyText.labelLarge(
|
||||
'Send Reset Link',
|
||||
fontWeight: 700,
|
||||
color: Colors.white,
|
||||
),
|
||||
backgroundColor: _isLoading ? Colors.red.withOpacity(0.6) : contentTheme.brandRed,
|
||||
child: _isLoading
|
||||
? const SizedBox(
|
||||
height: 20,
|
||||
width: 20,
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: MyText.labelLarge(
|
||||
'Send Reset Link',
|
||||
fontWeight: 700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
TextButton(
|
||||
|
Loading…
x
Reference in New Issue
Block a user