Is there an existing issue for this?
What happened?
📌 Issue Overview
In the Patient App's Personal Details screen, selecting "For my child" mode causes three fields to be incorrectly mapped in the getPersonalInfo getter, silently corrupting every child-mode registration saved to Supabase.
guardianRelation is assigned guardianPhoneController.text instead of selectedRelation. The dropdown value is captured but never read.
phoneNo is hardcoded to phoneController.text (the adult controller), which is always empty in child mode.
country always reads selectedCountry (adult picker). selectedChildCountry is set correctly by the child form but ignored in the getter.
Additionally, the Relation and Patient Gender dropdowns are plain DropdownMenu widgets, so _formKey.currentState?.validate() skips them entirely. A user can submit with no relation or gender selected and it passes silently.
🔍 Steps to Reproduce
- Open the Patient App and sign in
- On the Personal Details screen, select For my child from the "Assessment is for?" dropdown
- Fill in child name, child age, select relation "Guardian", select gender "Male", enter guardian phone
+911234567890, and pick a country e.g. India
- Tap Continue
- Check the
patient table row in Supabase
🎯 Expected Behavior
| Field |
Expected |
guardian_relation |
"Guardian" |
phone |
"+911234567890" |
country |
"India" |
gender |
"Male" |
🚨 Actual Behavior
| Field |
Actual |
guardian_relation |
"+911234567890" (phone stored as relation) |
phone |
"" (always empty in child mode) |
country |
"" (always empty, child picker ignored) |
gender |
"" (dropdown bypasses form validation) |
Root cause in patient/lib/presentation/auth/personal_details_screen.dart:
// guardianRelation gets the phone number, selectedRelation is never read
guardianRelation: isAssessmentForChild ? guardianPhoneController.text : phoneController.text,
// phoneNo always reads the adult controller, empty in child mode
phoneNo: phoneController.text,
// always reads adult country picker, selectedChildCountry is ignored
country: selectedCountry?.displayName ?? '',
📷 Screenshot
Not applicable. The corruption is in the data written to Supabase, not visible in the UI.
💡 Suggested Improvements
Fix the getPersonalInfo getter to branch correctly on isAssessmentForChild:
phoneNo: isAssessmentForChild ? guardianPhoneController.text : phoneController.text,
guardianRelation: isAssessmentForChild ? selectedRelation : '',
country: isAssessmentForChild
? selectedChildCountry?.displayName ?? ''
: selectedCountry?.displayName ?? '',
Add pre-submission checks for selectedRelation and selectedChildGender in the onPressed handler since they are DropdownMenu widgets and are skipped by _formKey.currentState?.validate().
Record
Is there an existing issue for this?
What happened?
📌 Issue Overview
In the Patient App's Personal Details screen, selecting "For my child" mode causes three fields to be incorrectly mapped in the
getPersonalInfogetter, silently corrupting every child-mode registration saved to Supabase.guardianRelationis assignedguardianPhoneController.textinstead ofselectedRelation. The dropdown value is captured but never read.phoneNois hardcoded tophoneController.text(the adult controller), which is always empty in child mode.countryalways readsselectedCountry(adult picker).selectedChildCountryis set correctly by the child form but ignored in the getter.Additionally, the Relation and Patient Gender dropdowns are plain
DropdownMenuwidgets, so_formKey.currentState?.validate()skips them entirely. A user can submit with no relation or gender selected and it passes silently.🔍 Steps to Reproduce
+911234567890, and pick a country e.g. Indiapatienttable row in Supabase🎯 Expected Behavior
guardian_relation"Guardian"phone"+911234567890"country"India"gender"Male"🚨 Actual Behavior
guardian_relation"+911234567890"(phone stored as relation)phone""(always empty in child mode)country""(always empty, child picker ignored)gender""(dropdown bypasses form validation)Root cause in
patient/lib/presentation/auth/personal_details_screen.dart:📷 Screenshot
Not applicable. The corruption is in the data written to Supabase, not visible in the UI.
💡 Suggested Improvements
Fix the
getPersonalInfogetter to branch correctly onisAssessmentForChild:Add pre-submission checks for
selectedRelationandselectedChildGenderin theonPressedhandler since they areDropdownMenuwidgets and are skipped by_formKey.currentState?.validate().Record