diff --git a/lib/view/auth/forgot_password_screen.dart b/lib/view/auth/forgot_password_screen.dart index b3f925b..e6d0c64 100644 --- a/lib/view/auth/forgot_password_screen.dart +++ b/lib/view/auth/forgot_password_screen.dart @@ -24,6 +24,19 @@ class _ForgotPasswordScreenState extends State 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 ), 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(