Overview
RecoverScreen is a Jetpack Compose screen component that provides password recovery functionality. It allows users to request a password reset email through Firebase Authentication.
File Location: com.demodogo.ev_sum_2.ui.auth.RecoverScreen
Component Signature
Parameters
Callback function invoked when the user wants to navigate back to the login screen
State Management
The component manages the following internal state:- email: User’s email input for password recovery
- message: Feedback message (success or error)
- isError: Boolean flag indicating if the message is an error
Features
Email validation
The screen validates the email input before sending a recovery request:Password recovery flow
UsesAuthService to send password reset emails:
UI Components
The screen includes:- Lock reset icon (Material Icons Outlined)
- Email input field with validation
- Submit button to send recovery request
- Feedback card showing success or error messages
- Navigation link back to login screen
Visual feedback
Success and error messages are displayed in colored cards:Usage Example
Basic navigation setup
Standalone usage
Email Validation
The screen uses theisBasicEmailValid() extension function from the validators package:
- Contains an ”@” symbol
- Contains a ”.” character
- Has a non-blank domain after ”@“
Error Handling
Common error scenarios:Blank email
Blank email
Error: “Completa tu email”Cause: User submitted empty email fieldResolution: Enter a valid email address
Invalid email format
Invalid email format
Error: “Email inválido (ej: [email protected])”Cause: Email doesn’t match basic validation patternResolution: Ensure email contains @ and . with proper domain
Network/Firebase errors
Network/Firebase errors
Error: Firebase-specific error messageCause: Network issues or Firebase service errorsResolution: Check internet connection and try again
Design Specifications
- Layout: Vertical column with centered alignment
- Spacing: 24dp horizontal padding, 16dp vertical padding
- Input field: Rounded corners (16dp), full width
- Button: Primary color, 56dp height, full width
- Icon size: 100dp for main lock reset icon
- Theme: Respects Material Design 3 color scheme
Related Components
- LoginScreen - Main authentication screen
- RegisterScreen - User registration screen
- AuthService - Authentication service with recover method
Source Code
View the complete implementation in the repository:app/src/main/java/com/demodogo/ev_sum_2/ui/auth/RecoverScreen.kt