@davoodmehraban89 / LifeMate / commits / a607e4c
Fork 0

LifeMate — Personal, Family & Learning Companion

feat: add daughter son and adult invitation themes

davoodmehraban89 committed Oct 5, 2026 at 07:51 UTC a607e4c9134216270a3b472c9181e6071e8d498b
1 file changed +51 -4
apps/lifemate/lib/main.dart
+51 -4
@@ -454,16 +454,58 @@ class _ProfileFamilyPageState extends State<ProfileFamilyPage> {
454
455 Future<void> invite(String familyId) async {
456 final email = TextEditingController();
457 + final choice = ValueNotifier<String>('daughter');
458 final sent = await showDialog<bool>(
459 context: context,
460 builder: (dialogContext) => AlertDialog(
461 title: const Text('دعوت فرزند / عضو'),
461 - content: TextField(controller: email, keyboardType: TextInputType.emailAddress, decoration: const InputDecoration(labelText: 'ایمیل')),
462 + content: Column(
463 + mainAxisSize: MainAxisSize.min,
464 + children: [
465 + TextField(
466 + controller: email,
467 + keyboardType: TextInputType.emailAddress,
468 + decoration: const InputDecoration(labelText: 'ایمیل'),
469 + ),
470 + const SizedBox(height: 12),
471 + ValueListenableBuilder<String>(
472 + valueListenable: choice,
473 + builder: (_, value, __) => DropdownButtonFormField<String>(
474 + value: value,
475 + decoration: const InputDecoration(labelText: 'نوع عضو'),
476 + items: const [
477 + DropdownMenuItem(value: 'daughter', child: Text('فرزند دختر — سفید / صورتی')),
478 + DropdownMenuItem(value: 'son', child: Text('فرزند پسر — سفید / آبی')),
479 + DropdownMenuItem(value: 'parent', child: Text('والد / سرپرست — سفید / آبی')),
480 + DropdownMenuItem(value: 'adult', child: Text('عضو بزرگسال — سفید / آبی')),
481 + ],
482 + onChanged: (v) {
483 + if (v != null) choice.value = v;
484 + },
485 + ),
486 + ),
487 + ],
488 + ),
489 actions: [
463 - TextButton(onPressed: () => Navigator.pop(dialogContext, false), child: const Text('انصراف')),
490 + TextButton(
491 + onPressed: () => Navigator.pop(dialogContext, false),
492 + child: const Text('انصراف'),
493 + ),
494 FilledButton(
495 onPressed: () async {
466 - await widget.api.inviteMember(familyId: familyId, email: email.text, role: 'teen_minor');
496 + final selected = choice.value;
497 + final role = switch (selected) {
498 + 'parent' => 'parent_guardian',
499 + 'adult' => 'adult_member',
500 + _ => 'teen_minor',
501 + };
502 + final theme = selected == 'daughter' ? 'girl_pink' : selected == 'son' ? 'boy_blue' : 'adult_blue';
503 + await widget.api.inviteMember(
504 + familyId: familyId,
505 + email: email.text,
506 + role: role,
507 + themePreference: theme,
508 + );
509 if (dialogContext.mounted) Navigator.pop(dialogContext, true);
510 },
511 child: const Text('ارسال دعوت'),
@@ -472,7 +514,12 @@ class _ProfileFamilyPageState extends State<ProfileFamilyPage> {
514 ),
515 );
516 email.dispose();
475 - if (sent == true && mounted) ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('دعوت ارسال شد.')));
517 + choice.dispose();
518 + if (sent == true && mounted) {
519 + ScaffoldMessenger.of(context).showSnackBar(
520 + const SnackBar(content: Text('دعوت ارسال شد.')),
521 + );
522 + }
523 }
524
525 @override